Interpolation and resetting the scene
Hi all!
I recently started working with GameSalad and making a Super Mario -style platformer game. I'm gradually getting the hang of everything and things are starting to work out.
One thing I can't figure out, however, is how interpolation works with resetting the scene.
In my scene I have a rule that when the player passes a horizontal point in the scene (jumps over a hole in the ground with water), the scene's background color interpolates to a different one. It works nicely, however if the player dies after this and the scene is reset, the interpolation happens again at the beginning of the scene.
This is how I did it:
Gameattribute PlayerX is constrained to the player actor's position X.
When PlayerX is bigger than a certain X point, a boolean scene attribute called "LeftHome" turns true.
When "LeftHome" is true, the background color interpolates.
In the scene's initial state "LeftHome" is of course false (I'm not sure if resetting a scene should reset this?).
I have also tried a rule in my "scene control" actor that "LeftHome" is changed to false, figuring it would change it in the beginning of the scene. Also I made a rule that when the actor dies it changes "LeftHome" to false.
But nothing prevents the color from interpolating again when the scene restarts.
Is there something I don't understand?
Thanks for any help!
Jimmy
Comments
Oh, and of course I also made a rule that changes the color values back to original when "LeftHome" is false!
Ah! I think I figured it out. It's a timing issue.
Since my player actor is spawned to the game in the beginning of the scene, it probably changes the PlayerX value only AFTER the scene checks the value to execute the interpolation. I put a timer to execute the interpolation after a second and that fixed it.
Phew. Thanks anyway!
Glad you figured it out!!!