Some tutorial
This commit is contained in:
1 parent
d9d5bb3259
commit
c9510f8902
16 files changed
+134
-22
No files matched your search
+5
-2
@@ -7,8 +7,9 @@ const FRICTION = 100
|
||||
const GRAVITY_MULT = 0.8
|
||||
const JUMP_VELOCITY = -410.0
|
||||
const DASH_LENGTH = 0.2
|
||||
const BACKGROUND_COLOR = Color.SANDY_BROWN
|
||||
const BACKGROUND_COLOR = Color.INDIAN_RED
|
||||
|
||||
var death_cooldown = 0.0
|
||||
var fall_timer = 0.0
|
||||
var teleport_cooldown = 0
|
||||
var jumps = 0
|
||||
@@ -91,6 +92,7 @@ func spawn_ghost(ghost_position):
|
||||
ghost.position = ghost_position
|
||||
|
||||
func on_death(instant = false, player_position = position):
|
||||
death_cooldown += 1
|
||||
if !instant:
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
get_tree().paused = true
|
||||
@@ -108,6 +110,8 @@ func on_death(instant = false, player_position = position):
|
||||
|
||||
#position = %LevelStart.position
|
||||
position = spawn_point
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
death_cooldown = 0
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_released("restart") or (Input.is_action_pressed("controller_restart_left") and Input.is_action_pressed("controller_restart_right")):
|
||||
@@ -208,7 +212,6 @@ func _process(delta: float) -> void:
|
||||
#get_tree().reload_current_scene()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
||||
if not is_on_floor():
|
||||
velocity += (get_gravity() * GRAVITY_MULT) * delta
|
||||
|
||||
|
||||
Reference in new issue
Block a user