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

#1 2011-12-27 20:10:08

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

sprites clogging on the side of the screen

All scratchers who make scrolling games have this problem. When the sprite is supposedly offscreen it stays at the side. How do you get rid of this? Here's how (this is a script for isometric games that will go for the terrain that the main sprite is walking on

when green flag clicked (when the game starts)
forever start
if 360<y position or -360>y position or x position > 480 or x position < -480
hide
if ends
if not 360<y position or -360>y position or x position > 480 or x position < -480
show
if ends
forever ends

This works because the dimensions of the screen is 480 x 360 which is why the scrolling scripts work to.

Please, if you know this already, please don't say 'oh that's easy' because a lot of people don't


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#2 2011-12-28 15:00:14

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: sprites clogging on the side of the screen

That works for most sprites, however with more freeform sprites 360 and 480 are not always the maximums for the boundaries.  A script that would work for all sprites would be this:

http://img163.imageshack.us/img163/5830/scriptx.gif

Last edited by Kileymeister_test (2011-12-28 15:01:02)


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

Board footer