"Proceed if requirements are fulfilled"

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Noytal
Posts: 9
Joined: Sun Apr 10, 2016 6:10 pm

"Proceed if requirements are fulfilled"

Post by Noytal » Mon Apr 11, 2016 10:47 pm

I am making a puzzle game, and I need to make a "submit" button that checks if the player's solution is correct. Basically, it's a "move two match sticks to make 4 squares the same size" level, and I have a layout of matches that snap to a grid. I need to make a button that will "go to the 'correct answer' screen if the matches are in the correct place" or something along those lines.

How would I go about doing this?

KimD
Posts: 225
Joined: Wed Jul 08, 2015 5:51 am

Re: "Proceed if requirements are fulfilled"

Post by KimD » Tue Apr 12, 2016 12:20 am

It is a little hard to answer your question because there are so many ways to do this. One option would be:

1) Within whatever handler you have that allows the user to move a match - at the end of that handler test whether all of the matches are in the right place
If (/* all the matches are in the right place */) then
put true into usergotitright
Else
put false into usergotitright
End if


2) Then add a submit button to your card, with code along the lines of
end mouseup
If usergotitright=true then
go to card "CorrectAnswer"
else
Answer "Try again Loser"
end if
end mouseup

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: "Proceed if requirements are fulfilled"

Post by dunbarx » Tue Apr 12, 2016 8:45 pm

What Kim said.

Are all the matches moveable? I assume so. Do you have any thoughts about how to determine whether a "match" is properly placed? Especially if they can be oriented vertically or horizontally? Do you use the "grab" command to move? Or the "move" command, perhaps setting the start and end with two mouseClicks? Or something else?

Craig Newman

Post Reply