azfalot / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Animation cannot be started in Scene constructor #140

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a Sprite and call "animate" in the constructor of a scene.
2. Set the scene in the activity
3. Start the app

What is the expected output?
An animated Sprite

What do you see instead?
Nothing

What version of Rokon are you using?
2.1.0 (trunk)

On which version of Android are you experiencing this?
2.1 (Hero)

Please provide any additional information below.
When "animate" is called "Time.loopTicks" is still 0 because "Time.updateLoop" 
hasn't been called yet, which leads to "animationLastTicks" in the Sprite being 
set to 0. This leads to an infinate (well, almost...) loop in 
DrawableObject.updateAnimation:608

Original issue reported on code.google.com by hakan.su...@gmail.com on 13 Aug 2010 at 10:59

GoogleCodeExporter commented 8 years ago
You shouldn't be doing this in the constructor of Scene, that's why

Put everything in onReady()

Original comment by rtaylor205@gmail.com on 16 Aug 2010 at 1:50

GoogleCodeExporter commented 8 years ago
It really doesn't change anything if I start the animation in the scene's 
constructor or in onReady() since onReady is called from Activity.setScene() 
and I call setScene right after I created the Scene (in onLoadComplete in the 
activity)...
This is only an issue if there are animations in the first scene displayed, 
i.e. before the GameThread is started and it is trivial to write a workaround 
in the scene (e.g. start all animations in the first call to onGameLoop())

Original comment by hakan.su...@gmail.com on 16 Aug 2010 at 3:12