Skip to content

Commit

Permalink
DOCUMENTATION: Add bullet doc
Browse files Browse the repository at this point in the history
MINOR
  • Loading branch information
TTENSHII committed Oct 22, 2023
1 parent ab22723 commit 19af5fc
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [Maths](developer-guide/ecs/maths.md)
- [Logger](developer-guide/ecs/logger.md)
- [Json](developer-guide/ecs/json/json.md)
- [Bullets](developer-guide/ecs/bullets.md)

- [Server](developer-guide/server/README.md)

Expand Down
80 changes: 80 additions & 0 deletions docs/developer-guide/ecs/bullets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## Bullets

We use differents types of bullets in the game. Each type of bullet has its own characteristics.
Bullets are defined in the `bullets.json` file.

### Json structure

We use the following structure to define bullets:

```json
{
"bullets": [
{
"id": "classic",
"velocity": {
"speedX": 120,
"speedY": 0
},
"spritePath": "assets/R-TypeSheet/WaterBullets.png",
"soundPath": "assets/Audio/Sounds/laser.ogg",
},
{
"id": "perforant",
"velocity": {
"speedX": 400,
"speedY": 0
},
"spritePath": "assets/R-TypeSheet/FireBullets.png",
"soundPath": "assets/Audio/Sounds/laser2.ogg",
}
]
}
```

It is composed of an array of bullets. Each bullet has its own id and its own characteristics.

### Characteristics

- `id`: The id of the bullet. It is used to identify the bullet in the game.
- `damage`: The damage of the bullet. It is used to damage the enemies.
- `health`: The health of the bullet. It is used to destroy the bullet when it collides with an enemy.
- `velocity`: The velocity of the bullet. It is used to move the bullet.
- `physics`: The physics of the bullet. It is used to move the bullet.
- `waitTimeBullet`: The wait time of the bullet. It is used to wait before shooting again.
- `collisionRect`: The collision rectangle of the bullet. It is used to detect collisions with enemies.
- `spritePath`: The sprite path of the bullet. It is used to display the bullet.
- `soundPath`: The sound path of the bullet. It is used to play the sound of the bullet.
- `spriteRect`: The sprite rectangle of the bullet. It is used to display the bullet.
- `animRect`: The animation rectangle of the bullet. It is used to display the bullet.


### Physics

Physics is represented by an array of strings. Each string represents a physics. You can put as many physics as you want. So far, we have the following physics:
- `zigzag`: The bullet moves in a zigzag way.
- `boncing`: The bullet bounces on the top and bottom of the screen.


```json
{
"bullets": [
{
"id": "perforant",
"physics": [
"zigzag"
]
}
]
}
```

### Bullet types

For now, we have 4 types of bullets:
- `classic`: The classic bullet.
- `fast`: The fast bullet.
- `bounce`: The bouncing bullet.
- `perforant`: The perforant bullet.

To add a new bullet type, you have to add it in the `missileTypes_e` enum in the `Missile.hpp` file. Then, you have to add it in the `bulletKeyMap` map in the `EventsSystems.cpp` file.

0 comments on commit 19af5fc

Please sign in to comment.