GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Change image animation while flying around with touch controls

Rogue AnvilRogue Anvil Posts: 30Member, PRO

Am trying to get a little space shooter running. I'd like to change the animations rolling sideways when moving the finger left and right on the screen. Right now I am just moving the spaceship sprite around using constrain x and y:

I have a notion that one could simply try a rule saying something like if touch 1 x is > 1 (or < -1 if right) do changeimage, but it is not working... any ideas?

Comments

  • tatiangtatiang Posts: 11,457Member, Sous Chef, PRO, Senior Sous-Chef
    edited October 8

    There are probably better ways to do this but here's what I came up with. The self.previousX attribute is type real. I start with an image of a rocket facing up. FYI, it's a Mac file but you should be able to open it on a PC. In case you can't, here are the rules that I added to the constrain behaviors you had:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Rogue AnvilRogue Anvil Posts: 30Member, PRO

    Thanks, this works very well! ...am using animation instead of rotation, but your thinking solved my problem. Thank you :)

  • CasualEvolutionCasualEvolution Posts: 369Member, PRO

    Hi @Rogue Anvil you can use the "Motion Linear Velocity" sign, and flip the image according to this :)

  • tatiangtatiang Posts: 11,457Member, Sous Chef, PRO, Senior Sous-Chef

    @CasualEvolution said:
    Hi @Rogue Anvil you can use the "Motion Linear Velocity" sign, and flip the image according to this :)

    Correct me if I'm wrong but a constrained actor has no velocity.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CasualEvolutionCasualEvolution Posts: 369Member, PRO

    @tatiang said:

    @CasualEvolution said:
    Hi @Rogue Anvil you can use the "Motion Linear Velocity" sign, and flip the image according to this :)

    Correct me if I'm wrong but a constrained actor has no velocity.

    Ups!, I not have idea if works with a constrained actor, he should check that!

Sign In or Register to comment.