Godot Version
` Godot 4.5.1
Question
` Hi! I’m currently working on my first mini-game in Godot.
I’ve implemented a mechanism—let’s call it a “Jumper”—that’s designed to detect the player and apply a strong directional force. This force should push the player either upward (if they look up) or horizontally (in the opposite direction of the Jumper’s side).
I’ve encountered two main issues with the current implementation:
Slow Entry Problem: If the player enters the Jumper’s detection area slowly, the push effect doesn’t activate or work reliably.
Horizontal Placement Bug: The Jumper doesn’t work at all when it is placed to apply force horizontally.
I suspect the physics processing or detection logic might need adjustment. Here is the code for the Jumper:
extends Area2D
Called when the node enters the scene tree for the first time.
func _ready() → void:
body_entered.connect(func(body:Node2D)->void:
if body is Player:
if int(rotation)%360==0:
body.velocity.y-=2400.0
elif int(rotation)%360!=0:
body.velocity.x-=(gravity+400)*position.angle()
)