tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

When a player goes under some size, they die #606

Closed TheoPannetier closed 1 year ago

TheoPannetier commented 1 year ago

Players' life or health is indicated by their size. When players reach a certain limit size, they "die" temporarily, and can't interact with the game for some time.

{
    // (606) When a player goes under some size, it is out
    game g;
    player p = g.get_player(0);
    const double death_size = 5.0; // choose a value
    // Make the player smaller
    while(get_nth_player_size(g, 0) > death_size)
      {
        assert(!is_out(p));
        p.shrink();
        g.tick();
      }
    assert(is_out(p));
  }