- 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
It’s now time to introduce our hero into the game.
To do this, we will use the player
parameter. This parameter is an object that contains two properties: sprite
and position
.
Although we will cover the creation of custom sprites in a later section, for now, we’ll simply change our hero’s color by using an existing sprite.
The default player parameters are as follows:
These parameters position the player at the top left of the screen using the first default sprite. Let’s modify these values to customize the appearance and the initial position of our hero.
To add your hero to the game, specify the sprite you wish to use to represent them and their initial position on the grid.
Coordinates are given in the form of an array [x, y]
, where x
represents the column and y
represents the line on the game grid. For example, [4, 4]
places the hero in the center if your grid is 8x8 in size.
Keyboard shortcuts for adding brackets:
On Mac:
[
: Shift + Option + (]
: Shift + Option + )
On PC:
[
: AltGr + 5]
: AltGr + °
Experiment with different values for sprite
and position
to better understand their impact on the game. This will help you visualize how to position and customize elements in your game.
Loading editor...
createGame({})