https://github.com/compufox/trivial-gamekit-sprite
trivial-gamekit module for handling sprites and spritesheets
https://github.com/compufox/trivial-gamekit-sprite
Last synced: over 1 year ago
JSON representation
trivial-gamekit module for handling sprites and spritesheets
- Host: GitHub
- URL: https://github.com/compufox/trivial-gamekit-sprite
- Owner: compufox
- Created: 2021-03-20T02:37:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-29T13:41:43.000Z (over 5 years ago)
- Last Synced: 2025-03-02T04:44:02.518Z (over 1 year ago)
- Language: Common Lisp
- Size: 6.84 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# trivial-gamekit-sprite
### _ava fox_
trivial-gamekit module for sprites
## API
`(make-spritesheet image &rest frames)`
creates and returns a spritesheet based off of IMAGE, with FRAMES
each form in FRAMES should be of the form (IDENTIFIER VEC2-ORIGIN VEC2-SIZE)
please see `example/main.lisp` for an example
---
`(make-sprite spritesheet &key (coordinates gamekit::+origin+) (render t) (rotation 0) animate (frame-length 0) (scale (vec2 1 1)) frames state flip-x flip-y)`
creates and returns a sprite
COORDINATES the location of the sprite
ROTATION the rotation of the sprite (in radians)
SCALE the size of the sprite
FRAMES the sprite's frames from SPRITESHEET
RENDER whether or not to draw the sprite
ANIMATE whether or not the sprite should animate (increments through FRAMES one by one)
FRAME-LENGTH how long each frame should last when animating
FLIP-H if non-nil flips sprite horizontally
FLIP-V if non-nil flips sprite vertically
---
`(draw-sprite sprite)`
draws a SPRITE
---
`(draw-sprites &rest sprites)`
draws SPRITES
---
`(deg->rad degrees)`
converts DEGREES to radians
---
`(rad->deg radians)`
converts RADIANS to degrees
---
accessors exported:
`coordinates` `rotation` `render` `animate`
`spritesheet` `current-frame` `frame-length`
`image` `scale` `state` `flip-h` `flip-v`
## License
MIT