1
\$\begingroup\$

I'm working on a roguelike using libtcod.

So far everything works well with the turn-based functions. Essentially, when a player takes a turn, it triggers everything to advance.

What if I have an item, such as a torch, and I want to animate that cell? Whether or not the player has taken a turn, purely for aesthetics, I'd like this torch's cell to rotate between some various colors.

How would you incorporate animation like this?

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

I wouldn't do the turn-based gameplay in a separate loop. Instead, just have the one main game loop like any other game, and that loop checks if it's time to advance a turn yet.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks! In libtcod could I accomplish this by replacing console_wait_for_keypress() with console_check_for_keypress()? \$\endgroup\$
    – Vecta
    Commented Mar 4, 2015 at 16:39
  • \$\begingroup\$ I'm not familiar with libtcod specifically so I'm not sure. That said, what you describe sounds similar to how I would do it, which would be something like a boolean advance_turn_now that gets turned on by user input and turned off once the turn actually advances. \$\endgroup\$
    – jhocking
    Commented Mar 4, 2015 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .