Skip to content

Commit

Permalink
Fix collision callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Aug 18, 2024
1 parent 2e8eb32 commit 0d31791
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Component/Collider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,31 +190,31 @@ module ColliderModule
if collision[1] == Top::CollisionDirection
push!(this.currentCollisions, collider)
for eventToCall in this.collisionEvents
eventToCall()
eventToCall(collider)
end
#Begin to overlap, correct position
Component.get_parent(this).transform.position = Math.Vector2f(transform.position.x, transform.position.y + collision[2])
end
if collision[1] == Left::CollisionDirection
push!(this.currentCollisions, collider)
for eventToCall in this.collisionEvents
eventToCall()
eventToCall(collider)
end
#Begin to overlap, correct position
Component.get_parent(this).transform.position = Math.Vector2f(transform.position.x + collision[2], transform.position.y)
end
if collision[1] == Right::CollisionDirection
push!(this.currentCollisions, collider)
for eventToCall in this.collisionEvents
eventToCall()
eventToCall(collider)
end
#Begin to overlap, correct position
Component.get_parent(this).transform.position = Math.Vector2f(transform.position.x - collision[2], transform.position.y)
end
if collision[1] == Bottom::CollisionDirection
push!(this.currentCollisions, collider)
for eventToCall in this.collisionEvents
eventToCall()
eventToCall(collider)
end
#Begin to overlap, correct position
Component.get_parent(this).transform.position = Math.Vector2f(transform.position.x, transform.position.y - collision[2])
Expand All @@ -223,7 +223,7 @@ module ColliderModule
if collision[1] == Below::ColliderLocation
push!(this.currentCollisions, collider)
for eventToCall in this.collisionEvents
eventToCall()
eventToCall(collider)
end
end
end
Expand Down

0 comments on commit 0d31791

Please sign in to comment.