M
Marko Kajtazi
Guest
Hi everyone,
I have a problem with my variables. When I create a new instance for my bullet in the bullet object I have.
The problem is when the bullet collides with oCollision and when I am setting the hspd to 0, I want hspd to remain to be 0. But in my game if the bullet stops colliding on the x with the wall it continues to go to the other wall.
Can anyone help me?
Thanks.
I have a problem with my variables. When I create a new instance for my bullet in the bullet object I have.
Code:
//create event
movespeed = 16;
grav = 0;
bounce_force = 5;
dir = oPlayer.image_xscale;
hspd = dir * 4;
vspd = 0;
image_xscale = oPlayer.image_xscale;
// step event
hspd += dir * 4;
hspd = clamp(hspd, -movespeed, movespeed);
vspd += grav;
if(place_meeting(x + hspd, y, oCollision)) {
while (!place_meeting(x + sign(hspd), y, oCollision)) {
x += sign(hspd);
}
hspd = 0;
}
x += hspd;
Can anyone help me?
Thanks.