extends Area2D export var speed = 1 # How fast the player will move (pixels/sec). export var jump_speed = 10 signal move signal hit var screen_size var speed_y = 0 func start(): position = screen_size / 2 # Called when the node enters the scene tree for the first time. func _ready(): screen_size = get_viewport_rect().size func _process(delta): if Input.is_action_just_pressed("ui_accept"): speed_y = min(speed_y, 0) - 1 * jump_speed speed_y += 1 position.x += 1 position.y += speed_y * speed emit_signal("move") # TODO find the correct rotation, noob rotation = atan(speed_y / speed) + PI / 2 func _on_Player_body_entered(body): print("HIT") #hide() # Player disappears after being hit. emit_signal("hit") $CollisionShape2D.set_deferred("disabled", true)