The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I'm new to coding trying to create a 2d endless runner and only have one platform and struggling on how to generate different various platforms I don't want them to be the same size as the first one I want more than one platform you could jump on and to also have them be in different sizes. One last thing the platforms only come in a straight line I want the platforms to randomly generate all over.

extends Node2D

const OBSTACLE = preload("res://scenes/Platform_big.tscn")

func ready():
score = 0

func onTimertimeout():
var obstacle = OBSTACLE.instance()

func onScoreTimertimeout():
score +=1

func process(delta):
$Label.text = "" +str(Global.current

Godot version GLES2
in Engine by (17 points)

1 Answer

0 votes

Every time you create a platform you need to generate a random number (see

Everything you need to do after this is setting the obstacles y position to the random number you just generated.

by (82 points)

how would I randomize the positioning specifically cause it'd either not work or I would get an error. Here's the script for the platform for a better reference

extends StaticBody2D

func _ready():

func _process(delta):
position.x -= (370) * delta

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.