Pages: 1
Topic closed
I'm making a platformer, and to ensure that the player doesn't go through the ground, I added 'If Touching Ground, Change Y by 1'. The problem with this is that I also made it so you can't jump unless you are touching the ground. Anyone know of an easy fix for this?
Offline
This way is easier:
These scripts are from Clash.
This is pretty much how it works: The Sensor's Scripts:
Player1's Scripts:
PS: This tests for each side instead of the entire sprite. Hope this helps!
Last edited by Jwosty (2010-08-04 18:30:20)
Offline
Jwosty wrote:
This way is easier:
These scripts are from Clash.
This is pretty much how it works:
http://i25.tinypic.com/e0hfno.png The Sensor's Scripts:
http://i28.tinypic.com/2ui7io3.gif
http://i30.tinypic.com/29goawx.jpgPlayer1's Scripts:
http://i32.tinypic.com/359h8uu.jpg
PS: This tests for each side instead of the entire sprite. Hope this helps!![]()
Huh? I know about adding sensors and all that, but I want the character to travel to the top of the land because with y velocity, he travels through to the middle of the ground.
Offline
Simply make a small sprite (a single pixel will do) and send it to the x position of your character, and your y position minus enough so that it's barely off of the bottom of the character. Hide it, and use that as a sensor for whether or not it's touching the ground.
Sorry if that wasn't specific enough for you I can write up a more detailed explanation if you wish.
Offline
coolstuff wrote:
Simply make a small sprite (a single pixel will do) and send it to the x position of your character, and your y position minus enough so that it's barely off of the bottom of the character. Hide it, and use that as a sensor for whether or not it's touching the ground.
Sorry if that wasn't specific enough for youI can write up a more detailed explanation if you wish.
That makes sense. Thanks
Offline
just put the jumping script in front of the script that makes it move up if touching the ground. if it was the other way around, it would move above the ground before you jump, so you weren't touching the ground and couldn't jump.
Offline
Topic closed
Pages: 1