Help with Instance variables and on-touch

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • For the record I have figured out how to do this for the Last animation in the series by using an event where the Sprite has a compare frame of 7 (the number of frames in the animation) followed by a sprite stop animation action but I can seem to figure out how to do it one the 1st animation of the sprite.

  • Something else I am noticing is that once I reach the end of the sequence (the last animation: "animation3) clicks forward get recorded...even though there is no animation to go to next (or after my latest event addition the animation stops)the click is retained in the "Add 1 touches" action associated with the "Touches" instance variable...and the back arrow must be click an equal number of times for the previous animation to even start running in reverse. Ideally, for my purposes the "Add 1 touches" would have a condition that prohibits the recollection of touches that would exceed the total number of animations associated with the sprite object. That way...if the player is on the last frame of the last animation in the series not only does it halt the animation from playing again it no longer records the touches in the "Add 1 touches" action so the number of touches on the forward sprite object from that point need not be repeated an equal number of times on the reverse sprite object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I updated the link I posted earlier, there is now simple comparison to check that touches variable stays within amount of levels in the game. Hope this helps. :)

  • Very cool...I had to make one slight adjustment to the global variable (from 3 to 4) as when it was set to 3 it wouldn't actually play animation3 prior to halting the forward animations. If I am understanding this correctly...if I were to add animations to the sprite object I would simply increase the global variable a corresponding number of times.

    Does that sound about right?

  • Very cool...I had to make one slight adjustment to the global variable (from 3 to 4) as when it was set to 3 it wouldn't actually play animation3 prior to halting the forward animations. If I am understanding this correctly...if I were to add animations to the sprite object I would simply increase the global variable a corresponding number of times.

    Does that sound about right?

    That is correct. Sent you pm by the way :)

  • It seems I lack the Rep to respond to your PM. :( However, you mentioned that you located me via external means. Reach out to me using that method and we can discuss options for when you have more time on your hands. Also if you do a facebook search for "E2 Game Studios" you can see more about our current project. I do environmental Art, GUI, models and textures etc. Not much on character art though. I have to contract that out along with Music.

  • Ok since we are tearing though my programming tasks the next thing I am trying to do is to establish a method that would allow a 4th sprite object to launch a related layout depending upon which animation the original LevSel sprite object is currently on. In our example file imagine I had a a button at the bottom of the layout and that if a user is currently on "animation2" of the levSel sprite when they click on that button then a layout dedicated to "animation2" is launched. Likewise...if "Animation1" or "Animation3" has just played and they click the button they would be directed to a layout for "animation1" or "animation3" (respectively).

    It would seem to me that since we have successfully tied the number of touches to the "Level" global variable then we could use the current number of touches (the result of whatever positive or negative numbers are generated through Forward or Reverse clicks) to a given sum and use that number as a method for defining which layout to load.

    For example: If the player clicks forward button twice and the reverse once they would find themselves at the start frame of "animation2"...or from a value standpoint that would be +1 +1 -1 in the touches variable which would result in a +1 total number of touches (1+1-1=1). Maybe I am thinking about this all wrong but it seems that would allow me to essentially assign each animation a static touches value and that I could use that to direct a player to a specific layout. Am I heading in the right direction with this?

  • It would seem to me that since we have successfully tied the number of touches to the "Level" global variable then we could use the current number of touches (the result of whatever positive or negative numbers are generated through Forward or Reverse clicks) to a given sum and use that number as a method for defining which layout to load.

    For example: If the player clicks forward button twice and the reverse once they would find themselves at the start frame of "animation2"...or from a value standpoint that would be +1 +1 -1 in the touches variable which would result in a +1 total number of touches (1+1-1=1). Maybe I am thinking about this all wrong but it seems that would allow me to essentially assign each animation a static touches value and that I could use that to direct a player to a specific layout. Am I heading in the right direction with this?

    That would be correct way to think it, the touches variable represents the selected animation, which represents certain level. So you could add 'launch' button, or perhaps click on sprite event, that would start a certain layout depending on the touches variable.

  • lol...now only if I can figure out how to do that!

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