ID:150046
 
Situation: I have in my game an attack verb..when 1 player attacks another they will both appear in different locations to give the effect that they are fighting really fast and will move around...and it does it looks cool and gives my game origonality =P..BUT if they fight on the edge of the screen and the player is using macros the fighting will still look ok but they might move a few to many squares than intended and go off the map...HENCE a black screen..Anway...How do i stop them going into the evil blackness??? :( *cries*

thanks for any help anybody, im totally stumped on this one
Rukawa wrote:
Situation: I have in my game an attack verb..when 1 player attacks another they will both appear in different locations to give the effect that they are fighting really fast and will move around...and it does it looks cool and gives my game origonality =P..BUT if they fight on the edge of the screen and the player is using macros the fighting will still look ok but they might move a few to many squares than intended and go off the map...HENCE a black screen..Anway...How do i stop them going into the evil blackness??? :( *cries*

I think the way to avoid this would simply be to add an if() check to see if the new location exists every time a player moves.

Lummox JR
In response to Lummox JR
You could also Move() them around rather than locate()ing them around.

mob.Move(locate(x,y,z or wherever))

versus

mob.loc = locate(x,y,z)

Moving won't let you go off the map (So far as I know).
In response to Foomer
ok so how do u make an if statement to see if the area they are going to exists?...if(area exists) hehe please tell me =P~ or is there someway u can put if(area is somewere inbetween (300,300,1) and (1,1,1) ?? help =\
In response to Rukawa
You could try checking against world.maxx and world.maxy, like so:

mob/proc/loccheck()
if(src.x > world.maxx ||src.y > world.maxy)
//what you want to do when they reach outside the map.
else
return..()