How do I check if the player win this puzzle

Just started using Construct 2? Post your questions here

Post » Wed Oct 18, 2017 6:43 pm

I found a nice tutorial about a slide puzzle : https://www.youtube.com/watch?v=sTzE7rdkFLk&t=28s

The problem is that I don't know how to check if the player build the puzzle correctly to give you a award. Could someone please help me to figure out how to reward the winner? :D
B
4
S
2
Posts: 153
Reputation: 908

Post » Wed Oct 18, 2017 10:28 pm

Hey @Braus!

The easiest way, considering how it is implemented in this tutorial, would be to create an instance variable (text) for the Grid object called "position" and give it a value equal to the correct letter/piece for that position. So, first Grid on top row would be A, the second B, the third C, etc. Last grid is empty, so its position variable would be blank.

Then, every time you reposition a piece (on the click event) you would call fuction similar to this one:

Image

EDIT: Here's a capx, so it's more clear.

https://www.dropbox.com/s/r8rnbl1128oa9 ... .capx?dl=0

I didn't implement the whole game, just the victory condition. Just drag all letters to the grid objects in the correct order. If you want to test, drop one letter on the last grid, which should be empty, put all others on their correct positions and then drag the last one to the right place.
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 717
Reputation: 3,996

Post » Thu Oct 19, 2017 4:00 pm

Hi Bruno. Always saving me. :)

Very nice solution. I will implement it.

Many thanks.
B
4
S
2
Posts: 153
Reputation: 908

Post » Fri Oct 20, 2017 10:36 am

Glad to help!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 717
Reputation: 3,996


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests