Jigsaw puzzle game

Get help using Construct 2

Post » Tue Oct 11, 2011 2:51 pm

Hi everyone,

This is my first post.

Would be Construct 2 a good tool to make jigsaw puzzle games?

I consider this requirements for a basic jigsaw puzzle:

1) drag and drop pieces;
2) when the piece is near at right place it just snaps to right position;
3) count time and pieces left;


I made my first attempts last night. It was easy to do 1) and 3). But I am not satisfied with my solution to 2), it works but it's ugly.

I would like to hear from you guys how would you do that.


Thanks in advance

jailson2011-10-11 14:53:15
B
228
S
6
G
8
Posts: 86
Reputation: 12,295

Post » Tue Oct 11, 2011 3:22 pm

One way to do the piece snapping would be to have each piece store its correct position in two private variables - something like 'correctX' and 'correctY' would do.

Then, when you release the piece with the mouse, check the distance between the piece's actual position and correct position using the distance() expression in the system object. If the distance is within some set tolerance - say, 10 to 20 pixels - set the piece's position to the correct position.

Be sure to let me know if I need to clarify any further. I hope this helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Tue Oct 11, 2011 5:56 pm

Linkman, that is a good approach. At least is more elegant than mine, that way I could store positions at a database. I am not used yet with Array and Ajax at Construct2 but it would be quite easy, right?

My approach was: for each piece, I would have an invisible copy in another layer, and it would check with the sprite overlapping condition.jailson2011-10-11 17:57:30
B
228
S
6
G
8
Posts: 86
Reputation: 12,295


Return to How do I....?

Who is online

Users browsing this forum: heliogame, WhosWho and 25 guests