- 1. Getting Started with OdyC
- 2. Naming Your Game
- 3. The Hero
- 4. How to Draw?
- 5. The Map
- 6. Dialogues
- 7. Sound in the Game
- 8. Advanced Template Parameters
- 9. Camera Control
- 10. Integrating Events
- 11. Event Target Manipulation
- 12. Dynamic Hero Modification
- 13. Modifying a Cell
- 14. Global Model Modification
- 15. Orchestration of Dialogues, Sounds, and Endings
- 16. Dynamically Loading Maps
A sprite is represented as a string of characters, with each line corresponding to a row of pixels. Here’s an example of a sprite:
Each digit is interpreted as a color (0: black, 1: white…), while spaces, tabs, and empty lines are ignored. Other characters represent transparent pixels.
In the example, the character .
is used to mark empty spaces, but it could just as well be an underscore _
.
Warning
In JavaScript, to create a multi-line string, we use the backtick character: `
- On Windows: AltGr + 7 then Space
- On Mac: £ then Space
Try to design a sprite for the player.
Tip
If need be, you can draw inspiration from this collection of sprites
Loading editor...
createGame({ player: { sprite: 5, position: [4, 4] }, })