0 votes

I was trying to create an pattern in Godot that has 3 scene patterns, so I've created the array with preload(), and with a function i've putted this code to start the ramdom select of the pattern:

var new_pattern = patterns[randi()%patterns.size()].instance()

but how these patterns are platforms I've put this code:

`new_pattern.position.x = initialPatterns.back().position.x + 1024`

so I've received this error:

Invalid get Index 'position' (on Base: PackedScene)

Godot version 3.5.1
in Engine by (12 points)

1 Answer

0 votes

initialPatterns is an array of paccked scenes, so they don't have position at that state. How do You want to randomize position ?

by (8,101 points)
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.