So what exactly is a timer? A timer is a mechanism that allows you to count up, or down, to a certain value and then trigger something once that value is reached. So for example, let’s say you have a character who has been poisoned. Poison damage is generally a damage over time status effect, that deals a small amount of damage every so often. Imagine your game runs at 60 frames per second, and you decided that poison damage should be 1 damage. Your character has 100 hp and your code looks like this.
Read more at developer.amazon.com.
HTML5 Game Developer, Enclave Games indie studio founder, js13kGames competition creator and Gamedev.js Weekly newsletter publisher. Mozilla Tech Speaker, Gamedev.js community firestarter. Organizes meetups / workshops / hackathons in Poland, passionate about new, Open Web technologies, excited about WebXR and PWAs. Likes eating sushi and playing Neuroshima Hex.