Skip to content

Instantly share code, notes, and snippets.

@chadjemmett
Created May 2, 2016 16:04
Show Gist options
  • Save chadjemmett/28c0f4905f4c28062a90828b3434b71f to your computer and use it in GitHub Desktop.
Save chadjemmett/28c0f4905f4c28062a90828b3434b71f to your computer and use it in GitHub Desktop.
#for ruby gosu
def collision?(barrier_x, barrier_y)
(barrier_x.between?(@x - 50, @x) and barrier_y.between?(@y, @y + 50)) || (barrier_x.between?(@x, @x + 50) && barrier_y.between?(@y - 50, @y)) || (barrier_x.between?(@x - 50, @x) && barrier_y.between?(@y - 50, @y)) || (barrier_x.between?(@x, @x + 50) && barrier_y.between?(@y, @y + 50))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment