Change hero animations when a powerup attribute is true

Ferry HardestFerry Hardest Barcelona, SpainMember Posts: 6
edited October 2015 in Working with GS (Mac)

Hi everyone!

Which is the best way to change the hero animations to give a different look when a powerup is active?

Now, I have the animations controlled by instructions like:

Actor Receives an event >
Key / touch (to move left-right, etc.) >
Animate

Then I have rules for:
A powerup attribute (boolean) that changes to true when the counter reaches 1000 points.

And what I do after is:

When atribute game.powerup is true >
Spawn Actor "Powerup hero"
(the same hero actor with same controls/animations but with different design)>
Destroy Actor

But with this method, switching from one to another hero is very abrupt, does not match the frame of the animation neither orientation (for example, if it was moving to the left, the hero appears with powerup looking right).

I have seen many tutorials about powerups, but I haven't found info about changing a complete group of animations when a powerup rule is true.

If anyone can help me it would be great ...

Comments

  • IceboxIcebox Member Posts: 1,485

    @Ferry Hardest I would do it this way , if powerup is false do normal animation , if power up is true do the powerup animation , no need to spawn a new actor.

  • SocksSocks London, UK.Member Posts: 12,822

    @Ferry Hardest said:
    . . . . with this method, switching from one to another hero is very abrupt, does not match the frame of the animation . . .

    When atribute game.powerup is true + when animation frame is [specific frame]

    @Ferry Hardest said:
    neither orientation (for example, if it was moving to the left, the hero appears with powerup looking right).

    You've not said how you are controlling the actor's orientation so it's hard to make any suggestions beyond a generic 'turn the actor the right way before changing to the new animation'.

  • Ferry HardestFerry Hardest Barcelona, SpainMember Posts: 6

    @Icebox1910 @Socks many thanks! :)

    @Socks said:
    You've not said how you are controlling the actor's orientation so it's hard to make any suggestions beyond a generic 'turn the actor the right way before changing to the new animation'.

    Left control is:

    Actor receives event > Key left is down >
    Change attribute > self.Graphics.Flip Horizontally > True
    Animate >
    Interpolate > self.Motion.Linear velocity.X to -250

    Otherwise:

    Interpolate > self.Motion.Linear velocity.X to 0

  • IceboxIcebox Member Posts: 1,485

    @Ferry Hardest Is this a platformer game ?

  • SocksSocks London, UK.Member Posts: 12,822

    @Ferry Hardest said:
    Left control is: . . .

    What's the question ?

  • Ferry HardestFerry Hardest Barcelona, SpainMember Posts: 6

    @Icebox1910 said:
    @Ferry Hardest Is this a platformer game ?

    Yes!

    @Socks said:
    What's the question ?

    Sorry, I thought you suggested that I explain the player controls to find out how to avoid the orientation problem when spawn a powerup actor from the hero.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @Ferry Hardest said:
    Sorry, I thought you suggested that I explain the player controls to find out how to avoid the orientation problem when spawn a powerup actor from the hero.

    Yes, but I don't know what you want, you've not said, you've only described a problem, without having described what you want to happen.

    The question I was expecting was some form of 'how do I get my actor to . . . . . . . '

    You've said as one animation changes to another the actor can often be facing the wrong way at the point where it changes to the new animation, is that basically the issue ?

    If so, what would you want to happen to resolve this ?

  • Ferry HardestFerry Hardest Barcelona, SpainMember Posts: 6

    Yes, this is the issue. How to spawn my actor to obtain a fine switch, with correct facing, and animation frames reproduced coordinately between actors (still I have to prove your suggestion about define a specific frame)...

  • Ferry HardestFerry Hardest Barcelona, SpainMember Posts: 6

    @Icebox1910 said:
    @Ferry Hardest I would do it this way , if powerup is false do normal animation , if power up is true do the powerup animation , no need to spawn a new actor.

    @Icebox1910 You're right! :) It works, so for now it is OK for me. Many thanks!!

    Thank you both @Icebox1910 and @Socks to listen and try to understand.

Sign In or Register to comment.