D
Dibidoolandas
Guest
As it says in the title, I have very fast bullets in my game and I'm focusing first on having them destroy terrain/collide with walls. The problem is they're still flying through things. I've read up on the subject but for whatever reason the solution I see people reference doesn't appear to be working for me.
Create event just sets variables for hsp, hdir (speed and direction)
End Step event (I've been instructed that this should take place on end step)
var hit_wall;
hit_wall = (collision_line(xprevious, yprevious, x, y, par_impassible, false, false))
if (hit_wall != noone)
{
if (hit_wall.destructible == true)
{
with (hit_wall)
{
hp --;
}
}
instance_destroy();
}
Step event (The bullet's regular movement)
hsp = acc * hdir; //speed * direction = horizontal speed
x += hsp;
Any thoughts? Generally it seems like the bullet still only destroys things it comes into contact with. However every once in a while it seems like it's destroying more than that? Additionally this sometimes destroys the wall AFTER the one closest to the player, then destroys the wall closest.
Create event just sets variables for hsp, hdir (speed and direction)
End Step event (I've been instructed that this should take place on end step)
var hit_wall;
hit_wall = (collision_line(xprevious, yprevious, x, y, par_impassible, false, false))
if (hit_wall != noone)
{
if (hit_wall.destructible == true)
{
with (hit_wall)
{
hp --;
}
}
instance_destroy();
}
Step event (The bullet's regular movement)
hsp = acc * hdir; //speed * direction = horizontal speed
x += hsp;
Any thoughts? Generally it seems like the bullet still only destroys things it comes into contact with. However every once in a while it seems like it's destroying more than that? Additionally this sometimes destroys the wall AFTER the one closest to the player, then destroys the wall closest.