How do I setup a random card chooser.

Get help using Construct 2

Post » Sat Jul 18, 2015 2:15 pm

Trying to set this up in a tutorial game.

I have this idea for a random card chooser, and I have the basics down in my head (and i hope in C2) I just need someone to look over it. I've done random numbers and a random spawn point but never a random item picker.

When button pressed a random number between 0 and 3 is picked this is then added to a global variable which then chooses the card and then (set frame).

If someone could set up a C2 demo that would be great, thanks.

here is the file: https://www.mediafire.com/?j8vp4vs5vj88649
B
9
S
1
Posts: 39
Reputation: 553

Post » Sat Jul 18, 2015 2:40 pm

random(0,3) can also give the value of 2.34, which you don't want..

in this case I would just use choose(0,1,2,3) but using floor(random(0,4) would also work..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 18, 2015 2:44 pm

Also instead of is touching using on touched would only call the function once..
And ofcourse you could do it without a function and just set the variable to : floor(random(0,4))

You could check the variable by adding a text-object and setting it to: enemyCard
After testing this text-object could always be removed..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 20, 2015 2:27 am

Okay, i got it generating random numbers THANKYOU SO MUCH!
B
9
S
1
Posts: 39
Reputation: 553


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, DarthPapalo666 and 23 guests