diff --git a/week2/startpoint/scripts/CharacterBody2D.gd b/week2/startpoint/scripts/CharacterBody2D.gd index a747263..3f80473 100644 --- a/week2/startpoint/scripts/CharacterBody2D.gd +++ b/week2/startpoint/scripts/CharacterBody2D.gd @@ -1,9 +1,8 @@ extends CharacterBody2D -@export var SPEED = 300.0 -@export var JUMP_VELOCITY = -300.0 -@export var PUSH_FORCE = 200 +const var SPEED = 300.0 +const JUMP_VELOCITY = -300.0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") @@ -25,10 +24,4 @@ func _physics_process(delta): else: velocity.x = move_toward(velocity.x, 0, SPEED) - move_and_slide() - # This represents the player's inertia - # after calling move_and_slide() - for i in get_slide_collision_count(): - var c = get_slide_collision(i) - if c.get_collider() is RigidBody2D: - c.get_collider().apply_central_impulse(-c.get_normal() * PUSH_FORCE) + move_and_slide() \ No newline at end of file