pixeltroid
Member
ok, so basically I have a weapon object that is attached to the player when its called. I have made it so that the weapon points in the direction the player is facing/
What happens is that the weapon object gets created at a specific point in relation to players position -- whether he's facing left and right for standing, crouching, jumping or pointing up. When the weapon is created, it plays a short animation of around 5 frames and then self destructs. Works fine....almost.
But there is one problem that has been bugging me and I dont know how to fix it.
When I point up and use the weapon, the sprite appears and works just fine. BUT....if I turn around while the sprite is playing, the sprite/object changes its orientation for some reason -- and I cant figure out whats causing it.
Here's what the problem looks like:
This is when I'm pointing up. Works great.
This is when I turn around while the weapon sprite is playing. The object/sprite appears to be flipped over vertical.
Here's the code of the script that's called when I point up and press the button to use that weapon.
I have this code in the weapon object's end step event:
How do I fix the issue?
Please let me know if you want to see more related code!
Any help would be greatly appreciated!
What happens is that the weapon object gets created at a specific point in relation to players position -- whether he's facing left and right for standing, crouching, jumping or pointing up. When the weapon is created, it plays a short animation of around 5 frames and then self destructs. Works fine....almost.
But there is one problem that has been bugging me and I dont know how to fix it.
When I point up and use the weapon, the sprite appears and works just fine. BUT....if I turn around while the sprite is playing, the sprite/object changes its orientation for some reason -- and I cant figure out whats causing it.
Here's what the problem looks like:
This is when I'm pointing up. Works great.
This is when I turn around while the weapon sprite is playing. The object/sprite appears to be flipped over vertical.
Here's the code of the script that's called when I point up and press the button to use that weapon.
Code:
if image_xscale > 0 {
{
var fl = instance_create(x-5 , y-40, obj_flamethrower); //creates weapon object
fl.direction = 90
fl.image_angle = 90
fl.speed = 0;
}
global.flame -= 1
alarm[5]= 60
}
if image_xscale < 0 {
{
var fl = instance_create(x+5 , y-40, obj_flamethrower); //creates weapon object
fl.direction = 270
fl.image_angle = 270
fl.speed = 0;
}
global.flame -= 1
alarm[5]= 60
}
//store variables for following
fl.owner = id;
fl.x_offset = 1*image_xscale;
fl.y_offset = -41*image_yscale;
Code:
if instance_exists(owner) {
image_xscale = owner.image_xscale;
x = owner.x + x_offset;
y = owner.y + y_offset;
}
Please let me know if you want to see more related code!
Any help would be greatly appreciated!