2020-07-17 09:51:46 -05:00
|
|
|
extends KinematicBody2D
|
2020-07-17 00:27:22 -05:00
|
|
|
|
2020-07-17 09:51:46 -05:00
|
|
|
const UP = Vector2(0, -1)
|
|
|
|
const GRAVITY = 32
|
|
|
|
const SPEED = 200
|
|
|
|
const JUMP_HEIGHT = -550
|
|
|
|
var motion = Vector2()
|
2020-07-17 00:27:22 -05:00
|
|
|
|
2020-07-17 09:51:46 -05:00
|
|
|
func _physics_process(delta):
|
|
|
|
motion.y += GRAVITY
|
|
|
|
|
|
|
|
if Input.is_action_pressed("ui_right"):
|
|
|
|
motion.x = SPEED
|
|
|
|
elif Input.is_action_pressed("ui_left"):
|
|
|
|
motion.x = -SPEED
|
|
|
|
else:
|
|
|
|
motion.x = 0
|
|
|
|
|
|
|
|
if is_on_floor():
|
|
|
|
if Input.is_action_just_pressed("ui_up"):
|
|
|
|
motion.y = JUMP_HEIGHT
|
2020-07-17 00:27:22 -05:00
|
|
|
|
2020-07-17 09:51:46 -05:00
|
|
|
motion = move_and_slide(motion, UP)
|
|
|
|
|
|
|
|
if position.y >= 493:
|
|
|
|
get_tree().change_scene("Death Screen.tscn")
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func _on_Area2D_body_entered(body):
|
|
|
|
body.get_tree().change_scene("Logan is awful.tscn")
|