stack objects?

  • I want to stack objects. It should work like this:

    There is a "plus" and a "minus" button. If you click(touch) on the "plus" button a new object should appear on top of the other. Then you click again on the "plus" button and a new object appears again on top of the other two objects. Like building a tower... If you click on the "minus" button the object should dissapear.

    can u please help me?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could use animation frame to do this mixed with instance variable. Add a variable which is called "NumberOfItems" so if you push + you increate this number and if you push - you decrease it. Then, depending on the number you show the exact frame number relative to this number.

    This would work if you have a max number of items to be stackable.

    However, if you really need a new object. Then still use instance variables.. if your object have NumberOfItems lets say 2 then the next object created Y position will be Object.Height * NumberOfItems (because you already have 2 objects, if your object height is 10 then the result will be 20) + Object.Height (because the base coordinates are top-left, you haveto include the object height you want to add, so now the result will be 30 for the Y position).

    This formulea doesn't take spacing between objects into consideration but this could easily be added.

  • thanks a lot!

  • The stacking of my objects with the plus button is working now,

    but I haven't figured out how to delete the objects with the minus button

    My capx file:

    dl.dropboxusercontent.com/u/211639432/testforforum.capx

    I would be glad if someone could help me

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