Sorry to be that guy, but what do you mean by jump? Assuming you have a movement system, gravity and “friction” (deceleration in the x axis, most of the time) working in your game as most platformes do, you could do what the sonic bouncers do, by just setting the velocity.x or velocity.y to a realy high value when the bouncer triggers (you can handle the trigger with many things, including area_detected methods). And of course, you can have a var or export var in each bouncer saving its direction, which you can send to the player with a signal for example.
but assuming the bouncer is pointing to the left
in order to do as you say I’ll have to modify each bouncer manually
I think it amateurish…
godotuser123 | 2022-06-11 18:12
You can use the bouncer’s Y axis for the direction, multiplied by some scalar for amplitude. You can then add the resulting vector to the character’s existing motion vector.
stormreaver | 2022-06-11 23:30
You have a huge amount of different ways to do it. But in all of those, the info of where the bouncer is “pointing to” has to exist somewhere.
For example, if you have only one bouncer scene that you then rotate when you put it in the world, you can go to the scene and add a “pointer” Node2d as a child in the apropiate position, and then you just say that the direction is equal to the pointer position normalised.
Another example, instead of rotating them, you could have an export var that says “right”, “left”, etc… and then the var direction checks this and takes the apropiate value (and also rotates the sprite acordingly).
Somewhere in the procces you have to tell the engine where the bouncer is pointing at, wether visually or in code.
It seems you are not really puting in the effort of trying to figure it out
Pomelo | 2022-06-12 15:25
with all due respect
you can’t judge my efforts through a computer
if u wanna help , then help with no unnecessary comments
godotuser123 | 2022-06-12 18:49
Sorry, not refering to your actuall effort in making the game, but with how you were dealing with the awnser. Let me know if you need more help.
Pomelo | 2022-06-12 18:55
Sorry but couldn’t figure it out yet
godotuser123 | 2022-06-12 19:07
what about the axis?
for example if the bouncer is pointing to the northeast direction
godotuser123 | 2022-06-12 19:29
Assuming that the Y axis is up by default (without rotations), then the math is the same all the time. I’m also assuming a KinematicBody2D. When you orient your node, the local Y axis will orient the same way as well. If you rotate your node so it’s pointing to the northeast, the locate Y axis will also be pointing northeast.
To impart a bounce to your motion vector:
vecMotion += bouncer.transform.basis.y * nBounceForce.
If you’re using a RigidBody2D, then you impart the bounce using one of the impulse functions rather than tracking the motion yourself. But the force calculation is the same either way.
stormreaver | 2022-06-12 22:26
Its the same. If you use an “empty” Node2d as the pointer, doesnt matter where the bouncer is pointing, the position of the pointer will always tell you the direction you want to pass to the player. you would do it like this (seudo code)
# Bouncer script
var direction: Vector2
direction = ($Pointer.global_position - global_position).normalized()
Of course how you pass the direction to the player is up to you, I just would do it like this
Pomelo | 2022-06-12 23:29
If Im using a staticbody?
godotuser123 | 2022-06-13 04:24
It’s the same if you’re using a StaticBody.
stormreaver | 2022-06-13 11:16