Hi all
Sorry for the length of the post. I don't have code here and since it's more of a conceptual problem I don't think it's needed.
After some months of hardwork a friend pointed out - following a problem I detected - that I don't really have a game loop. After understanding how I could implement a state-machine (sp?) to my objects, I have to undertake some serious recoding in major parts of my code.
Although very frustrated, I'll undertake this task and redesign classes, objects and the game loop. But I need your help and advice with some questions.
Any time something happened, my main loop called the apropriate functions or methods in which the objects were animated in some way. Since I had separate functions, I had total control over how the animation was running (using dbSetObjectFrame), but I could only animate a set of objects and have the rest in a idle state.
What I want to implement is a state-machine where my objects have a flag (e.g.: int state) and depending on the flag they will be running the proper animation. My doubt is, how will have control on how the animations are running? I took a look at the forums, examples and the CHM file. I can animate with dbPlayObject, but how can I control the state after starting the animation and revert it to the desire state after it completed? As an example I'll use a flower since it's the main object in the game:
State 1 - The flower waves in the wind
If a flower is clicked it gets State 2
State 2 - The flower closes
State 3 - The flower changes texture
State 4 - The flower opens
I have all these 4 states working with dbSetObjectFrame in separate functions
outside the game loop. How do I know an animation ended and the state should change? I'm really puzzled.
Second part of the problem. I want to be able to control animation speeds. Will dbSetObjectInterpolation or dbSetObjectSpeed do the trick?
Thank you for your time and answers and sorry for the length of this.
The only lazy people that can complete games are genius. You don't look like a genius, so you better stop being lazy.
Support your local Riker 9 Chapter.