ID:266711
 
How do i check if a bullet that walks in a straight line hits the edge of the screen?
Edge of the screen? Do you mean the player's screen or the map?
Thief jack wrote:
How do i check if a bullet that walks in a straight line hits the edge of the screen?

if(bullet_obj.x == maxx || bullet_obj.y == maxy)


?

You'll have to be more specific.

- Malver
In response to Malver
How do I check if an object that is walking in a straight line hits the edge of the map?
In response to Thief Jack
One way would be to check the direction, then it's location. if(src.dir == EAST && src.x = maxx) etc. etc. You'd have to set one up for every direction, but that's the best way I know.
In response to Garthor
Is there an easier way?
In response to Garthor
No doesnt work
In response to Thief Jack
Just check to see if the location it's moving to is null.
In response to Foomer
And how do i check that?
In response to Thief Jack
if(!get_step(src,direction))
In response to Foomer
Thanks Foomer
Thief jack wrote:
How do i check if a bullet that walks in a straight line hits the edge of the screen?

I believe get_step() will return null if the next step would be off the map. Just put in a reference to the bullet, and the direction it's travelling in.