[maybe reopened]How do I - single Sprite 4x, multiple states

0 favourites
  • 8 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hi community!

    I think I can you explain it the best when I "convert" my needs into a garden. First off a sketch from my situation (ignore everything drawn in brown at first):

    (you may have to view full image, its a bit bigger)

    You got 4 flowerpots. Its the sprite "sprite_flowers" [green things in image=the sprite // the number beside each sprite represents its animation (which ll contain frames, but thats not important for now]. Those 4 pots are placed at a fixed position.

    In this example we have 3 different seeds. Everyone of them takes another time to grow. Flowerpot #1is empty, #2, #3 and #4 are not.

    60 seconds after you tapped the seed and planted it into pot #2, the flower will be full grown.

    #3 will be set at animation 3 after 40 seconds and after another 80s it will be set to 4.

    Same with pot #4, except that it contains 3 states untill it is grown.

    What I need to know:

    The "selection" what goes where is asked In a:

    {Touch > on touched sprite_flowers
     { sprite_flowers > is animation "empty" playing
     { sprite_flowers set animation to state1 }}}[/code:3d2wmo7a]
    This is stored in a group which is activated after selecting the flower you want to grow and deselected after successful placing.
    
    What do I have to do to start a timer which is started when the touch "on empty pot" is done (I wanted to make an array containing informations about the flowers, especially the "growtime") pointing at the sprite I selected? I messed arround in hoping with "is touched" element to store information about what is pressed to give it a "unique" ID or something for letting the timer point at it, but it doesnt even worked a little as wished.
    
    Regards,
    Proxymity
    
    Edit: I thought about making 4 different sprites, all containing the same animations but It ll be a bit easyer to manage the state and things, but I dont know if adding them to a container could be reduce the sourcex4 (with 4 sprites) to a single one. Inheritance is possible with families but is it also possible to really reduce the sourcecode to a "single" function/event/group making it valid for all 4 sprites?
  • Rexrainbow some some really useful timer plugins

    check out

    http://c2rexplugins.weebly.com/rex_timer.html

    and

    http://c2rexplugins.weebly.com/rex_duration.html

  • Rexrainbow some some really useful timer plugins

    check out

    http://c2rexplugins.weebly.com/rex_timer.html

    and

    http://c2rexplugins.weebly.com/rex_duration.html

    Now I regret not spending time to study most of the plugins.. thanks for this information, that will save me a lot of time!

    Regards,

    Proxymity

  • ............

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ............

    This covers everything I wanted to know, thanks for that! ..I think Im still thinking a bit too "complex" or "dispositioned" for C2 :s

    Regards,

    Proxymity

  • No Programming Required!

    You can now make advanced games without writing a line of code. Construct 2 does the hard work so you don't have to.

    Our highly intuitive event system makes putting your games together quick and easy.

  • No Programming Required!

    You can now make advanced games without writing a line of code. Construct 2 does the hard work so you don't have to.

    Our highly intuitive event system makes putting your games together quick and easy.

    Sounds a bit stupid, but I encountered a few problems (especially) when I first tryed Construct2 becuase Im thinking to difficult and not getting a solution because of that.. the last time I "really programmed/learned it" was about 10 years ago with C, learned it because the lack of games for OSX (and 9, days back) and so I wanted to make my own ones... If Ild had C2 back then... whew...

    But yes, C2 is far the best way to make things done Ive found in a whole while.

    Thanks again,

    Proxymity

  • ............

    One another question: does switching the layout kills the "wait" action? Is there a "workarround" (preferable without saving current time to variables or other stuff without using plugins, if not needed)? Havent found anything here https://www.scirra.com/tutorials/56/how ... ion?page=2 :s

    Regards,

    Proxymity

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