set [Yvelocity] to (0)Or whatever you've called the velocity variable.
Offline
Tatl wrote:
Where do I put it?
In your velocity script. Use something like this:
when gf clicked forever if <touching [ground v]?> set [Yvelocity v] to [0] else set [Yvelocity v] to ((Yvelocity) * (0.89)) end end
Offline
That doesn't provide gravity though.
I'm new, so please be more specific. Right now my script looks like this:
when gf clicked forever if <touching [ground v]> set [yvelocity v] to 0 if <key [up arrow v] pressed?> set [y velocity v] end else set [yvelocity v] to ((yvelocity) * (89)) end endWhat am I doing wrong? That doesn't provide any gravity at all.
Offline
Yes, but I forgot to put that in the script.
Everything else is just like it is above. Without the mistakes I made typing.
It jumps when I press up, and then it just slows to a halt, and doesn't come down. I think it's because of the [set [yvelocity v] to ((yvelocity) * (89))] block, but I'm not sure.
Offline
I think the issue is that the 89 in the "((y-vel) * (89)) should be a 0.89, unless that was just a typing mistake you made.
Offline
powerpoint56_test wrote:
I think the issue is that the 89 in the "((y-vel) * (89)) should be a 0.89, unless that was just a typing mistake you made.
I never use that account on the forums... oops...
Offline
Tatl wrote:
That doesn't provide gravity though.
I'm new, so please be more specific. Right now my script looks like this:when gf clicked forever if <touching [ground v]?> set [yvelocity v] to (0) end if <<key [up arrow v] pressed?> and <touching [ground v]?>> set [yvelocity v] to (5)//Or whatever you have. else change [yvelocity v] by (-1)//Change this to change gravity's strength. end endWhat am I doing wrong? That doesn't provide any gravity at all.
Edited and fixed.
Anyway, the reason why your character never fell to the ground was because it would eventually set yvelocity to 0 and yvelocity wouldn't go negative, therefore causing the floating effect. You have to have
[change [yvelocity v] by (some negative number)] or else you will always get a floating effect.
Last edited by ErnieParke (2012-09-09 20:23:51)
Offline
ErnieParke wrote:
Tatl wrote:
That doesn't provide gravity though.
I'm new, so please be more specific. Right now my script looks like this:when gf clicked forever if <touching [ground v]?> set [yvelocity v] to (0) end if <<key [up arrow v] pressed?> and <touching [ground v]?>> set [yvelocity v] to (5)//Or whatever you have. else change [yvelocity v] by (-1)//Change this to change gravity's strength. end endWhat am I doing wrong? That doesn't provide any gravity at all.Edited and fixed.
Anyway, the reason why your character never fell to the ground was because it would eventually set yvelocity to 0 and yvelocity wouldn't go negative, therefore causing the floating effect. You have to have
[change [yvelocity v] by (some negative number)] or else you will always get a floating effect.
That works pretty well and all, but the player's legs keep getting stuck in the ground and he won't go up.
Is there a way to make the player go up when under ground, but not bounce?
Offline
Closed by request.

Offline