From 29a7f8018682b0372ba51fcc9550635afc280ee9 Mon Sep 17 00:00:00 2001 From: dogtots <68413697+dogtots@users.noreply.github.com> Date: Fri, 17 Jul 2020 09:51:46 -0500 Subject: [PATCH] --- .gitignore | 1 + script/player.gd | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 5d7cb30..79dee12 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ # Godot-specific ignores .import/ export.cfg + diff --git a/script/player.gd b/script/player.gd index 03b9fc6..aed9090 100644 --- a/script/player.gd +++ b/script/player.gd @@ -1,13 +1,31 @@ -extends Node +extends KinematicBody2D -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +const UP = Vector2(0, -1) +const GRAVITY = 32 +const SPEED = 200 +const JUMP_HEIGHT = -550 +var motion = Vector2() -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. +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 -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass + 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")