http://scratch.mit.edu/projects/Pikachanian/70223
Offline
Sorry, is that project one you wanted help with? What exactly did you want to have happen, and what happens instead?
Offline
it is supposed to be able to fall through platforms that are "behind" it but land on platforms that are not.
Offline
How is your sprite detecting whether it is in front of or behind platforms? I thought that scratch did not have any way of detecting which layer sprites were on.
Offline
each sprite has a "z axis" that controls size and what layer it is on.
Offline
OK, I downloaded your program to look at the code. The trouble is that you have 4 different scripts all telling the sprite how to move. Having one say move up while the other 3 say move down is not likely to do the right thing.
Perhaps you should try having only one script do movement.
I tried simplifying your code:
when greenflag clicked
set moveup to 0
forever
if moveup>0
change y by 2
else
change y by -2
The 4 scripts like
when greenflag clicked
forever if touching sprite2 and (cz=p1 zaxis or cz < p1 zaxis)
set moveup to 1
and one more script to turn things off
when greenflag clicked
forever if not (touching sprite2 or touching sprite3 or touching sprite4 or touching sprite5)
set moveup to 0
This is not the way I would have coded the task, but it is as close as I could get to what you started from. It seems to work.
It might be more efficient to add
wait until moveup < 1
after each of the "set moveup to 1" blocks.
Also, in v1.2.1 you don't need global variables for all the z-axis variables. Just give each sprite it's own "z" variable and use the sensing block to look at "sprite2's z". That will make the code much clearer, particularly if you first give the sprites meaningful names (cat, top platform, ...).
Offline
Thanks! I fixed by making it a single script and now it works!
Offline