How do I set array(x) equal to an selected image

0 favourites
From the Asset Store
The game will give you a dog that appeared and you must say if he appeared more, less or equal.
  • How do I make, an element of array, ex: array(x) equal to an selected image.

    It's for my final project and I really stressfull, please help me solve my problem

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't. You can track using UIDs though, which can be stored in an array. Can you be clearer about what you want please ?

  • I have an array which is a file.txt, then I copile it with ajax. My array contents with question that I used for my trivia game. So when the question appear then player can clicked the answer, when the answer is an random image. the problem is I can't define my array so that the element can equal to an image

  • Do you want to see my file.capx ?

  • Hi Friskas

    You can store image *name* in the text file or array, and then use it e.g. to load the image from URL. You cannot store anything else than a string or a number in an array. As paulscottrobson suggested, the number can be used to refer to another object UID. But in your case this seems overcomplicated.

    If you have a set of pre-defined images, it might be easier to store them as separate animations in a single sprite, label the animations with image names, and then choose one of the images from the list. You could use the "choose" expression e.g. Sprite.SetAnimation(choose("image1","image2","image3")

    Alternatively, you can store images as separate frames of a single animation, and then show a random one with Sprite.SetFrame(int(random(Number-of-Frames))

  • Wow thank you so much for all of your answer, I will try it !

    So, I have question again if I have an quiz game, example :

    Who is the first presiden of Indonesia Republic ?

    A. Habibie

    B. Soekarno

    C. Jokowi

    I used a file text as an array for my question. And an image for my answer, please tell me how do I make it ?!

  • Hi CJK I seems didn't really understand your coding I'm a beginner, can you explain it more easier so I can undarstand ?

  • Hy again CJK

    When I read it again I seems understands, so I do have a set of pre-defined images, but I have 200 images, if I store it one by one in animation of a single spirite, oh God it's really will become a pain in the ass,

    I need more easier process.

    So by your definition, I can set, my question as text file and an answer as an image. Example :

    A question(text file =>array) the answer is X(image)

  • Hi Friskas,

    I'm afraid I do not understand you setup. What do you need the images for? In the item:

    1: Who is the first presiden of Indonesia Republic ?

    2: A. Habibie

    3: B. Soekarno

    4: C. Jokowi

    line 1 is question, but lines 2,3,4 are answers. In my understanding, a quiz of this type would have each of the lines 2, 3, 4 as separate buttons with text labels, that are clickable.

    What are images for in this setup? Are they big (photos) or small (icons)? Please tell me what you are trying to achieve in your project, maybe then I'll be able to help.

  • hi CJK

    What I want in my project is that I can make the answer of the question with an image, its just small image. So the player can choose the answer by clicking the image which is represent the answer.

    Example is, the photo of Habibie, or the photo of Soekarno.

    I think it's gonna more entertaining if the player knew their picture.

  • something like this example.capx ?

  • WOOOOOW

  • hey korbaach you're my HERO, thank you

    If I have question again can I ask you ?

    please

  • korbaach

    hey, I have already make my project just like you do, but when I add a new question and answer. The new QA doesn't want to appear. It's just show 3 QA.

    What should I do ?

  • replace

    also check simpleQuizGame.capx

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