How do I create a HINT button for my game?

  • Hello,

    I need some smart guy to help me with something. I have a game based on images and words.

    This is the .CAPX : 1Pic_1Word.capx

    All I want is to create a "Hint" button... When you press this button, a random letter will appear.

    I tried so many times, but I always fail.

    Is there anyone who can help me please?

    Thank you!

  • I don't see a hint button in your capx?

  • [quote:1ogqy679]All I want is to create a "Hint" button...

    I want to create that button.. Is that possible?

  • Yes.. should be entirely possible..

    You know what the answer should be so, creating actions to put one of the letters on the right spot shouldn't be that hard..

    Should consist of something like picking a random instance in the answer creating the right letter at that spot and picking an instance of the letters at the bottom and destroy it..

  • It's not so easy.. if it gives you let's say.. second letter... when you add the first letter... the next one should go automatically to the 3rd place... do you understand what I'm saying?

    Easy to say.. hard to apply :(

    I think at this for like 2 days. :|

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • http://www.blackhornettechnologies.com/ ... d_BHT.capx

    I've made a few changes to the game play.

    1) I added a global for the TimerPeriod multiplier. I've set it to 2 for the moment, to give time to debug. Set it to 0.5 to match what you had before.

    2) Two new instance variables on Letter_Holders: AnswerLetter and Done. AnswerLetter is set the the expected letter in that position. Done is when that position has been filled.

    3) Hint button added. When pressed, it picks the visible Letter_Holders, then the ones where Done=0, then picks a random one of those. Configures the necessary values, then picks the the appropriate Keys that match the selected letter and hides that Keys.

    4) BuildPlayerAnswer function is called when any letter is placed, and rebuilds the Player_Answer based on the consecutive Letter_Holder 'Done' flags.

    There's still some cleanup, but this gets you most of the way there.

  • blackhornet, Thank you sir! Really, you make my day!

    There are still 1 problem: You can place random letters because the answer is correct.

    I mean let's say it.s a SHEEP picture. You can write RWIDS and it's correct. You can place letters wherever you want and is still correct.

    Thank you again sir, for helping me!

  • blackhornet, Thank you sir! Really, you make my day!

    There are still 1 problem: You can place random letters because the answer is correct.

    I mean let's say it.s a SHEEP picture. You can write RWIDS and it's correct. You can place letters wherever you want and is still correct.

    Thank you again sir, for helping me!

    Blackhornet has virtually done all this for you.

    Have you tried to understand what he has done and attempted to amend it yourself?

    If you don't start understanding what he's done for you then you will only encounter more problems and always be reliant on others to do the work for you.

    If you try and fail, then fair enough. You can upload your failed attempt and we can then see how to guide you to better understanding, rather than just doing it for you.

    If you have no interest in learning how to use C2 then fair enough. I just like to think people want to learn, but it's not always the case

  • zenox98, It's not that sir! I want to learn, but this example is just to complex for me!

    I tried to understand many times, but I failed. At this moment I was trying to delete some useless objects, just to make the source more 'understandable'.

    This is too complex for my knowledge, but I look forward and I will try to understand.

  • I have The same Problem as you have. I have made a ''Spot the differences'' game, but i cant seem to find a valid solution to the hint button. I mean the answer is there but it's just to complex. Maybe if someone cant find a simpler solution. Oh, and thank you for this solution.

  • Well, that solution is the best. After some cleanup, the .capx looks like this:

    HERE

    I tried to figure out where is that problem.. and I find that if you 'toggle disabled' the "BuildPlayerAnswer" Function, it will fix this.. but the hint button won't work correctly if you disable that function :(

    Edit: Now the answer is FISH.

  • So the problem here is that BuildPlayerAnswer() takes the letters from Letter_holders.AnswerLetter, not from the user, anymore. The simple fix is to also store the user's input to AnswerLetter. Just add that one action to event 29 and it should work. (In the file I sent).

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