Swap Animation Frames on the Fly

ellfireellfire Member Posts: 187
edited January 2012 in Working with GS (Mac)
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.

Comments

  • JakeMorJakeMor Member, PRO Posts: 136
    edited January 2012
    try this:
    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


  • ellfireellfire Member Posts: 187
    Thanks. I'll give that a try.
  • JakeMorJakeMor Member, PRO Posts: 136
    you can try a glow raising from the bottom of the feet up with alpha set to 75% or something, it would look good and would be much easier to set up.
  • SAZ_1SAZ_1 Member Posts: 397
    i tried this a while back didn't have much luck, but realised it depends on what you are attempting to do look wise... i think the issue here may be where the animation starts/finishes because you'd have a ton of rules if you wanted the animation to swap out at each exact frame.
Sign In or Register to comment.