How do i place my turret

my turret does not stop following the mouse after left mouse button releases


It’s this event that’s causing the issue:

Once IsClicked of BuildButton is set to true, there are no events that set IsClicked to false or Activated to true. So the conditions will always be true, the actions will set BeingPlaced to true and the turret will forever follow the cursor.

thanks! i reimplemented the build variable of the player but now i think im missing a lot of linkage checks in my conditions because it breaks when i try to place another turret. I tried to add them, but links are something that I still cant quite grasp even after reading the documentation



game link: https://gd.games/sadziez/slime-frontier-sector-9

You could, instead of using object linking, use the Sticker extension and stick the TurretHead, RangeIndicator and PlacementAvailability objects to the TurretBase.

Then you just need to move the turret base with the cursor and let the extension move everything else. And when you drop the TurretBase, just unstick the 3 objects.

It’s a lot less involved for you and works.

i stuck and unstuck each of the objects, but the second turret accessories dont want to stick to the second base. should i have use a for each loop for all commands inside buildbutton clicked? also, how do i prevent bases from being changed because i pick the closest base to the cursor?

When you stick the objects, you’ll need to specify (using conditions) which ones to stick to what base. It’s best to do that in the event that you create the TurretBase, TurretHead, RangeIndicator and PlacementAvailability objects, at which point you don’t need to use conditions to pick them.

And thinking a little more about it, you don’t need to unstick the objects. It’ll make it easier to click and drag them later on.

Exactly what Bubble said! If you want to get fancy later on, you could put your different turret types into an ‘Object Group.’ That way, you can use the same logic to spawn different towers without rewriting the code for every single one.

What did Bubbles say? There are no posts from Bubbles in this thread…

1 Like