Pages: 1
Topic closed
Could you please post the Script (and possibly explain how it works) That keeps characters from going through the the ground or other objects, without stopping movement scripts.
Thanks.
Offline
Try something like this:
[forever]
[][if <key [right arrow] pressed?>]
[][][change x by (5)]
[][][if <touching color [terrain color]?>]
[][][][change x by (-5)]
[][][end if]
[][end if]
[end forever]
Offline
For the ground
[forever]
[][if <touching color [ground color]?>]
[][][change y by (1)]
[][else]
[][][change y by -1]
[][end if-else]
[end forever]
Try that. Its basically saying, if touching ground go up but if not then go down (gravity) and if touching ground go up but if not then go down... etc. etc. etc. (hence the forever).
Offline
For the ground, do this:
[when flag clicked]
[if <not <touching color [ground color]> >]
[change y by (-[Number. Higher the number, faster you fall.]) ]
Then make a jumping script:
[when [up arrow] key pressed]
[if <touching color [ground color]
[repeat (number)]
[change y by [number] ]
The above scripts will let you jump, and let you fall back down onto the ground.
It's a very simple script, but if you want to make it more complicated, you can change the jumping script so that it seems like there is gravity.
Hope this helped.
Offline
Topic closed
Pages: 1