how do you make a sprite not go through the floor like you can walk and remain on top of the ground with out falling through please help, step by step if possible i need like what bricks and where to put them, any help would be appreciated. thanks.
Offline
I am not going to show u bricks, instead tell you the theroy (in detail) so you can do it ure self and learn.
Basicly you want 2 variables, last good x and y and a if/else statment. If your charecter sprite is touching your ground sprite/colour then the the character's X and Y should be set to the variables, last good x and y. in the else, you are going to set your last good x/y to your current x/y. This sould provide you with perfect movment, up/down/left and right.
hope uve lernt!
Offline
You need to make the floor a background, not a sprite. Or, if you are trying to make a scrolling background and so you need to use the floor as a sprite, then you have to use this script for the SPRITE:
[blocks]<when green flag clicked>[/blocks]
[blocks]<show>[/blocks]
[blocks]<go to front>[/blocks]
Then your sprite will appear and move in front of everything else on the screen.
Happy Scratch-ing!
Offline
In the character
<forever>
<if> <touching color[ ground
<change y by( positive #
[/blocks]
Keep the ground the same color.
If the ground is multiple colors, make it a sprite, and do
<touching[ ground sprite
[/blocks]instead of
<touching color[ ground color[/blocks]
Offline
http://scratch.mit.edu/projects/dreamtaker/369286
this might help
Offline
Here is what you do, these are the scripts
<forever>
<if><touching[ ground
<change y by( 1 ) or two, it doesn't matter that much
now make a new script:
<forever>
<if> << <not> >><touching[ ground
<change y by( -1 )
These two scripts make the sprite fall if not touching the ground and stay on if he is touching the ground. The first is for staying on and the second is for falling
Offline
You could do
<when green flag clicked>
<go to x 0 )y 0
<repeat until><touching[edge
<change y by( -5
<end>
every time you drag it up, it falls back down. without going through.
hope it helps
Last edited by fg123 (2009-01-03 13:56:36)
Offline