area/move-randomly
var/activated=0
Entered(atom/a)
if(!istype(a,/player))return
if(activated) return
activated=1
for(var/tmp/monster/M in src)
M.move_randomly()
ID:273635
Nov 13 2010, 8:45 am
|
|
So I'm making a pixel movement system, but that isn't relevant. I have code that when I enter an area it causes all the monsters in that area to move randomly. However the move randomly proc is an infinite loop, this causes my player to be completely frozen (however he can still shoot his beam). My questions are: this caused by the infinite loops, (which it probably is sense none of the monsters on my screen start moving) and how can I call these guys to move without incurring an infinite loop. The basic code looks like this:
|
Nov 13 2010, 8:48 am
|
|
Use spawn() to call the procedure in a separate thread.
|
In response to Garthor
|
|
wow, I forgot all about spawn. Thx for the help!
|