Small error in CharacterBody in collision with crates #1

Open
opened 2026-04-21 01:33:52 +00:00 by OddlyTimbot · 0 comments

Hi Cormac,
I have found a small error in your Player. It is mostly the indentation. Your code reads like this:

for i in get_slide_collision_count():
		var c = get_slide_collision(i)
		if c.get_collider() is RigidBody2D
		#deliver the impact
		c.get_collider().apply-central-impulse(-c.get_normal() * 100)

You can make a small change, and it will work:

for i in get_slide_collision_count():
		var c = get_slide_collision(i)
		if c.get_collider() is RigidBody2D:
		    #deliver the impact
		    c.get_collider().apply-central-impulse(-c.get_normal() * 100)
Hi Cormac, I have found a small error in your Player. It is mostly the indentation. Your code reads like this: ``` for i in get_slide_collision_count(): var c = get_slide_collision(i) if c.get_collider() is RigidBody2D #deliver the impact c.get_collider().apply-central-impulse(-c.get_normal() * 100) ``` You can make a small change, and it will work: ``` for i in get_slide_collision_count(): var c = get_slide_collision(i) if c.get_collider() is RigidBody2D: #deliver the impact c.get_collider().apply-central-impulse(-c.get_normal() * 100) ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: CormacRatledge/aprilGame#1
No description provided.