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\$
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\$
  • \$\begingroup\$ Thanks! In libtcod could I accomplish this by replacing console_wait_for_keypress() with console_check_for_keypress()? \$\endgroup\$ – Vecta Mar 4 '15 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 Mar 4 '15 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.