Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/YAL-GameMaker/pixel-perfect-smooth-camera
An example of pixel-perfect yet smooth camera for GameMaker Studio 2
https://github.com/YAL-GameMaker/pixel-perfect-smooth-camera
gamemaker
Last synced: 2 months ago
JSON representation
An example of pixel-perfect yet smooth camera for GameMaker Studio 2
- Host: GitHub
- URL: https://github.com/YAL-GameMaker/pixel-perfect-smooth-camera
- Owner: YAL-GameMaker
- Created: 2020-12-10T00:25:09.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-10T01:03:50.000Z (about 4 years ago)
- Last Synced: 2024-08-02T07:12:02.352Z (5 months ago)
- Topics: gamemaker
- Language: Game Maker Language
- Homepage:
- Size: 35.2 KB
- Stars: 35
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-gamemaker - Pixel Perfect Smooth Camera - An example of pixel-perfect yet smooth camera. (Camera / Recommendations)
README
# 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](https://user-images.githubusercontent.com/731492/101706746-77887580-3a92-11eb-9add-2a8d59bc1fb9.gif)
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](https://user-images.githubusercontent.com/731492/101706719-650e3c00-3a92-11eb-996e-db442a774b89.gif)
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](https://user-images.githubusercontent.com/731492/101706727-69d2f000-3a92-11eb-9c4b-10e3f93a061a.gif)
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](https://yal.cc)
* Tileset and background taken from ["Pixel Adventure"](https://opengameart.org/content/pixel-adventure-1) by Pixel Frog
* Inspired by Hyper Light Drifter camera
(which likely uses the "alternate approach" described here)