Skip to content

Instantly share code, notes, and snippets.

@ArendPeter
Created February 5, 2021 16:43
Show Gist options
  • Save ArendPeter/b822bbd4723a2c9e2c86f15a160634ab to your computer and use it in GitHub Desktop.
Save ArendPeter/b822bbd4723a2c9e2c86f15a160634ab to your computer and use it in GitHub Desktop.
CameraFollowPlayer.gml
// camera follow player
var cam_x = oPlayer.x - camW()/2
var cam_y = oPlayer.y - 150
cam_x = clamp(cam_x, 0, room_width-camW())
cam_y = clamp(cam_y, 0, room_height-camH())
camPos(cam_x, cam_y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment