I'm working on a velocities project, but I want to know how to have a ground detection that doesn't bounce. Any help?
Offline
Set to what? My y vel is set to 1 if up key pressed or else -1 if down, and set yv to yv*.9
Offline
Firedrake969 wrote:
No. I know it can be done without one.
Okay.
*optimizes script*
You'll need sensing costumes, then.
Copy the character sprite. Make a red line under the sprite about half the width of the sprite. Erase the character. OK. Do this for each side.
Now, add this script at the beginning of your loop:
switch to costume [sensor_top v] if <touching [ground v]?> set [topsense v] to [1] else set [topsense v] to [0] end switch to costume [sensor_right v] if <touching [ground v]?> set [rightsense v] to [1] else set [rightsense v] to [0] end switch to costume [sensor_bottom v] if <touching [ground v]?> set [bottomsense v] to [1] else set [bottomsense v] to [0] end switch to costume [sensor_left v] if <touching [ground v]?> set [leftsense v] to [1] else set [leftsense v] to [0] endYou gravity will be something like this:
if <(bottomsense) = [0]> change [vel v] by (-0.1) change y by (vel) else set [vel v] to [0] endDon't forget to add
<<> and <(leftsense) = [0]>>etc. to your movement and
if <<(topsense) = [1]> and <(vel) > [0]>> set [vel v] to ((vel) * (-0.8)) endbefore your gravity script.
Offline
Here's the issue. On the
if <key [up-arrow v] pressed?> change [yv v] by (1) else change [yv v] by (-1) endThe issue is, when you aren't jumping, you'll always be sinking, so even if you're touching the ground and the yvelocity is 0, it will immediately be set to -1 unless you're jumping again. So, replace that part of the script with this:
if <key [up-arrow v] pressed?> change [yv v] by (1) end if <not<touching color [#000000]?>> change [yv v] by (-1) endHope this helps!
Last edited by powerpoint56 (2012-08-14 15:20:15)
Offline
powerpoint56 wrote:
Here's the issue. On the
if <key [up-arrow v] pressed?> change [yv v] by (1) else change [yv v] by (-1) endThe issue is, when you aren't jumping, you'll always be sinking, so even if you're touching the ground and the yvelocity is 0, it will immediately be set to -1 unless you're jumping again. So, replace that part of the script with this:if <key [up-arrow v] pressed?> change [yv v] by (1) if <not<touching color [#000000]?>> change [yv v] by (-1) endHope this helps!
The problem with that is I need the guy to fly. Darn this new scratcher status.
Offline
firedrake969_test wrote:
powerpoint56 wrote:
Here's the issue. On the
if <key [up-arrow v] pressed?> change [yv v] by (1) else change [yv v] by (-1) endThe issue is, when you aren't jumping, you'll always be sinking, so even if you're touching the ground and the yvelocity is 0, it will immediately be set to -1 unless you're jumping again. So, replace that part of the script with this:if <key [up-arrow v] pressed?> change [yv v] by (1) end if <not<touching color [#000000]?>> change [yv v] by (-1) endHope this helps!The problem with that is I need the guy to fly. Darn this new scratcher status.
Hmm... Wait, he can! Try it...
Last edited by powerpoint56 (2012-08-14 15:21:13)
Offline
powerpoint56 wrote:
firedrake969_test wrote:
powerpoint56 wrote:
Here's the issue. On the
if <key [up-arrow v] pressed?> change [yv v] by (1) else change [yv v] by (-1) endThe issue is, when you aren't jumping, you'll always be sinking, so even if you're touching the ground and the yvelocity is 0, it will immediately be set to -1 unless you're jumping again. So, replace that part of the script with this:if <key [up-arrow v] pressed?> change [yv v] by (1) end if <not<touching color [#000000]?>> change [yv v] by (-1) endHope this helps!The problem with that is I need the guy to fly. Darn this new scratcher status.
Hmm... Wait, he can! Try it...
Something still isn't working....
Offline
Is this a "build your own terrain" type game or is the stamping sprite only for testing? In essence, is your sprite going to have to be able to detect slopes?
Offline
MoreGamesNow wrote:
Is this a "build your own terrain" type game or is the stamping sprite only for testing? In essence, is your sprite going to have to be able to detect slopes?
Yes, slope detection. And it's not Build your own terrain, it's just for something like Worm Bridges. But better.
Offline
If you don't want a sensor sprite, you could try playing around with this. It's a bit hard to use, and there's no swimming, but it's definitely a good base.
Offline
henley wrote:
If you don't want a sensor sprite, you could try playing around with this. It's a bit hard to use, and there's no swimming, but it's definitely a good base.
For the swimming it's just if touching blue change y by 1
Offline
firedrake969_test wrote:
henley wrote:
If you don't want a sensor sprite, you could try playing around with this. It's a bit hard to use, and there's no swimming, but it's definitely a good base.
For the swimming it's just if touching blue change y by 1
You'd have to do a lot more changes than that to make swimming more realistic, and not just floaty running.
Offline
henley wrote:
firedrake969_test wrote:
henley wrote:
If you don't want a sensor sprite, you could try playing around with this. It's a bit hard to use, and there's no swimming, but it's definitely a good base.
For the swimming it's just if touching blue change y by 1
You'd have to do a lot more changes than that to make swimming more realistic, and not just floaty running.
Could you help me then?
Offline
firedrake969_test wrote:
henley wrote:
firedrake969_test wrote:
For the swimming it's just if touching blue change y by 1You'd have to do a lot more changes than that to make swimming more realistic, and not just floaty running.
Could you help me then?
What do you want? I might help.
Offline