Built a simple 'World 1-1' level to test platforming
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
class_name BoxBoy extends CharacterBody2D
|
||||
|
||||
@onready var _gameplayController = $/root/Scene/GameplayController
|
||||
@onready var _sprite = $AnimatedSprite2D
|
||||
|
||||
const MOVE_FORCE: int = 150
|
||||
@@ -40,7 +39,7 @@ func _physics_process(_delta) -> void:
|
||||
buffer_jumping -= 1
|
||||
|
||||
#process coyote and jump buffers
|
||||
if buffer_grounded > 0 and buffer_jumping > 0 and just_bounced == false:
|
||||
if (buffer_grounded > 0 or %GameplayController.godmode) and buffer_jumping > 0 and just_bounced == false:
|
||||
velocity.y = -JUMP_FORCE
|
||||
buffer_grounded = 0
|
||||
buffer_jumping = 0
|
||||
@@ -66,12 +65,11 @@ func _physics_process(_delta) -> void:
|
||||
#terminal velocity (in all directions)
|
||||
if velocity.y > MAX_FALL_SPEED:
|
||||
velocity.y = MAX_FALL_SPEED
|
||||
if abs(velocity.x) > MAX_MOVE_SPEED:
|
||||
velocity.x = MAX_MOVE_SPEED * sign(velocity.x)
|
||||
if abs(velocity.x) > MAX_MOVE_SPEED * (10 if %GameplayController.godmode else 1):
|
||||
velocity.x = sign(velocity.x) * MAX_MOVE_SPEED * (10 if %GameplayController.godmode else 1)
|
||||
|
||||
if _gameplayController.godmode and velocity.y > 0:
|
||||
if %GameplayController.godmode and velocity.y > 0:
|
||||
velocity.y = 0
|
||||
|
||||
|
||||
#do the thing
|
||||
move_and_slide()
|
||||
|
||||
Reference in New Issue
Block a user