Skip to content

Instantly share code, notes, and snippets.

@Omnipresent
Last active December 16, 2015 10:09
Show Gist options
  • Save Omnipresent/5417888 to your computer and use it in GitHub Desktop.
Save Omnipresent/5417888 to your computer and use it in GitHub Desktop.
@body = @world.new_body position: [225, 35] do
polygon_fixure box: [26, 26],
friction: 0.3,
density: 1.0
end
@player = PhysicsSprite.new file_name: 'player.png', body: @body, type: KKinematicBodyType
on_touches_ended do |touches, event|
end_touch = touches.any_object
end_touch_location = end_touch.location
puts @hero_gorilla.body.methods.grep /linear/ # no methods found for changing velocity
#how to move a KKinematicBodyType?
end
@Omnipresent
Copy link
Author

@player is of type KKinematicBodyType because I wanted something that is not affected by gravity but still can be moved.

The player would stay at the bottom of the screen and move horizontally relative to user interaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment