Hello Everyone, I'm having issues with my simple shooting script. in this script, I used the Gamemaker Astroid script as a reference for the shooting, the rest is just Shaun Spalding's movement and wall jump with variable jump implementation.
How it's supposed to work; The projectile shoots out the left and right of the player object depending on what way the player is facing, and if the player is on a wall and not on the ground shoot away from the wall the player is on.
how it works now; the projectile shoots regardless of the player state and only shoots from the right side of the player object.
I'm on gamemaker v2.3.7.606
Player step// the Shooting bit of the code
Bullet create
Bullet post draw
I tried to be as clear as possible. This is also my first post to the forums so sorry if I don't have all the etiquette down.
How it's supposed to work; The projectile shoots out the left and right of the player object depending on what way the player is facing, and if the player is on a wall and not on the ground shoot away from the wall the player is on.
how it works now; the projectile shoots regardless of the player state and only shoots from the right side of the player object.
I'm on gamemaker v2.3.7.606
Player step// the Shooting bit of the code
Code:
key_left = keyboard_check(ord("A"));
key_right = keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = mouse_check_button_pressed(mb_left)
//shooting
if(key_shoot)
{
var inst = instance_create_layer(x,y,"Bullets", OBullet);
inst.direction = image_angle;
inst.image_angle = image_angle;
}
Code:
speed = 6;
Code:
if (place_meeting(x,y,OWall)) instance_destroy(); // when the bullet hits a wall kill bullet