Touching the side

by RexRanRum (no login)

I assume you mean the error that pops up when you try to PUT a graphic out of the bounds of the screen.

You can technically do error handling to prevent the program from dying, but the graphic still won't display. What you should do is simply prevent the PUT statement from placing anything over the edges, which you would have to implement yourself.

Just do a check whenever you move the sprite. If the updated X or Y coordinates are less than zero OR the far X or Y coordinates (X + width, Y + height) are greater than or equal to the screen dimensions (320x200 in SCREEN 13), prevent the movement:

IF m$ = "6" AND x < 269 THEN x = x + 1
' not 270 since it will become 270 after the increment, and 270+50 (width) = 320
IF m$ = "4" AND x > 0 THEN x = x - 1


Or something around those lines.

Posted on May 11, 2008, 7:22 PM
from IP address 72.241.253.91

Respond to this message   

Goto Forum Home