How do I randomise the characters and where they pop up?

Get help using Construct 2

Post » Wed Nov 12, 2014 2:03 pm

Hi Guys,

I'm having a bit of trouble with a 'Whack A Mole' style game.

Image


There are 9 windows where i plan to have the characters appear from.

I want to use 15 different characters and for them to randomly appear in different windows. (from below)

Currently i have 9 characters below the windows and they pop up randomly but the same character always pops up below the same window.

Any help would be really appreciated.
B
4
Posts: 17
Reputation: 234

Post » Wed Nov 12, 2014 2:53 pm

I'm only still a beginner but I would suggest to place all the characters in an animation frame, each with its own frame number.
Then you have C2 select a random frame every x seconds, on a button click, on start of layout or whatever.
Like so:
You do not have the required permissions to view the files attached to this post.
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Wed Nov 12, 2014 3:05 pm

Brilliant cheers Rjan,

That has randomised them appearing however when just using 3 different characters some of the same character appears twice coming out of two different windows. How can i adjust this so that a character will only show out of one window at a time ?

Hope this makes sense, if it doesn't i can try and explained better.
B
4
Posts: 17
Reputation: 234

Post » Wed Nov 12, 2014 6:20 pm

Yep, it does make sense, but I'll have to think about this one.
Maybe other forum members have the answer right away?
Image
B
54
S
24
G
12
Posts: 96
Reputation: 10,316

Post » Wed Nov 12, 2014 8:02 pm

That would be great.

I assume it needs an action so that when x is visible then do not repeat that number , but don't know how to apply this in construct
B
4
Posts: 17
Reputation: 234

Post » Wed Nov 12, 2014 10:09 pm

An array would help you with assigning unique animation frames to your sprites. Something like the attached file should work.
You do not have the required permissions to view the files attached to this post.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Thu Nov 13, 2014 10:13 am

Magistross wrote:An array would help you with assigning unique animation frames to your sprites. Something like the attached file should work.



Thanks Magistross, I have had a look at your file and we haven't used arrays. I've attached the capx file of ours (the characters used are just placeholders at the moment) can you take a look and see if we are doing this a silly way, and if using arrays is easier... We want the characters to pop up and not repeat themselves whilst the same character is still visible.


Any other people willing to help would be great... cheers
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Thu Nov 13, 2014 8:27 pm

Bump
B
4
Posts: 17
Reputation: 234

Post » Fri Nov 14, 2014 7:20 pm

Someone must know! Check out the xcap please
B
4
Posts: 17
Reputation: 234

Post » Fri Nov 14, 2014 7:48 pm

I have been facing the same issue before and the only way I found to do it is to use an array. You store all the possible values the random can pick from into an array, and remove a value when it's picked. Then you can reinitilialise the array between rounds or levels so that all values are back into it and can be picked again.
B
11
S
3
G
3
Posts: 206
Reputation: 2,379

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie and 16 guests