Files
foxfox/tmp/jump_probe.gd

21 lines
631 B
GDScript

extends Node
func _ready() -> void:
var fox := get_node("Level1/Fox") as CharacterBody2D
fox.position = Vector2(120, 516)
fox.velocity = Vector2.ZERO
var maxY := fox.position.y
fox.velocity = Vector2(0.0, -450.0)
for i in range(120):
await get_tree().physics_frame
fox.velocity.y += 980.0 * 0.016
fox.move_and_slide()
if fox.position.y < maxY:
maxY = fox.position.y
if fox.velocity.y > 0.0:
break
print("maxY=", snappedf(maxY, 0.1))
print("height from spawn 516=", snappedf(516 - maxY, 0.1))
print("maxY=", snappedf(maxY, 0.1))
print("height from spawn 516=", 516 - snappedf(maxY,0.1))
get_tree().quit()