Swap Animation Frames on the Fly
I'm just starting out with GS and was wondering if anyone may have an idea of how to solve a problem I have.
I am creating a proof of concept game and have a character walk cycle that is 6 frames long. I created two identicle versions of this animation but with the character having a glow effect from Photoshop in one or nothing. (I.e. Two copies of frame one, Two goes of frame two, etc.) What I would like to do is have the non-glowing animation loop, but swap in the corresponding glow animation at a specified event. My hope is that the flow of the walk cycle is not broken and the character will just appear to glow and go back to normal.
I've tried two methods. The first was to have both animation on top of each other running simultaneously and using an attribute to toggle there alphas one and off. Needless to say, this wasn't kind to the games framerate and never really worked perfectly.
A second method I tried was to simply add a rule into the character saying the event animates glowing else animate normal. This swaps in and out okay, but it always swaps in at the start of the glow animation cycle and not at the corresponding frame.
If anyone has any ideas it would be greatly appreciated. Thanks.
I am creating a proof of concept game and have a character walk cycle that is 6 frames long. I created two identicle versions of this animation but with the character having a glow effect from Photoshop in one or nothing. (I.e. Two copies of frame one, Two goes of frame two, etc.) What I would like to do is have the non-glowing animation loop, but swap in the corresponding glow animation at a specified event. My hope is that the flow of the walk cycle is not broken and the character will just appear to glow and go back to normal.
I've tried two methods. The first was to have both animation on top of each other running simultaneously and using an attribute to toggle there alphas one and off. Needless to say, this wasn't kind to the games framerate and never really worked perfectly.
A second method I tried was to simply add a rule into the character saying the event animates glowing else animate normal. This swaps in and out okay, but it always swaps in at the start of the glow animation cycle and not at the corresponding frame.
If anyone has any ideas it would be greatly appreciated. Thanks.
Comments
create actor "make me glow" and set movable to false. when "make me glow" overlaps or collides with actor "main character" change attribute GLOW to true. otherwise change attribute glow to false.
(on main character:)
When GLOW is false animate normally but make sure you set run to completion to TRUE. Otherwise animate with glow (run to completion)
make sure all "restore actor image" checkboxes are set to false
This way the cycle will run to completion before the new walk starts glowing. You might get a couple of like jumpy frames at the beginning of the glow because it will be trying to animate with and without a glow. Depends on how far you are into the cycle when you cross it.
Another option would be to have a static glow appear behind it? would that work out well?
Let me know how it goes!
- Jake