Skip to content

An example of pixel-perfect yet smooth camera for GameMaker Studio 2

Notifications You must be signed in to change notification settings

YAL-GameMaker/pixel-perfect-smooth-camera

Repository files navigation

Pixel-perfect smooth camera

When designing traditional pixel-art games (in general and in GameMaker specifically), it is generally desirable to keep your camera pixel-perfect to avoid rotated pixels and reduce various other artifacts:

ppsc-1

This, of course, comes with an unfortunate caveat: it can be very hard to make your camera movement look good - especially if small speeds and/or acceleration/deceleration are involved:

ppsc-2

This is a demonstration of an approach that allows you to escape this problem - by making the camera 1px wider and taller and having it draw to a surface, we are able to then offset this surface to make up for fractions in the camera coordinates:

ppsc-3

An alternate approach involves drawing a half-pixel (at the game's internal resolution) frame at the edges of the screen so that you can wiggle the game's default surface (application_surface) under it without making it apparent to the player.

Credits

  • Example by YellowAfterlife
  • Tileset and background taken from "Pixel Adventure" by Pixel Frog
  • Inspired by Hyper Light Drifter camera
    (which likely uses the "alternate approach" described here)

About

An example of pixel-perfect yet smooth camera for GameMaker Studio 2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published