Endless runner with questions

Hi,
I try to do an endless runner game for my school.
When the character go forward, i want to do appear buttons with questions the words is a name? a verb ? en adjective?..
The character hit the good box and go further.

But I try to use the tutorial but I can’t do it.

I have matters with location to create the questions.

The ground is good but not the platform where the question is create

Anyone has an idea?

Make sure the platforms are on the base layer. If the platforms are on another layer, you’ll need to add another action to change the x position of that layer.

The platform are on the base layer.
I think the matters is I can’t fix the X position of the platform and the X position of the question.

I think the question appears not on the good platform.

Sorry, I don’t understand the issue then. Can you try explaining it again, with screen shots of what you mean?

I understand English may not be your primary language. If you could describe the issue in your native language and use Googe translate, that may explain the problem more easily.

I want to make a game with platforms.
As the player advances, I want the platforms to appear fairly evenly.
When the player is on a platform, a word appears with several boxes above it. The player must find the correct answer (he chooses the corresponding box).

In what I have already done, the word and the boxes do not appear above the platform where the player is.
I think I created the elements in the wrong place.

It is therefore, for me, a problem of setting the X positions of the objects created.

It depends on when you want the questions to appear. You can add the Q/A when the platform is created by placing the actions in the same event.

Add platform at …
Add question at …

You could use a fixed distance from the platform’s x,y or add a points on the platform and use those points or the place around object action .

Or you could add the Q/A after the player is on the platform with the is object on given floor condition which is under other.

If you use the 2nd approach, I would use an object Boolean to track if question is added otherwise it could add multiple questions everytime the player jumped. Set it to true when creating it.

player is in platform
platform boolean variable is false

I don’t know where you’re putting the questions or answers. I’m wondering if instead of automatically adding new platforms, you could add the next one after they answered the question correctly.

Maybe add multiple platforms and the platforms could be the possible answer.

Ok I try it
And this is the result

The problem now is that if I’m on the platform, I can’t tap the boxes that have appeared.
In my code, the choice of the question depends on the variable addition, if it is 1 it makes a noun appear, if it is 1 it makes a verb appear…
And suddenly, I can’t be on the platform at the same time to make the boxes appear and in the air to hit one.

Some picture




And so the boolean to delete everything doesn’t work too.

I think you need to separate the part that adds the objects and the part that checks for collisions. Add the objects and then in move the collisions with their matching scene variable addition = 1 or 2

The problem is now, the events are only happening if the player is on the platform. Once it jumps, it’s no longer on the platform.

You might need an addition Boolean or 2 to make sure the collision conditions only trigger when you want it to. I don’t know for sure.

Something like:

I made the changes using an image editor. So, things might be out of spacing. Just to clear, the collisions are on their own events. Meaning not sub events of the player on platform

It’s late here. I think earlier I misunderstood your code and thought you were jumping from platform to platform. Sorry. I don’t think you need the in on platform, although maybe you can change if player on platform to on the ground object

I’m unclear why you have 5 separate ground sprites. maybe you could use just one of them as the trigger. if add it first then you could set a Boolean object variable and then add the other and only the one ground objects would have the Boolean =true value. and then check for both on ground and then ground Boolean variableName is True.

IDK if you delete old ground sprites but you might need to set their Boolean value to false before you add the new ground sprites
set the Boolean QuestionTriger of ground = false

add ground sprite used for the trigger at …
set the Boolean QuestionTriger of ground = true
add the other ground objects

player on ground object (not floor but the condition under other)
variable QuestionTrigger of ground = true
then add the table and box objects

Again, apologies. It’s tough sometimes when you only see parts of something. And with yours, i confused it with another person’s similar project. They are making a vertical quiz project.

I don’t understand what will change.
When I will have the player who will walk on the ground, it will be necessary to create several pieces of ground to be able to advance so here I just do it by passing an X position.

However, I tested what you put above and it works a little but not completely. For the first platform, it’s ok, but from the second only the platform disappears, the rest does not appear. The word appears only after backtracking and the boxes never.
Is it because I’m placing them wrong with Platform.CenterX?

Ok. I think I’m understanding more of your project. I was thrown by the ground and by the platform that you show and hide.

Is this the platform object?

Is this where you want the questions to appear? I’m just unclear with your process. But I think I’m understanding more.

If this is the platform then my original thought should work if use player is on platform then added the boxes.(ignore my advice on the ground objects. I was confused)

But then outside of that group of events that add the boxes, check for the collision.

I think my previous idea before the ground thing should work.

Just so I’m clear. The player walks on the ground to the platform. You show the blocks above the platform. The player hits the correct answer and then they get deleted. You then

If you the collision with the boxes is outside of the event block the checks for the pkayer on the platform then it should work because the boxes no longer require the platform as a reference spot.

If you’re still having difficulty. Let know. I’m here until we get this working. It would help me if I could test your current version of your project. If you want and you can upload the project sonewhere. I’d be willing to look at it in it’s entirety. That’s completely up to you. I’ll try my best to help either way.

Yes, the ground is only t walk between 2 platforms.
The player jump on the platform you show on the picture. The boxes appear, he hit a box, if it’s the good one, 1 point if it’s a wrong one he lose 1 life (not coded yet).
Then everything is deleted till the next platform.
On each platform there is a random variable to have differents words to answer.

Here is the link
https://liluo.io/instant-builds/d8bef0c7-7e8c-46b6-99c9-8a2138e0c238

It looks like the first question is working. Yes? The blocks could use some feedback. If you check the collision between the player and the blocks then you can play an animation or shake the block. You can use the player’s abort the current jump action to make the blocks seem solid. IDK if you’re familiar with the shake behavior. You can add it to the blocks and shake the blocks.

I’ve been playing around with a continuous platform project. I added the blocks to it just to demonstrate the block idea.

online:

source: (you’re free to use any, all or no code from this project)
doug13579/gdevelop-endless-platforms-example: gdevelop endless platforms example (github.com)

Hi,
Thanks for helpming but IDK how to open the source from Github. I download it and IDK what can i do with the Json file.

For the shake, it’s a good idea but i want to solve my problem of creating the platform and the boxes.

I try something new, I create the platform if a boolean is false.

Then I create boxes if another boolean is false and delete everything if there is a collision between player and a box

At last, i change the boolean if the player is far from the platform.

But it doesn’t works
https://liluo.io/instant-builds/7a80b064-3731-402b-b3be-d30727163dc9

I don’t understand why the boxes doesn’t appear on the platform everytime the player is on the platform.

I’ll look at your events. As far as opening my example, you just open the json file in Gdevelop with open.

I think the event that adds the question needs a Boolean variable, so the questions can only be added once. I know there’s a trigger once but when the player jumps it makes the condition false and then true again when they land/jump.

I think the problem is the distance. Because the platforms are instances, I think it’s comparing the player distance from the platform to all of the platforms. Maybe save the X(), Y() of the platform to variables when the player is on it and then check the distance between the variables and the player’s x,y

When I open it in Gdevelop it’s empty, there is nothing

Sorry about that. I must’ve uploaded the wrong project. I reuploaded it and tested it. It should be good. FYI the boxes are just there as an example. They don’t get deleted and are sometimes in the way. Just an example. You can move them if they’re in the way.

I tried to recreate the game from yours, it allows me to erase all the mistakes I made.

This is what it gives.

https://games.gdevelop-app.com/game-805ca90b-3e91-41ef-86c2-3bbaadfbefd6/index.html

And here is the code
https://github.com/6reel/Gdevelop

I can create platforms in a row but I can’t manage to make sure that the boxes are not too close to each other.

I tried with only one but when I have 5 side by side it will not fit.

I think the center platform needs to be larger. If you duplicate one of the platform objects then you can resize it separately of the other objects otherwise you would need to use other conditions to choose the specific object, You could probably just make the platform larger and use fewer platforms. The box was being added before the size of the platform was set, so it was going off of the original size. I moved it down lower and since I added a copy of the original platform, I used the larger platform as the reference. Also, I used 32 for half the box’s width because the box has no width until at least one instance is created.

I made a duplicate of the PlatformMain and named it PlatformMainLarger. The larger platform’s boolean isn’t currently being checked but I added it for consistency. I think the old objects could be deleted when they go off screen with the delete when outside of the screen behavior. You might want to increase the distance for a little buffer area.

doug13579/gdevelop-endless-platforms-example-revised (github.com)

I see, i wanna try it.

The source of the code is exactly the same that mine, there is no difference.