How do I control sprite animation with a variable?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello.

    I have a variable which loops thru an array and produces random array values which I want to use to control a Sprite animation.

    It does not change the animation and even tho the names of the animation are correctly written.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Consider posting your project for us to investigate.

  • Thanks Kyatric.

    Here is the dropbox link.

    dropbox.com/s/x5ny5s6qebnupnb/LuciaSwipe1.capx

    Don't worry about the unused variables or disabled block codes. I am concerned with the random2() function which is called whenever there is a swipe. It does not swap the item animation as i want.

    Also, I noticed that when I swipe, the debugging text2 displays sometimes that it has been triggered twice. I want that when you swipe, it displays a random animation index and deletes it so that it does not come up again. But it instead with some long swipes (or so), it is triggered twice to display and delete 2 or more animation indexes. How can I stop this undesired action.

  • It seems somehow, the "drinks" names in your folder contain some linejump character, which causes the string name of the animation to be different from the name contained within the array.

    Debuggin it by displaying the name found in the array using the alert action of the browser object clearly shows a line jump where there shouldn't be one.

    Then, your swipe also acts on every tick of execution (so 60 times in a second).

    The content of your array is deleted and soon, there isn't any animation name to pick from within the array.

    Those are two things to look into.

    Also consider explaining clearly what you are trying to do, what is the user's supposed input, and what it is supposed to do ?

  • The linejump character seems invisible to the C2 debugger and I don't know the alert way of debugging. Is there a way around this problem that you can suggest?

    Also if there's some tutorial to reach the browser alert style debugging, I'll be glad to learn.

    I'll keep trying to adjust the swipe action.

    Thanks Kyatric for your help this far.

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