Progress in order

In this game, I have balls and cubes. My balls try to hit the cubes. When the player clicks on a ball and then draws a path, the ball follows the path and hits the cube. Up to this point, everything is normal and there’s no problem. But I want the balls behind my balls to move upwards and fill the space left by the ball that went up. In the image, you see three balls in the first row, and I want the first row to be active. The player should select one of the three balls in the first row and send it to the cube. Then, let’s say the ball in the middle of the second column of the first row is selected and moves, the middle ball in the second column should fill the empty space upwards. I want it to progress in this way.

Hi, I don’t have any answers for you but it could be worth checking out this example and see if there’s something in it that can help you. The balls follow a path and move together in a chain.

Thank you, I will review it.

You could use a raycast. When a ball is selected and starts to move, send a raycast down the screen and move the ball it hits to the first row. Note, make sure the raycst s from outside the selected balls collision box, otherwise it will get selected.

I haven’t been able to do a more thorough review, but I think Raycast might be a good option.

Unfortunately, I wasn’t able to achieve what I wanted. Could you offer other examples or ideas to support this?

I’ve used Construct 3 before. It had a pin behavior feature; it tracked an object, that’s how I can explain it. I want the ball that was moved to return to its original position. How can I do this in gdevelop? Does it have similar features to Construct 3?

I would give my object two number variables called PosX and PosY
I would save its X and Y position to PosX and PosY
Then when i move it and want it to go back i would change its position to its PosX and PosY variables

1 Like

GDevelop also has a behavior like this, in the main menu, look through the extensions or the object behaviors.

Name of it?
Cause i cannot find it and i would see it as something better than my variables solution




This one?
https://wiki.gdevelop.io/gdevelop5/extensions/checkpoints/

1 Like

IDK if that’s the one but that is more than enough ppl with same as OP question would want
Which at the same time seems easier than my variables solution

Thx

The Pin behavior reminds me of the Anchor behavior in GDevelop.
But not sure they work the same. Checkpoint behavior seem better for a “respawn”

I have balls in my game that move toward their targets. After clicking and drawing a path for a ball, I want the next ball in line (located at the bottom) to move forward to take its place, similar to a queue system. I thought I could achieve this using the ‘Pin’ behavior in Construct 3, but I’m not sure how to implement this in GDevelop. This is what I wanted to ask about.

Can you provide a screen shot of the events?

You could move the balls with a tween.

I used 3 objects. The Ball, FirstRow and LastRow. You could use variables instead of the row objects. I like test objects because they’re easy to setup and they automatically update if you make changes. I added the tween behavior to the ball object.

I used 2 scene variables. LastX and Yspacing. Yspacing is just the Y distance between rows. LastX is the X() value of the selected Ball.

It needs checks to make sure the tween isn’t playing or a boolean is true or some other condition is met.

I agree with what you said, but I’m wondering how it would work if different balls were used. To be more specific about the game I want to make, I’m adding a YouTube link here: (https://www.youtube.com/watch?v=Rn4prn1-fXw&t=2s). In a game called ‘Pixel Flow,’ once you click on the characters, the pigs enter a track and move forward. When a pig moves out, it’s replaced by the pig below it and the one positioned diagonally. You could say I want to create a similar mechanic, but with balls instead of pigs.

If you align their center positions (which is proably desirable for visual consistency anyway), then you could use that as a quick-and-dirty way to pick the next one by saving it into a scene variable. I don’t know how exactly you’re throwing the balls so I’m just using a fake condition here:

ball gets thrown       | set variable OldX = ball.CenterX()
                       | do other stuff
|-------------------------------------------------

OldX is greater than 0 | set variable OldX = 0
ball.CenterX() = OldX  | move Y position of ball

Keep in mind this only works for two rows as you have in the screenshot. If there were more than two, you would need some additional logic, as this will just put everything that matches OldX into the top row.

It is important that the second event is not a sub-event - it should be on its own level because you want to pick a new ball. Using a sub-event is possible but you would need to use “unpick all objects”

OldX should be 0 to start. When a ball gets thrown, OldX is set to the center position of the ball (make sure to do this before actually moving it).

The second event checks for OldX being anything other than 0. If it is, it then finds all balls whose center X is the same, sets OldX back to 0 and then moves the balls. Another consideration here is that this can’t handle multiple columns at the same time, but as long as you don’t allow two balls to be thrown at the same time it should be OK

My ballz have 16 pixel height and they are put one under another
That is why you see Ballz1.Y()-16
So like distance is their height
I used opacity instead of object variables cause why to use variables when you can opacity
But choice is yours

Last 3 events (one of them is sub event) are just to move ballz to bullet and spin them around it so that is just something for this example and not for you


The problem is, I’ve tried and deleted so many versions after you that I don’t honestly remember it all. It might look something like this, with its missing parts. There were other events I added, but I can’t recall them right now.