ScratchData LogoScratchData
Back to EdnaC's profile

ScreenWrapDemo

EDEdnaC•Created September 6, 2007
ScreenWrapDemo
2
2
110 views
View on Scratch

Description

This project "demos" a way to wrap a sprite across the screen, like the old Asteroids game did. The Plane (and missile) watch to see if they are close to the edge, if so, they "transport" to the opposite side of the playing field. This is done by switching the sign of the sprite's s or y coordinate. For instance, if the x-position gets to 239 (very close to the right edge), the code "sets" its x-position to -0.99 * x-position, putting it very close to the opposite edge. 0.99 is chosen to prevent it from getting "stuck" on an edge (twittering between right and left edge). This works well for a small sprite, but wouldn't be good for a big one. Note that the missile moves for a while before checking to see if it's touching the plane. It has to have a chance to "get away" from the plane. Arrows to steer, Up for Afterburner, Down Arrow fires the missile.

Project Details

Project ID34760
CreatedSeptember 6, 2007
Last ModifiedSeptember 6, 2007
SharedSeptember 6, 2007
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root