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

#1 2012-05-27 14:01:01

RaghuramanS
New Scratcher
Registered: 2012-05-25
Posts: 1

How do you make a sprite not go through the bottom or top of a sprite?

basically like a game where you can stand on a sprite and not go through it. From the bottom.

Offline

 

#2 2012-05-27 14:11:21

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: How do you make a sprite not go through the bottom or top of a sprite?

What you have to do is:

When gf clicked
Forever
If <[right arrow v] key pressed?>
Change x by (2)
End
If <left arrow v] key pressed?>
Change x by (-2)
End
If <<[up arrow v] key pressed> and <not <touching color [color of bottom of sprite]?>>>
Change y by (14)
End

Last edited by turkey3 (2012-05-27 14:12:57)

Offline

 

#3 2012-05-28 12:45:08

wasabi56
Scratcher
Registered: 2012-02-10
Posts: 500+

Re: How do you make a sprite not go through the bottom or top of a sprite?

turkey3 wrote:

What you have to do is:

When gf clicked
Forever
If <[right arrow v] key pressed?>
Change x by (2)
End
If <[left arrow v] key pressed?>
Change x by (-2)
End
If <<[up arrow v] key pressed?> and <not <touching color [color of bottom of sprite]?>>>
Change y by (14)
End

I guess that would work, but turkey could use half-ish gravity, such as:

when gf clicked
forever
if <touching color [Color of top of sprite]?>
change y by [5]
end
if <touching color [color of bottom of sprite]?>
change y by [-5]
end


http://i.picasion.com/pic58/c23d4d2fc75f459dcf3d9ebf3e8ba395.gif
http://www.weebly.com/uploads/1/0/1/4/10146167/2294523_orig.png

Offline

 

Board footer