Discuss Scratch

heshi2
Scratcher
64 posts

jumping help

hi

so when i jump onto something i only want to be able to get onto it from above, not from beneath it.
i know you can do like the thin layer of a different color, but could someone tell me a possible script for that or even a different method script
thanks
scubajerry
Scratcher
1000+ posts

jumping help

This lets you do that and more. It may be too much. http://scratch.mit.edu/projects/12969047/
heshi2
Scratcher
64 posts

jumping help

sorry but it is to much
my jumping script doesn't involve velocity or gravity, just changing the y position

do you know how to do it with that?
derniersamourai
Scratcher
100+ posts

jumping help

What you want is a specific case of “event” that is not in the “event” section or “sensing” section.
So you have to define you own “event”.
The conditions to tests are:
1) coming from above
AND
2) reaching the platform.

For 1) you can:
a) tests “direction” is you sprite moves accodring its direction.
b) tests the “delta y”, i.e. you store the position of y before and test against the current position. So you declare variable “old y” and run forever the following:
forever
wait (0.1) secs
if < not <(old y) = (y position)> > then
set (old y) to (y position)

For 2) you can test against the “beginning” of touching the platform. For that you have to create a variable with the old value of “touching” and you compare the old value with the fact it is touching now or not.
forever
wait (0.1) secs
if < < touching(sprite3)> and <(was_touching) = (0)> >then
set (was_touching) to (1)
else
if < < touching(sprite3)> and <(was_touching) = (1)> >then
set (was_touching) to (2)
else
if <not < touching(sprite3)> > then
set (was_touching) to (0)

heshi2
Scratcher
64 posts

jumping help

is there anything more simple like just changing the y position if you come from below
CommanderRo999
New Scratcher
2 posts

jumping help

Hi HI Hi
hourtanok
Scratcher
31 posts

jumping help

Seriously, don't necrobump.

Powered by DjangoBB