https://github.com/samme/phaser-camera-offset
Offsets the camera view from its follow target
https://github.com/samme/phaser-camera-offset
phaser
Last synced: about 4 hours ago
JSON representation
Offsets the camera view from its follow target
- Host: GitHub
- URL: https://github.com/samme/phaser-camera-offset
- Owner: samme
- Created: 2016-11-10T00:17:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-22T20:46:10.000Z (about 8 years ago)
- Last Synced: 2025-05-05T04:14:16.503Z (about 4 hours ago)
- Topics: phaser
- Language: CoffeeScript
- Homepage: https://samme.github.io/phaser-camera-offset/
- Size: 74.2 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README

[Demo](https://samme.github.io/phaser-camera-offset/)
Use
---```javascript
// Set follow target, lerp, and offset:
// camera.follow(target, style, lerpX, lerpY, offsetX, offsetY)
camera.follow(player, FOLLOW_STYLE, 0.5, 0.5, 64, 64);// Set offset only:
camera.targetOffset.x = 64;
camera.targetOffset.y = 64;camera.targetOffset.set(64);
// Remove offset:
camera.targetOffset.set(0);// Camera#unfollow() will also clear the offset
camera.unfollow();camera.targetOffset.isZero() === true; //-> true
```