Created
February 12, 2017 12:30
-
-
Save codetravis/d58e7e89af62ece0b695f61fcfd238db to your computer and use it in GitHub Desktop.
14.6 Update OnObjectCollision to use Contains instead of an equals comparison for ENEMY in the object text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import fantomX | |
Class CustomEngine Extends ftEngine | |
Method OnObjectCollision:Int(obj_one:ftObject, obj_two:ftObject) | |
' Change all of our engine checks to use Contains() instead of = so we can use various enemy types | |
If (obj_one.GetText().Contains("PLAYER") And (obj_two.GetText().Contains("ENEMY") Or obj_two.GetText().Contains("FINALBOSS"))) | |
CharacterCollision(obj_one, obj_two) | |
Else If (obj_two.GetText().Contains("PLAYER") And (obj_one.GetText().Contains("ENEMY") Or obj_one.GetText().Contains("FINALBOSS"))) | |
CharacterCollision(obj_two, obj_one) | |
End | |
If (obj_one.GetText().Contains("PROJECTILE") And | |
(obj_two.GetText().Contains("ENEMY") Or obj_two.GetText().Contains("FINALBOSS") Or obj_two.GetText().Contains("PLAYER"))) | |
ProjectileCollision(obj_one, obj_two) | |
Else If (obj_two.GetText().Contains("PROJECTILE") And | |
(obj_one.GetText().Contains("ENEMY") Or obj_one.GetText().Contains("FINALBOSS") Or obj_one.GetText().Contains("PLAYER"))) | |
ProjectileCollision(obj_two, obj_one) | |
End | |
Return 0 | |
End | |
'..................... | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment