Object position + connection between two objects

Hello guys, I’m kinda new to GDevelop and I’m working on my game for a school project and I need some help from you.

So basically it is gonna be an educative, math game. I have a rocket (moving object, top/down mov.) which is flying upwards and on the top of the scene there are two random numbers with a “+” sign between them. I have managed to do the text with right answer(RandomNumber1+RandomNumber2) and with the wrong one(RanNumb) and delete both of them while the rocket is colliding with one of them. Now I have a problem with creating these two objects again in position in front of the rocket (Rocket.Y()-something), I need the object to stay there once it is created but it is still moving constantly with the rocket…

Also I would like to have some border/box around the text but I don’t know how to connect text to an object like this…

Thanks for any help and I hope you get what I’m trying do to.

Hi there,

If you create your objects once at a X;Y position, they shouldn’t move. If they move, it means there’s an action doing it. Try to find it. If you can’t, perhaps you can share your project for us to have a look.
Regarding the text box, you can draw it in Paint/Gimp and set the position you want (Text.X/Y()-10, for instance). You will need to take care of the Z-order to make sure the box doesn’t hide the text.

I got it like this, Idk if I should add some timer so it will be delayed, maybe It’ll help. And I’m going to add the box later, thanks for that :slight_smile:

Instead of the first four lines, you could have:

Do = 2+Random(38) to Answer1
Do = Answer1 - 10 + Random(20) to Answer2

if you want a -/+ 10 for Answer2.

Yeah, great idea, but I still need somehow make the answers move so the rocket can reach them again, but if I use Y position as Rocket.Y()-something, it is still fixed to the position of rocket and is moving with it. Is there something I can do to separate these two? I was thinking about fixing the position to the background, but the background is infinitely scrolling.

You set the X and Y position you want for the answers, no need to use Rocket.Y().

as said if you need rocket.Y() for something you can store in the moment you want under desired condition into another variable and use this as it wont change, rocket Y() is always changing

Thanks guys, I somehow found a function which separate two object and I made it work. Thanks for your help anyways <3

which function? it would be nice to write the solution

Yeah, sorry, so I used this to separate the object Rocket from the Object Answer 1/2 so the only object moving is the Rocket and the Answers stays where they are.Bez%20n%C3%A1zvu

1 Like