Skip to content

Instantly share code, notes, and snippets.

@Razzlegames
Last active January 29, 2016 04:28
Show Gist options
  • Save Razzlegames/03f9b0fb95f97fffa5e3 to your computer and use it in GitHub Desktop.
Save Razzlegames/03f9b0fb95f97fffa5e3 to your computer and use it in GitHub Desktop.
#*****************************************************************
#
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