How do I create dynamic menu using sprite animations?

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hey C3! Since being shown the many options available using sprites and frames, my project has drastically fewer "spawn" or "create" object codes. [thank youoosyrag!!]

    Now that I'm getting more familiar with the frame/animation direction, I thought I would use them for this menu.

    I created a sprite called BuildOption_Sprite with an instance variable of SlotID and copied the sprite so there are 4. Then when the user picks one of the 4 frames, the animations would change based one of the 4 the user picked. This would trigger four 4 frames to appear. At least, that was the idea.

    Instead, when the 4 options are available, the animation only changes for the sprite you picked, not all. Any help coding this would be appreciated.

  • When you use an object on clicked event it narrows the picked instances to 1 so you can't then continue to pick from the other instances in sub events. You can open all instances again by adding 'Pick all Sprite' in the sub event. There are also other ways to do this like using a function and pass through a parameter which sets the frames based on parameter passed.

  • Thank you very much for the direction!! Major help.

    I deleted my previous replies as I re-re-read your reply and think I got it now. How does it measure for code standards?

    However when used in a new block, same error but the coding looks the same except the sprite referenced is different (was Sprite - used on the board, now BuildOption_Sprite - used in the menu). Only the BuildOption_Sprite selected changes, the others disappear.

    Black square where oil derrick should be (SlotID=1, animation=1)

    If the function/parameter will help, I'm all for it but will need a little push in the right direction.

  • You need to use the same object, that build family is a different object and you don't need to use that. Also in terms of structure add Pick all sprite as a sub event then indent again for the other conditions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to use the same object, that build family is a different object and you don't need to use that. Also in terms of structure add Pick all sprite as a sub event then indent again for the other conditions.

    Oh, so I can't use one sprite (Sprite) to set the animations of another (BuildOption_Sprite)?

    Disregard.

  • Got it!!! Thank you for your patience and explanations!

    Changed the circled portion from BuildOption_Sprite to the BuildOption family.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)