During the collision
callback method, we will set the collision markers and objects, so that we can act on them during the OnObjectUpdate
method.
Select
statement on the first object's collision group.Method OnObjectCollision:Int(obj:ftObject, obj2:ftObject) Select obj.GetColGroup()
Case g.grpWall
g.hitWall2
to True
. We do this by checking the collision group of the second object.If obj2.GetColGroup()=g.grpPlayer2 Then g.hitWall2=True
g.hitWall
to True
.If obj2.GetColGroup()=g.grpPlayer Then g.hitWall=True
Case g.grpCrate
g.hitCrate
with the first object.If obj2.GetColGroup()=g.grpPlayer Then g.hitCrate=obj
g.hitCrate2
with the first object.If obj2.GetColGroup()=g.grpPlayer2 Then g.hitCrate2=obj
Case g.grpTarget
g.onTarget
field.If obj2.GetColGroup()=g.grpCrate And obj2.GetTransitionCount()=0 Then g.onTarget += 1
Select
statement.End Return 0 End
During the collision
callback method, we first checked what kind of first object we have. And depending on that, we have set various collision markers and objects that help to act on them when we want to update the movement of crates and the player machine.