This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-09-02 11:56:03

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Screen Wrap

Idea:

Currently, there's an "if on edge, bounce", how about a new Motion function:  "if on edge, wrap around".  This would track a Sprite, if it reaches the edge, it would begin to appear on the opposite side of the screen  (like "Asteroids").

I implemented something like this in http://scratch.mit.edu/projects/EdnaC/33613.

In this implementation, the Sprite doesn't actually "wrap", it "transports" to the opposite edge.  Since the Sprites are small, and moving, this isn't really obvious and it looks "smooth".

A built in function sure would be nice.  What think ye?

-Mr Ed

Last edited by EdnaC (2007-09-06 12:21:20)

Offline

 

#2 2007-09-02 13:28:10

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Screen Wrap

There are two common systems for handling small screens in x,y coordinates

1) windowing:  stuff in range of the screen is shown, stuff outside that range is not
2) toroidal coordinates (wraparound): all coordinates are mapped to points on the screen by taking x mod screen_width and y mod screen_width

Scratch has taken an unusual third option of not allowing sprites to move to coordinates that are fully off-screen.  This is mathematically much less elegant and is somewhat difficult to compensate for in the programming (making things like scrolling trickier than they would otherwise have been).  It has the advantage for beginners that their sprites are always on screen (unless hidden or severely ghosted).

Personally, I think that having a button to retrieve the sprite and recenter it would have been better for the beginners, and a simpler mathematical framework for the sprites (window on the xy-plane) would have been better pedagogically.

Offline

 

Board footer