How do i create OBJECTS number of OBJECTS times

how do you create number of boxes per pipe?

here is my code

There are two ways you could achieve this.

  1. Use FOR EACH OBJECT and for each object_1, you create object_2.
  2. Use REPEAT x and use the count expression for object_1 and create object_2.

Here is an example;

1 Like

ill try that
:grinning:

THX worked perfectly :smile:

um so i noticed i problem :thinking:
when i have 2 btns with similar code (almost the same)
but the problem is when ever 1 is pressed it never can be pressed again :disappointed:

You might have to have the button press logic in a FOR EACH OBJECT event. Or work out a way to only select a SINGLE button. For example, getting the closest button to your mouse X/Y. Here is two examples using the online editor.

The first options loops through ALL buttons and if your mouse is on any of them, it runs the code.

The second option checks if ANY buttons has your mouse on it, then gets the CLOSEST one to your mouse and runs the code.
If you don’t have the nearest check and have multiple buttons, some will and some wont have the mouse on it resulting in a failed event.

i literly have it so it will auto sets the btn back to unpressed the milisec i am off of it

(btw this is a platformer so the player walks on to the btn)

there is 2 other OBJ that can push btns… box, copycat,and player how ever when i am testing there’s no boxes or copycats around

you could make a variable and set it to the number of specific object using the “x number of object” function and create an object “variable” number of times.

i have that covered it does the creating better than expected but the issue is that originally both buttons work, now only once can each be pressed

BFI

(this issue happend after converting both btns when only 1 was converted it worked fine)
BFI stands for be-fore issue