Abdur Olajuwon
Member
I been trying to figure this out for about an hour, but i am trying to program my character shooting projectiles. Well, i got the character to shoot projectiles, but it is only shooting to the right when I move my character to the right. When I move my character to the left, the projectiles still go to the right.
I was wondering how I can code it to where when I move left the projectiles will go in that direction. I know have to put "image_xscale" in the code, but I don't know how I code it. Here is what I have so far:
Here is the code for flipping the animations of my sprite
I was wondering how I can code it to where when I move left the projectiles will go in that direction. I know have to put "image_xscale" in the code, but I don't know how I code it. Here is what I have so far:
Code:
// Shoot Projectile
if keyboard_check(ord('A')) && (canShoot)
{
instance_create(x+16,y,obj_bullet);
canShoot = false
alarm[0] = shotCounter;
}
Code:
//Animations
if (hsp == 0)
{
sprite_index = spr_flare
image_speed = 0.1;
}
else if keyboard_check(vk_right)
{
sprite_index = spr_flarerun
image_xscale = 1
image_speed = .1;
}else if keyboard_check(vk_left)
{
sprite_index = spr_flarerun
image_xscale = -1
image_speed = .1;
}