Just a tad ugly. in Developer Help
|
|
Code:
proc BDrop() var/stepped = 0 while(src) if(src.y<=33) del src else if(src.x>=34) if(src.x<=44) var/r = rand(1,3) if(r==1) step(src,SOUTHEAST) if(r==2) step(src,SOUTHWEST) if(r==3) step(src,SOUTH) else var/r = rand(1,2) if(r==1) step(src,SOUTHWEST) if(r==2) step(src,SOUTH) stepped = 1 if(!stepped) if(src.x<=44) if(src.x>=34) var/r = rand(1,3) if(r==1) step(src,SOUTHEAST) if(r==2) step(src,SOUTHWEST) if(r==3) step(src,SOUTH) else var/r = rand(1,2) if(r==1) step(src,SOUTHEAST) if(r==2) step(src,SOUTH)
sleep(5) stepped = 0
|
Problem description:
This is a simple proc called when an object (a banana) is created. It is meant to fall from a height, swaying slightly (and randomly) as it goes down until it gets to y = 33 where it is deleted.
It works fine, but it looks UGLY! How can I neaten this up a bit? The "if" statements are to keep it between x = 34 and x = 44
~Ease~
|