How do I randomize the location of the animations of asprite

0 favourites
  • 5 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hi,

    I am trying to develop a game kind of like candy crush. I was confused on how to spawn the "orbs" in a specific window. I have a sprite with the different colors that the player needs to match up, but I am truly confused on how to randomize the locations of the orbs every time a game is boot up (and the orbs should be in an invisible preset grid).

    Please Help!

    Thanks in advance,

    Sharkmaster24

  • It is a bit vague as a question. Posting your exact project capx can help.

    Anyway here is an abstract answer.

    If you need to set a random value in an array, just use the condition "For each element" of the array object and set array.curX and likely array.curY to int(random(VALUEMIN, VALUE MAX)) where VALUEMIN is the minimal and VALUEMAX the maximum value possible for an orb/frame.

    If this considers recolors of the same orb as frames of the same animation, you only need to display the sprite and set its frame to the value in the array. As the values in the array have been randomized, creating a sprite instance for each column/row will give you a fully randomized grid.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do I post the actual capx file?

    Excuse me for being a noob ;P

  • Never mind, I figured it out. Thanks for your help!

  • You can use a file hosting service like dropbox or google drive to post the URL of your file.

    With low reputation it requires a bit of fiddling to post the URL (post it as text adding spaces or stuff like that).

    You can see this topic (or this page) on how to get a bit more reputation, enough to go past the URL posting restriction.

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