How do I randomize the location of the animations of asprite

Get help using Construct 2

Post » Wed Jul 08, 2015 9:14 am

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
B
5
Posts: 27
Reputation: 571

Post » Wed Jul 08, 2015 9:29 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,293
Reputation: 70,769

Post » Wed Jul 08, 2015 9:54 am

How do I post the actual capx file?

Excuse me for being a noob ;P
B
5
Posts: 27
Reputation: 571

Post » Wed Jul 08, 2015 10:21 am

Never mind, I figured it out. Thanks for your help!
B
5
Posts: 27
Reputation: 571

Post » Wed Jul 08, 2015 11:43 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,293
Reputation: 70,769


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests