resetting changes

This commit is contained in:
OddlyTimbot 2024-07-15 17:35:45 -04:00
parent 19309ffefa
commit 1c1e1c4234

View File

@ -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()