Categories with random images

Discussion and feedback on Construct 2

Post » Tue May 31, 2016 2:40 pm

Message: lefigueiredo can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi there. I'm trying to make a game, where random images appear. The forum already helped me with the random, I put an image with diferrent frames, and the program randomly choose an frame.

But I have differents categories, so I did one image per category and put buttons to activate the category. With a variable, I set if the image of the category will be visible or not when touch the button.

When I enable 2 differents categories, the random works, but only appear the image which is above, and the another is hidden behind.

There is a way to make it randomly appear the images and the frames just hitting one button?

What I want is, for exemple:
* I choose the categories animal and colour. When I hit the button, appears randomly animals and colours.


Here is my project:
https://www.dropbox.com/s/9lx4kj3bagr9r ... .capx?dl=0
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Tue May 31, 2016 3:38 pm

lefigueiredo wrote:Here is my project:
https://www.dropbox.com/s/9lx4kj3bagr9r ... .capx?dl=0

Post your link without the https://www part. The forum engine blocks links from new users.
B
129
S
33
G
17
Posts: 1,552
Reputation: 20,515

Post » Tue May 31, 2016 3:46 pm

sorry

dropbox.com/s/9lx4kj3bagr9riy/help.capx?dl=0
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Tue May 31, 2016 6:38 pm

So if I understand you right, you want to select 2 categories and then when you click the button you want the code to randomly select not just from 5 options (from one category) but from 10 (the 2 selected category)? And in the end only display that 1 selected option?
B
129
S
33
G
17
Posts: 1,552
Reputation: 20,515

Post » Tue May 31, 2016 9:46 pm

Yes! I was able to make the Random in each categoty. But when I enable two differents categorias, only one appears.
I don't know how to make an random with the categoty, only with the frames.
In my code, you can see that the Random works, but I can't figure it out how to apply it to the categories too.
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Wed Jun 01, 2016 8:55 am

You'll have to set up a bit more complicated logic for when you click the button. It should check that what categories are enabled at that moment using a local variable and a seperate random generated number it should decide what category it will choose from. Then you can use the currently generated random number to select a frame.
B
129
S
33
G
17
Posts: 1,552
Reputation: 20,515

Post » Wed Jun 01, 2016 11:02 am

B
33
S
18
G
28
Posts: 2,477
Reputation: 20,918

Post » Wed Jun 01, 2016 2:44 pm

99Instances2Go wrote:Is this what you want ?

https://drive.google.com/open?id=0B1SSu ... E9vZTJ0MFk


Almost.. What I want is only one category at time on the screen.

But thank you so much, I'll study your code and try to apply it. I was able to make one:

dropbox.com/s/fsnj559c0416jxh/New%20project.caproj?dl=0

The problem is that when the random choose an category that is not selected, nothing appears, an blank space stays in the screen until the random choose a category selected.

I was kind able to create a "C language" logic for this, but I have no idea how to make it works.

But thank you guys, you and the forum are helping a lot!
B
7
S
2
G
1
Posts: 7
Reputation: 989

Post » Wed Jun 01, 2016 3:36 pm

So, the 3 buttons have no meaning ? It should be 1 button ?
B
33
S
18
G
28
Posts: 2,477
Reputation: 20,918

Post » Wed Jun 01, 2016 3:43 pm

99Instances2Go wrote:So, the 3 buttons have no meaning ? It should be 1 button ?


The three buttons are to select the categories. And another one to make the random between the categories.

The game will help students to memorize names. So, if he wants to study animals and colour together, he will choose the category animal and the category colour (that's why I need a button to each category). So, every time he hits the button "random", a new image will apear, between the categories that he chooses.
B
7
S
2
G
1
Posts: 7
Reputation: 989

Next

Return to Construct 2 General

Who is online

Users browsing this forum: blackhornet, JaredX, megatronx and 1 guest