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

#1 2010-05-11 18:31:34

Mrkennedyfreak
Scratcher
Registered: 2010-05-11
Posts: 1

Ground.

I have to make a game for one of my classes, and would like to know how to keep a sprite on-top of another sprite, without it falling through or walking through. If someone would help me it would be highly appreciated.

Offline

 

#2 2010-05-11 19:10:31

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Ground.

Well, you could easily make it so that

if <touching [ground] >
   change y by 2
else
   change y by -2
=

This would make it so that if the sprite is touching the ground, it will move up (you could just as easily have made it do nothing, but then if there was, say, a slope on the ground, the sprite would just go right through it), otherwise, it will move down. That should take care of, to an extent, gravity, and make sure it won't fall through the ground.

Also, don't forget to put the "forever" around that!

Offline

 

Board footer