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
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