Categories with random images

  • 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:

    dropbox.com/s/9lx4kj3bagr9r ... .capx?dl=0

  • 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.

  • sorry

    dropbox.com/s/9lx4kj3bagr9riy/help.capx?dl=0

  • 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?

  • 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.

  • 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.

  • 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!

  • So, the 3 buttons have no meaning ? It should be 1 button ?

  • 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.

  • Okay (getting there), so when animals and colours are selected only 1 animal or colour should show.

  • Okay (getting there), so when animals and colours are selected only 1 animal or colour should show.

    Exactly. One image at time, randomly between the categories selected

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No prob. Sorry for not understanding the question.

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

  • No prob. Sorry for not understanding the question.

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

    OMG 99instances2Go that is it! Thank you so much! Helped a lot! Just thank you!

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