Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
229 views

Solution for efficient time-keeping in Javascript games?

I'm developing a real-time browser roguelike using an ECS and currently I'm unsure of how to handle time. As of right now, whenever I need the current time, I just call ...
Ryan Peschel's user avatar
0 votes
1 answer
223 views

Timers: check in game loop, or run independently?

Specifically talking in the context of JavaScript game development. For example, I can use the language specific timeout mechanism: ...
Adam Arthur's user avatar
0 votes
1 answer
155 views

Time-passed check with Pause functionality

I am working on a game that has a lot of time-passed checks of the following format. These work great, but there is a problem when the game is paused: If paused for any meaningful amount of time, the ...
Ben's user avatar
  • 517
0 votes
1 answer
651 views

Calling function every n second javascript game

I making a game and I want to call a function that runs every random second to spawn something every time. I've seen some posts that said to use the setInterval() ...
NiJuice's user avatar
2 votes
1 answer
6k views

Phaser 3 - How to trigger an event every 1 second?

I have just started learning Phaser 3 and making a simple idle game, where you would gain x resources per second. What is the best/recommended way to do something like this? The two main ways I have ...
lozzajp's user avatar
  • 780
1 vote
1 answer
529 views

How to stop an anmation and a loop in relation to a timer? Phaser javascript

I am not ajavascript or phaser expert, I just got stuck with this problem. I'll try to explain it. In this game; is a 21 second timer in all this: which starts AFTER a beginning 3 second animatiton. ...
DjangPhaser1's user avatar
1 vote
1 answer
246 views

Accounting for drift between ticks

What are some solid techniques to account for the gap between processing time and frame update ticks? In other words, the game/render loop looks like this: Some important points: Tick timings are ...
davidkomer's user avatar
-1 votes
1 answer
1k views

how to make a timer on JavaScript?

I have a JS game similar to snake how can i set a timer for the game where when the game ends it displays game over, shows the score of the player, and has a play again button?
Josiah Stovall's user avatar
0 votes
1 answer
107 views

Invulnerability timer while standing on spikes

I want to decrement the player's health every .7 seconds while the warrior is standing on a spike tile. Every frame, the game calculates what kind of tile the player is walking into. I've tried ...
tagurit's user avatar
  • 105
1 vote
0 answers
970 views

Accuracy timer for html5 gaming (even with inactive tab) how?

I've implemented Timer class for high accuracy timing (for example for update logic/game-loop, sending ping each 15 seconds by WebRTC etc.) setTimeout/setInterval ...
ElSajko's user avatar
  • 113
0 votes
2 answers
3k views

How to kill a fired bullet sprite after certain amount of time in Phaser?

The bullet should be killed after it was shot from the player, and after a certain amount of time. ...
flufflepuff's user avatar
0 votes
3 answers
4k views

Add a Countdown Timer that increments in JavaScript and resets per level(Resovled)

I am currently developing a Simon says type game using jquery and javascript. I have linked a fully copy of the game on github Github download and unzip to see the game fully https://github.com/...
user avatar
0 votes
1 answer
1k views

How to use setInterval and clearInterval

I have a game that I am making and cannot seem to get the setInterval and clearInterval methods to work. When I debug it in the ...
Geroy290's user avatar
  • 107
3 votes
3 answers
2k views

HTML5 Canvas Game Timer

How to create good timer for HTML5 Canvas games? I am using RequestAnimationFrame( http://paulirish.com/2011/requestanimationframe-for-smart-animating/ ) But object's move too fast. Something like ...
zghyh's user avatar
  • 31
2 votes
2 answers
351 views

For timed levels, how do you determine time steps that are less than 1/(frames per second)?

I have made a simple HTML5 racing game. The laps are timed. I am running the game are 40 frames per second, each frame represents 40 milliseconds. There for my timer will increase in 0.025 ...
Moz's user avatar
  • 141