creating objects in menu

  • So I'm using a bunch of different menus in the game I'm making (for touch screen). And the way I do them is by having a background and items on top that are pinned to the background, and a vertical drag and drop behavior on the background. It works well, but the amount of events I have to have for every menu is going to be crazy!

    I'm wondering if there is a way to make it more efficient maybe.

    Right now I'm creating the background object, creating all of the menu items (it's going to be a whole lot of them later) one by one with the different Y-positions. Then I have to pin each one to the background. I've put the menu items in a family and tried to pin the family to the background but it refused to work so I'm doing it one by one..

    And then of course the events for each menu item that tells them what to do when I press them.

    I don't know if there is any other way to do it, but I thought I should ask at least!

    Maybe some smart way to create them and position them below each other without having to do it one by one or something?

  • I don't think there is a simple way (you need to put the information somewhere, no matter what). Maybe you can find some regularities (for example, many menus contain a column of 50x200 pixel buttons; then you could do some sort of preset function that knows the position and you just tell it which animation to show for the first, second, third, and so on button).

    Pinning families works. I guess you do something wrong.

  • Ok I'll have to think about that, maybe I'll just accept the amount of work I have to do for each menu <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Could you maybe take a look at this and tell me what I'm doing wrong with pinning the family? https://dl.dropboxusercontent.com/u/624 ... ample.capx

    Thank you so much for your help btw!

  • I usually use a dictionary object, repeat tokencount times, create tokenat(loopindex)..

    Quick Example

  • I usually use a dictionary object, repeat tokencount times, create tokenat(loopindex)..

    Quick Example

    Cool! A tad bit advanced for me maybe, plus each item on my menu is a tiled background image that is different from each other so I think that makes it a bit more complicated maybe!

    But if I can get the object family to pin to my menu bg it would help alot at least! Don't understand what I'm doing wrong there..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just add a "system wait 0" action before the pinning action..

    That way the pinning is delayed untill after the tick, when all objects actually exist..

  • Thank you thank you! Now at least I have one less step to do for each menu item.

    I suppose there are ways to do it more efficiantly but I think I'm to much of a newbie to figure them out, so I'll stick with the method I'm using now. It will be fine. Thanks so much for all your help, this forum is the best!

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