Animated Shield Overlay

xactoxacto Member Posts: 146
edited November -1 in Working with GS (Mac)
I am working on creating an animated glowing shield. I am trying to figure out the best way to do this. What I do in other programs is what is called Swap Actor. Game Salad does not have this - only Change Image.

The glowing animation are four transparent PNGs. I first tired just to place a Animate behavior into my player. This would work fine IF my graphics were the same size (the glow is larger in order to surround the player)

I then created an Actor called playerShield that would be spawned when the shield was enabled. The code in the playerShield contained the animation sequence with a Constrain Attribute for the X and Y of that of the Player. I was hopping that it would follow my Player exactly when it moved. It does, however it kind of skips; it will show then and stay there while my player moves and then back to the players center position.

I placed them in a timer as well, however this did not help at all. Still skips.

Any ideas on how to make this work better?

Xacto

-----------------------------------------------------------
StarFire
http://gamesalad.com/game/play/8901

Comments

  • ShanestaShanesta Member Posts: 63
    The way you are doing it seems like the correct way to me. I have a similar situation, and they seem to track correctly for me. When you say it is skips, is this in GameSalad preview, or on your device, if it's on a device, what device is it?

    As long as they don't animate independently, you could just make your graphics the same size.
  • xactoxacto Member Posts: 146
    Here is my code for playerShield:
    Animation : 4 images at 30fps, looped, restored actor image when done
    Constrain Atribute: self.Position.x TO game.PlayerX
    Constrain Atribute: self.Position.y TO game.PlayerY

    Again, I spawn playerShield on top of my Player.
    It follows, however it lags like 1 second behind my player.
    My graphics are NOT the same, because I need the SHIELD to have a larger hit radius.
  • xactoxacto Member Posts: 146
    Doh! I fixed it.... looks like I have old code (before Constrain Behavior was introduce) I was only updating my X/Y every .5 seconds in my Player! So I just converted my Change Attributes to Constrain. Now it works.

    I am a dork.
  • quantumsheepquantumsheep Member Posts: 8,188
    You so are not! :)

    I have a shield on a ship in one of my games... but the ship doesn't move so i didn't have quite the same problem...

    Don't ask why it doesn't move. It's a secret ;)

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.