Match picture to name

  • Hi

    I'm trying to make a simple quiz game.

    It writes the name of a flower, and you have to click the right picture between 30 different ones.

    I can make it work, but each flower-picture gets a really long click-event, which I have to copy and change variables to all 30 pictures.

    My code is ugly, so I just ask - what would be the simplest way to do this?

    (I put picture UIDs and names in 2 arrays, donno if that helps).

    I've made a few other games, but have I already met Construct 2's limit?

  • Have one flower object with a different animation for each type of flower. Then just compare the animation name of the clicked on flower with the correct name.

  • Uhh.. nice idea.. Thanx a lot

    I guess that might be how card-games are made too.. :-)

    Anyway, that seems to work if I only have the one FlowerObject on my layout.. But if I have two copies of it, then it counts as both right AND wrong, as the animation number in one instance is correct and in the other is false..

  • engberg: for cards you can find some implementation in this tutorial.

    As for ramones example here is some implementation.

    So no, you definitely haven't hit a C2's limit yet ^^

  • Kyatric>> I'd just love to take a loot at your .capx, but is says that your version is newer than mine r99 and r95 - so I can't open it..

    I've put my version up here

    (and the limit-comment was merely a provocation <img src="smileys/smiley2.gif" border="0" align="middle"> to get help - and it worked!)

  • If you have 7zip, download Kya's project and right click it and use 7-zip to "open archive".

    Then, rightclick the caproj file and select Edit.

    See where it says:

    "<saved-with-version>9900</saved-with-version>" ?

    Change 9900 to 9500.

  • LaDestitute>> Now that was a handy trick! :-)

    So I see that I have to create animations with a name for each flower.. Bummer for lots of flowers..

    But I guess I'll try this route..

  • engberg

    Be careful with the trick LaDestitute showed you! If the r99 version had used any features that were not in r95, you could break your project. Don't use this trick if you have anything to lose.

    r99 is a beta release, you can download it from the releases page, check the link on the bottom of the front page to download. (or the link in my signature)

  • Alright.. Thanx.

    Bonus info: I actually just bought the full version in the belief that I would get the r99-version that way round, before LaDestitute gave the tip :-)

  • So..

    I don't get what the blank sub-event does in the example from Kyatric

    It works, but I don't get why the blank events are necessary..

    I'm funny that way :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Blank events mean there are no conditions. And with no conditions the event will run every tick. There's a condition called "Every tick", but it's actually just a placeholder. It's the same as having a blank event.

    Edit: Although buying the license was kind of a mistake, I don't think you will regret it <img src="smileys/smiley1.gif" border="0" align="middle" />

  • What Nimtrix said is right.

    Also as how events work, having a blank sub-event will make sure the actions execute execute any time the top level event executes.

    Download the capx again, I reorganised it in a more proper way and I commented it.

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