I'm looking for an approximate way to convert between the game "speed" and time. FYI: the game speed can be set via an API, and the values are between 0 and 100, and it is considered a percentage.
I'm trying to create an API called wait(secs) where secs is a float. When the game is running at 100% speed a call to wait(secs) would cause the Actor to do nothing for secs seconds. E.g., a call to wait(1.5) would cause the actor to do nothing for 1.5 seconds (approximately). It does not have to be super accurate -- just "close enough".
I looked at the source code of greenfoot and it seems like there is a correlation between 30000 nanoseconds and one percent of the speed of the game. The code is pretty complicated so I'm not sure that is correct.
Does anyone have any ideas on how I could implement this api?
Thanks.
Vic

