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

0 favourites
  • 8 posts
From the Asset Store
An amazing and interesting puzzle game for kids!
  • 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 : lo-zone.com/labo/puzzleLo/demo/index.html

    Capx is there : 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

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

  • 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.

  • 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 : 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

  • 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

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

    I'd really appreciate if someone could help.

    Thx

  • 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.

  • Ok I updated the 0 to use a variable instead.

    thanks

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

    Thanks a lot for the help

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)