Condition Problem

:face_holding_back_tears: :face_holding_back_tears:
What I wanted to do here is:

I’ve accounted the possibility that the player might put the left to right, and right to left etc. The explanation is down below

When CentrosomeRight is in collision with CentroAnchorRight the CentrosomeRight’s position is changed to CentroAnchorRight.X(); CentroAnchorRight.Y() AND CentrosomeLeft will not collide and change it’s position to with CentroAnchorRight anymore.

And when CentrosomeLeft is in collision with CentroAnchorLeft, the CentrosomeLeft’s position is changed to CentroAnchorLeft.X(); CentroAnchorLeft.Y() and CentrosomeRight will not collide and change it’s position to CentroAnchorLeft.X/.Y() anymore.

Same goes with when CentrosomeLeft is in Collision with CentroAnchorRight the CentrosomeRight can no longer collide or change it’s position to CentroAnchorRight and can only now collide and change it’s position to CentroAnchorLeft.

I tried and failed twice solving this. I need help :face_holding_back_tears:

What exactly is happening that’s not wanted? The only thing that I noticed is that if the object is dropped on the opposite side that it will be moved to the correct side. This would cause the event that checks if it’s on the correct side to also trigger. If that is unintended then you probably need to use more conditions. Either check a state variable or an animation. I don’t know how any of the changed variables are used.

So there are two centrosomes (left and right) and they should be attached to an anchor (left or right). I’m taking into account the possibility that the might take the left Centrosome and put it on either the left or right anchor. Hence, my condition (which I hope is correct)
So my problem now is what to put in Action so that CLeft collides with CAnchorLeft, CLeft attaches to the CAnchorLeft, and then Cright shouldn’t collide and attach to CLeft, it should only attach to Cright.

Can I ask why there’s a left and a right? Are the objects different? Why does the left need to go only on the left and the same for the right? It could be simplier to just allow one of each per position.

Having the left just appear on the right seems abrupt. I’d wonder “where did it go?” A tween to the other position might be more subtle or informative. Or maybe a sound and cause the correct spot to blink or be highlighted or maybe even have an arrow appear.

I’m just thinking of a way to simplify the events and create a smooth gameplay. Ultimately, you set the rules and that’s fantastic. Your project looks amazing. If there needs to be left and right objects that fine. I’m just trying to better understand your project.

I’m going to be at my PC. The great thing about GD is instances and groups. They are such timesavers. If each object had a matching variable that denotes the side then the same events could be used regardless of the side. If the side object variables match it snaps the object to the anchor. If they don’t match then it snaps to the one that it doesn’t match.

I just feel like it shouldn’t matter to the events what’s being carried. The objects and anchors could be in a group. When they’re placed or dropped or in collision with an anchor then the carried object and the anchor object variables could be compared. If they match then they snap. If they don’t then the opposite anchor could be used if that’s your desire and the object can go to it.

If I’m misunderstanding your project, I apologize. Let me try something. And if I’m wrong about your needs then I’ll try to make something that aligns with your needs.

Hi @Keith_1357

The CentrosomeLeft and CentrosomeRight are two separate objects. While they’re named “Left” and “Right,” they don’t have to be placed on their respective anchors. Each can be attached to either anchor, depending on where the player decides to place them.

Initially, both Centrosomes are besides each other and are at the upper-right edge of the oval. The player’s task is to pick up each Centrosome and place it on an anchor. For example, if a player picks up CentrosomeRight and decides to attach it to the left anchor, that’s perfectly fine—it will attach. Similarly, if the player attaches it to the right anchor, it will also attach.

However, to keep the gameplay clear (I think ahhaha) and functional, I need to ensure that each anchor can only hold one Centrosome at a time. This way, if a player tries to place both CentrosomeLeft and CentrosomeRight on the same anchor, it won’t allow both to attach. Each Centrosome needs its own anchor.

1 Like

Sorry, I misunderstood that part. Let me try something and I’ll post it later if I can.

It’s totally fine, it was fault for not explaining clearly, sorry. :pleading_face:

1 Like

Just make SpindleForm a different object. Then when Centrosome is in collision with Anchor, change the position of Centrosome as you’re doing now, then delete anchor, delete Centrosome and create SpindleForm @ Centrosome x/y.

Now you don’t need to worry about keeping the Centrosome stuck to the Anchor because there is no Centrosome there is only Spindleform, and they cant move. And now you don’t have to worry about someone putting the other Centrosome on the same Anchor because the Anchor is gone too.

EDIT: Or fine just use Keith’s brilliant solution.

1 Like

Here’s what I came up with. It might not fit your concept but I’m hoping elements might.

I used fruits for my example because it’s something I understand. I put 3 fruits into a group named Fruits. I copied the objects and named them the fruit name plus Anchor. So, Apple became AppleAnchor.

try me: the fruit objects on the bottom are draggable to any of the darker fruit anchors.
https://gd.games/keith_13579/drag-fruit

Source files: (click the green [code] and [download zip])

Here are the events

The first event is just to darken the anchors so I didn’t have to draw different animations.
The other event checks how many objects are in collision with the anchor.

scene

groups
image
image

This is barebones. I know you use a mover not dragging. It also needs checks and things but I still feel the process is there. Name the anchors using the move object name plus Anchor and the compare text condition will make sure they match.

2 Likes

Thank youuuuuuuuu so much for this @Keith_1357 this is perfect :heart:

1 Like

Thank youuuuuuuuu @Lucky-j :heart:

1 Like