Skip to main content
Inspiring
June 5, 2015
Answered

Advanced Actions for Matchstick Puzzle (CP8)

  • June 5, 2015
  • 1 reply
  • 4644 views

Hi,

I’m creating a matchstick puzzle where you click to remove matches (images of matches).

The order is not important.

When user clicks matchstick image – the image is hidden and an outline of the image is displayed.

If user clicks the outline the matchstick image is displayed.

I have a counter “Matches removed” that displays the number of matchstick images that have been removed.

And a variable “Matchstick_visible” that indicates if the matchstick image is visible or not.

There is a “Submit” button onscreen to validate the puzzle.

Everything works fine but now I want to only allow user to remove a certain number of matches e.g. 4.

When the user tries to remove a 5th match a message will pop up telling them they have to replace a match before they can remove another match.

I don’t know how to add this functionality to the AA below.

Captivate 8.0.1.242, Non-Responsive, No scoring, No LMS, Windows.

AA for each match:

Decision 1 - Visible:

IF “Matchstick_visible” = 1

    Hide matchstick image

    Show matchstick outline image

    Increment “matches removed” counter by 1

Decision 2 - Invisible:

IF Matchstick_visible = 0

    Show matchstick image

    Hide matchstick outline image

    Decrement “matches removed” counter by 1

Decision 3 - Toggle:

IF 1 = 1

  Toggle Matchstick_visible

Regards

Donal.

This topic has been closed for replies.
Correct answer Lilybiri

Hi Lieve, Yes i had planned to use a seperate variable for each match, just wanted help with the AA logic. My AA is complicated because i wanted the user to be able to replace a match even when six matches are removed, and not just display a message after 6 matches were removed. I look forward to reading your solution and learning from it. Re: your last comment - I don't have much AA experience and am totally new to shared actions. Thanks Donal.


I allow to manually reset a matchstick one by one, or to reset everything. And if the user cheats and removes a 7th matchstick, everything will be reset automatically.

Creating such a game is not that hard (for me), but having to write out all the explanations takes a lot more time.

It is published, you can have a look at: Matchstick Game - shared actions - Captivate blog

1 reply

Lilybiri
Legend
June 5, 2015

Hello,

Would like to help, but I don't know that game. Could you post some screenshots to explain?

As far as I understand it now, I would combine the first two decisions in one decision, since they are just the opposite of each other. Moreover I suspect that the toggle command which you put at this moment in a separate mimicked standard action (your third decision) can be included in that first decision. The second decision could then check the value of 'matches_removed' variable and show the message. But I don't know what has to happen more when already 4 matches have been removed?

Moreover I would recommend using shared actions, since you use this action over and over again. Which event do you use to trigger the action: click box over both images, or shape buttons with the images?

donalallAuthor
Inspiring
June 5, 2015

Hi Lieve,

Here is the matchstick puzzle i am trying to do - remove 6 matchsticks to make 10.

I had not thought of showing the message when they removed the 6th matchstick (as per example in image above). That is possible.

But i think a more complete solution would be to show the message when they click the 7th match, because this allows them to replace the 6th match

without getting the message.

FYI: Nothing happens when 6 matches are removed but I want an error message displayed when the user clicks a 7th match.

I could include a new decision at the start

IF “matches removed” = 6  

   Show message

   Show click box (to remove msesage)

I'm just not sure how you deal with the visibility, match count, and toggle?

i.e. don't allow removing a 7th match but do allow the replacing of the 6th match.

I am using a click box over the two images.

I plan to use shared actions once i get my scaled down model working (i.e. just using 3 matches instead of 15 at the moment)

Regards

Donal.

donalallAuthor
Inspiring
June 5, 2015

I have a working and tested solution, with only 3 decisions in one shared action. I think you make it too complicated, why do you never use the ELSE part of a condition? Moreover you need to have a variable for each matchstick or you end up with conflicts. If you toggle your v_Matchstick_visible with one matchstick, it will remain toggled for the next one, how will you solve that?

In my solution:

  1. First decision will switch between image and outline, toggle the visibility var for that matchstick, increment or decrement a counter
  2. Second decision will check if counter reaches 6, in that case will show the Warning message, if not will hide that message
  3. Third decision will check if the correct matches are removed, if yes will hide the Warning message and show the Success message

A reset button is added, so that user can play again.

And I have a Success text appearing when the correct matches are removed.

Will probably post this solution on my blog, you'll be able to check it out. I tested with all matches.

Be careful with combinations AND + OR! They can often give weird results.

Oops, forgot to answer your question. I created the solution with the click box. I mentioned using two shape buttons, because they would simplify your actions, have a feeling that you don't grab totally the concept of conditional actions with multiple decisions. Sorry, I don't want to insult you, it is just the result of looking at what you showed about your projected actions. That splitting up has nothing to do with using shared or advanced actions, just about simplifying.


Hi Lieve, Yes i had planned to use a seperate variable for each match, just wanted help with the AA logic. My AA is complicated because i wanted the user to be able to replace a match even when six matches are removed, and not just display a message after 6 matches were removed. I look forward to reading your solution and learning from it. Re: your last comment - I don't have much AA experience and am totally new to shared actions. Thanks Donal.