matachi / Robots-Stole-My-Girlfriend

2 stars 1 forks source link

Explosions sharing the same animation #14

Open Zapray opened 12 years ago

Zapray commented 12 years ago

Every explosion in the game currently has a reference to the same explosion animation, creating some weird undesirable graphical issues. I've been trying to come up with a good way to deal with this but nothing comes to mind.. Seeing as how we would like to keep all the explosions in the 'bullets' List and we don't want to keep the explosions in two lists things gets a little tricky..

Anyone have any ideas?

matachi commented 12 years ago

Can't we add a public method to the Explosion class in the model that returns timeAlive/totalLife. So it would at the beginning return 0.0 and gradually go up to 1.0. I'm not sure if this works, but can't we then in the controller/view (LevelState) pick which frame to show based on this number. Like 0.0-0.2 is frame 1, 0.2-0.4 is frame 2 and so on. But then again, I'm not sure if this works. :P

Grains85 commented 12 years ago

Haven't quit check tho I had hard to see the problem, probably because the shortness of the animation. But it sounds like a new Thread for each animation would be a solution the make each animation unique and run in its own animation method. I can look at it after the camera if it still is an issue by then.

matachi commented 12 years ago

Maybe that could work. However, then we also need to change how the controller/view gets the explosions/bullets. As it is now, the controller/view only asks where bullets are in the level and then it draws sprites on their locations. The controller/view doesn't have a memory of them, it can't differentiate them from one another and it doesn't know which bullets are new ones. To make your method work, I think we need to change so that LevelState can ask Level for only the new bullets/explosions.

And I'm also not sure if we even can make Slick run more than one thread and how that would look on the screen.