Puzzle/board game : best practices (capx incl.)

Get help using Construct 2

Post » Sat Oct 05, 2013 12:18 pm

Hi everybody,

I am starting to implement a drag and drop puzzle 'game'.

This is more an experiment than a real game, but I wanted to get advice from experimented C2 users on the best practices to achieve such project.

My goal is to start small by setting up a kid puzzle game. It would be some easy 4 pieces puzzle where you can drag and drop the pieces in their correct placeholders.

Later on I'd like to move forward in my learning to be able to start building board games (there as well it would go from very simple to more complex stuff based on what I would have learned)


So far I am not at the 'simple kid puzzle game' yet, I just have a capx file/project that does the following:

1) Initiate a player in a placeholder sprite

2) Initiate a map composed of 5 sprite having a disabled 'black and white' effect

3) Add drag and drop on player (and position it to the touch position)

4) Highlight the map cell I am over (by dragging the player). Only one map can be highlighted at the time)

5) Handle the 'on drop' so the player position is either set on the map cell highlighted, either it's placed back on the initial placeholder.

(sorry I can't post links yet)
Demo is there : www.lo-zone.com/labo/puzzleLo/demo/index.html
Capx is there : www.lo-zone.com/labo/puzzleLo/puzzleLo.capx

I looks a bit 'static' to me, I was wondering if there were better way to implement such things. Maybe there are plugins that would be better to use for such 'game' maybe there is a way to 'loop' through the map definition, or a way to group map items toegether as they mainly have the same behaviour.

here for each map item I copy pasted the events and updated to fit to map1, map2, map3, map4 or map5. maybe there is a way to have a loop that could define the whole map (especially if I start having bigger maps).

Don't hesitate to let me know if you need further info or if you want me to clarify some points.

Thx in advance for any help you could give me.

Lopimp2013-10-05 12:37:51
B
11
S
2
Posts: 40
Reputation: 811

Post » Sat Oct 05, 2013 1:01 pm

Things to read up on:

- functions
- families

and to make it look less static you could choose to use one of the movement behaviour on drop.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 05, 2013 1:06 pm

Copying a lot of events is (almost?) never necessary. it can be avoided by using families, functions and/or instances of the same sprite.

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Oct 05, 2013 1:55 pm

Trust me "Functions" learn how to make one, and use it all the time. Especially when you have player 1,2,50 involved if you ever go that route.

You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Sat Oct 05, 2013 6:01 pm

Hi,

I've updated my project using families and function but I am a bit stuck trying what I want to achieve.

here is my updated capx : www.lo-zone.com/labo/puzzleLo/puzzleLo2.capx


I've got 2 functions in the event and a question for both (questions are in a remark in the event tab)

1) ????? -> How to disable 'black and white' effect for all family item and how to enable it only for the one I am over (id being the function param)

2) ????? -> How to set position to familly item Player is over (id being the function param)

Help would be really appreciated

Thx
B
11
S
2
Posts: 40
Reputation: 811

Post » Sun Oct 06, 2013 1:07 pm

Ok I've managed to get the map item I was over with by using a sub event.

But I still have an issue to set my player position to the map item from the family I am over.

This is the last event of my capx

www.lo-zone.com/labo/puzzleLo/puzzleLo3.capx


I'd really appreciate if someone could help.

Thx
B
11
S
2
Posts: 40
Reputation: 811

Post » Sun Oct 06, 2013 3:49 pm

onPlayerDrop(isOverCell)

You can't use MapItems.UID because you haven't picked the current one.

You should not rely on a fixed UID (that is =0). You should store the UID of the placeholder of startup and compare to that. That way it can change to any number in the future and everything will still work.
blackhornet2013-10-06 16:31:32
ImageImageImage
B
71
S
21
G
233
Posts: 3,697
Reputation: 130,370

Post » Mon Oct 07, 2013 5:58 am

Ok I updated the 0 to use a variable instead.

thanks

Here is the full capx using functions/families and sub-events : www.lo-zone.com/labo/puzzleLo/puzzleLo4.capx


Thanks a lot for the helpLopimp2013-10-07 08:24:31
B
11
S
2
Posts: 40
Reputation: 811


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, OBLIVION and 21 guests