Open gsnadav opened 6 years ago
You can do this using the getScores() function which returns a struct with time and timeLimit in it. Here's an example: https://github.com/haxball/haxball-issues/blob/master/headless/examples/gameTime.js
Yes, but would you recommend to call it on every tick? Isn't it a little expensive?
It should be fine, haxball does a lot of things way more expensive than this per tick.
But I guess adding an event for when the time limit is reached wouldn't hurt, so I'm reopening this issue.
@basro I have a doubt about what gsnadava said, about expensiveness, where do i ask you about this? Create a new topic or in this topic, even though this topic is about another thing?
@basro I have an variable in the angle of the uniform, and it changes per kick, making it a rotating uniform, is this expensive? Cause sometimes I feel the ping rises when this is enabled
An event which is called when the time on the clock is elapsed. Currently only onGameTick is available, but onGameTick is called also when the clock is stopped (after scoring a goal and before touching the ball once again) so there's no coherent way to do something on time.