H
Hilo Takenaka
Guest
I am creating a metroidvania-style game where the player's main attack is a shooting attack.
What is meant to happen: as soon as the player presses the 'c' key, they shoot a bullet at the third frame of the animation.
The bullets are meant to be infinite, however the game only shoots 8 before no more are generated. It still enters the animation but doesn't generate the bullet.
I have also debugged the game to view if it recognizes the bullet creation, but it doesn't seem to do so after the eighth one.
Can anyone please help me with this issue?
Here is the relevant coding for the creation of the bullets.
Step Event:
if(sprite_index = s_player_shoot){
if (floor((image_index) = 3) && (fired = false)){
show_debug_message("whassad")
instance_create_layer(x, y, 0, o_bullet);
fired = true;
if (image_xscale = 1) {
o_bullet.direction = 0;
o_bullet.speed = 5;
} else {
o_bullet.direction = 180;
o_bullet.speed = -5;
}
}
}
Key up - C:
sprite_index = s_player_shoot;
image_speed = 0.5;
hsp = 0;
walksp = 0;
vsp = 10;
grv = 10;
Animation End:
if sprite_index = s_player_shoot{
sprite_index = s_player_ri;
walksp = 4;
grv = 1;
hsp = move * walksp;
vsp = vsp + grv;
fired = false;
}
s_player_right is the default sprite of the player
The bullet itself only has a collision event which destroys the bullet once it hits a solid object
What is meant to happen: as soon as the player presses the 'c' key, they shoot a bullet at the third frame of the animation.
The bullets are meant to be infinite, however the game only shoots 8 before no more are generated. It still enters the animation but doesn't generate the bullet.
I have also debugged the game to view if it recognizes the bullet creation, but it doesn't seem to do so after the eighth one.
Can anyone please help me with this issue?
Here is the relevant coding for the creation of the bullets.
Step Event:
if(sprite_index = s_player_shoot){
if (floor((image_index) = 3) && (fired = false)){
show_debug_message("whassad")
instance_create_layer(x, y, 0, o_bullet);
fired = true;
if (image_xscale = 1) {
o_bullet.direction = 0;
o_bullet.speed = 5;
} else {
o_bullet.direction = 180;
o_bullet.speed = -5;
}
}
}
Key up - C:
sprite_index = s_player_shoot;
image_speed = 0.5;
hsp = 0;
walksp = 0;
vsp = 10;
grv = 10;
Animation End:
if sprite_index = s_player_shoot{
sprite_index = s_player_ri;
walksp = 4;
grv = 1;
hsp = move * walksp;
vsp = vsp + grv;
fired = false;
}
s_player_right is the default sprite of the player
The bullet itself only has a collision event which destroys the bullet once it hits a solid object