Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Created April 12, 2012 04:52
Show Gist options
  • Save poemdexter/2364677 to your computer and use it in GitHub Desktop.
Save poemdexter/2364677 to your computer and use it in GitHub Desktop.
def button_down(id)
case id
when Gosu::MsLeft
if (0 < mouse_x && mouse_x < 480 && 0 < mouse_y && mouse_y < 480)
@player.reposition(mouse_x, mouse_y)
end
end
def reposition(x, y)
@x = (x/24).floor
@y = (y/24).floor
end
# 24 is the tile size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment