Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
8.3 Modify OnObjectCollision in our custom engine to damage characters instead of destroying them
Import fantomX
Class CustomEngine Extends ftEngine
Method OnObjectCollision:Int(obj_one:ftObject, obj_two:ftObject)
If (obj_one.GetText() = "PLAYER" And obj_two.GetText() = "ENEMY")
' Change the text to be damaged and set it for both the player and the enemy
' this way players and enemies will only get damaged once per update
obj_two.SetText("DAMAGED")
obj_one.SetText("DAMAGED")
obj_two.SetColWith(obj_one.GetColGroup(), False)
Else If (obj_two.GetText() = "PLAYER" And obj_one.GetText() = "ENEMY")
obj_one.SetText("DAMAGED")
obj_two.SetText("DAMAGED")
obj_one.SetColWith(obj_two.GetColGroup(), False)
End
Return 0
End
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment