Last active
January 29, 2016 04:28
-
-
Save Razzlegames/03f9b0fb95f97fffa5e3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#***************************************************************** | |
# | |
func _ready(); | |
# .. Do a bunch of other stuff you want before this | |
ground_ray = get_node("ground_ray_cast") | |
ground_ray.add_exception(self) | |
#***************************************************************** | |
# Check if player is on ground by using a ray cast | |
func isOnGround(): | |
if(ground_ray.is_colliding() && | |
!ObjectTypeTests.isCollectable( ground_ray.get_collider()) && | |
!ObjectTypeTests.isEnemy(ground_ray.get_collider())): | |
# print("Jumping_state: "+ str(state)) | |
setState(GROUNDED_STATE) | |
return true | |
# print("Jumping_state: "+ str(state)) | |
return false | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment