Cycle through animation sprites

0 favourites
  • 7 posts
From the Asset Store
Perfect for your zombie game! Animated from motion capture data Left, Right, Top Down!
  • Hi, I'm on day two of trying to work out how to do this and still no closer...

    I want, button A and button B to cycle through a set of images on touch in different directions

    Button A on touch would change the main sprite animation frame to 5 then on touch again 4, then on touch 3 etc and go round in a loop back to 5.

    Button B on touch would count up - touch would show 3 then touch 4 touch 5 etc

    I know how to do this in flash, really easy but I'm a graphics man and stuck on how best to do it using construct

    any help would be appreciated

    cheers

    Dave

  • give the sprite a variable

    • on a touched add 1 to variable
    • on b touched subtract 1 from variable
    • if variable = -1 - set variable to 5
    • if variable = 6 - set variable to 0
    • sprite set animationframe to variable
  • Hi, thanks for the reply, still no idea how to do it.

    I've got it in my mind and its really simple, just don't understand the code and how to add it

    thanks anyway

    Dave

  • Which of the events I described above don't you understand?

  • Dseipp capx

  • Thanks Cipriux that's exactly what I was trying to do, very much appreciated :)

    LittleStain I need to doing some learning I think. Thank you for your help as well :)

    cheers

    Dave

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Dseipp everyone need to learn, especially if is new at something.

    From my point of view it is vital to know this concepts:

    • object, instance (C2 refer to plugin as as object, which is misleading since in programming an object is an instance created from a class, in C2 an instance is created from a plugin/object (not sure about that)).
    • variable (constant, static, local, global)
    • dt (deltatime) this is useful when you make movement to have the same speed no matter the FPS of the game
    • in C2 , the "code" run from top to bottom every frame with exceptions:

        - triggered events run ONCE when the condition is true (they have a arrow on the icon)

        - every x seconds...duh, run every x seconds

    • "self" to be used when pointing to the same object that the action is referring about (Sprite.Angle = self.Angle+10 is better than Sprite.Angle = Sprite.Angle+10) "self" is more portable to other objects and actions. "self" is the same as "this" in programmming
    • and more :)
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)