Art
This commit is contained in:
1 parent
e808431fc2
commit
e440224fd8
10 files changed
+89
-17
No files matched your search
+29
-9
@@ -1,20 +1,31 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
const SPEED = 400.0
|
||||
const SPEED = 380.0
|
||||
|
||||
const GRAVITY_MULT = 0.8
|
||||
|
||||
const JUMP_VELOCITY = -410.0
|
||||
|
||||
const CAMERA_SMOOTHING_SPEED = 0.5
|
||||
|
||||
var fall_timer = 0.0
|
||||
var teleport_cooldown = 0
|
||||
var jumps = 0
|
||||
var death_threshold = 1000
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func refresh_jump(new_jumps):
|
||||
if jumps:
|
||||
jumps = new_jumps
|
||||
else:
|
||||
jumps = 1
|
||||
teleport_cooldown = 0
|
||||
|
||||
func on_teleport():
|
||||
refresh_jump(1)
|
||||
teleport_cooldown = 1
|
||||
$Camera2D.position_smoothing_enabled = true
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
if is_on_floor():
|
||||
@@ -38,19 +49,28 @@ func _process(delta: float) -> void:
|
||||
velocity.x = direction * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
print("PLAYER X POSITION: " + str(position.y))
|
||||
if position.y >= death_threshold:
|
||||
print("SLASH KILL")
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
fall_timer += 1*delta
|
||||
if is_on_floor():
|
||||
fall_timer = 0
|
||||
jumps = 1
|
||||
teleport_cooldown = 0
|
||||
refresh_jump(1)
|
||||
#%Player2D.get_node("Camera2D").position_smoothing_speed = %Player2D.CAMERA_SMOOTHING_SPEED
|
||||
|
||||
if is_on_wall():
|
||||
jumps = 1
|
||||
teleport_cooldown = 0
|
||||
refresh_jump(1)
|
||||
#%Player2D.get_node("Camera2D").position_smoothing_speed = %Player2D.CAMERA_SMOOTHING_SPEED
|
||||
|
||||
if fall_timer>3:
|
||||
get_tree().reload_current_scene()
|
||||
if is_on_ceiling():
|
||||
refresh_jump(1)
|
||||
|
||||
if fall_timer > 3:
|
||||
pass
|
||||
#get_tree().reload_current_scene()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
Reference in new issue
Block a user