ID:139493
 
Code:
    proc
bgscroll(turf/stars, number)
while(stars.scroll == 1)
var/somenumber = number * 4
stars.pixel_x -= somenumber
sleep(1)
if (stars.pixel_x < (stars.x + 2) * -32)
stars.pixel_x = 0
stars.overlays = null
var/starss = rand(1, 10)
var/a=0
for(a=1, a<=starss, a++)
var/color = rand(1, 12)
var/image/star = new('stars.dmi', "[color]")
star.pixel_x = rand(-16, 16)
star.pixel_y = rand(-16, 16)
stars.overlays += star
stars.pixel_x = ((world.maxx - stars.x) - 1) * 32




So, I was goofing around with this little project a while back, I was going to make a pixel-movement side-scrolling space-shooter, but that's not really the point. I made this looping proc to scroll the background, by gradually editting its pixel_x at various rates after applying a randomized star pattern to it. The background scrolls wonderfully, and for the most part it works just as planned. After a minute or so, though, the game will just lock up, with the message that I'd reached the maximum recursion limit, regardless of the setting of world_loop. Any idea what the problem could be?