This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi,

I am new to the godot engine so please forgive me if this is a very simple question.

So I am creating a game (2d platformer) that pretty much has the same level layout as every other level. However, each level has a trick to it. Say:
For level 1:
- flick the lever (by pressing f) and a portal opens up.
- enter the portal and go to next level (level 2)

For level 2:
- flick the lever (by pressing f) 5 times and portal opens up.
- enter the portal and go to next level (level 3)

For level 3:
- flick the lever (by clicking with mouse cursor unlike level 1 and 2) and portal opens up.
- enter the portal

etc etc.

So this is the layout for the game I'm developing. Problem is when I duplicate the level, the scripts (for lever, portal etc) don't seem to be "individual" to each level node. Is there a way to make it such that each level node and its sub-nodes (like the lever for level 2 having a separate script to level 1's lever)?

Thanks, and sorry again if this is a stupid question.

in Engine by (12 points)

I'm not sure if you can have individual scripts, but the best you can do is in the script to check what scene this is.

1 Answer

0 votes

In the bottom of Inspector tab you can find current script of the node and make it unique by pressing RMB and Make Unique.

However, I recommend to make individual scripts only for levels themself, when the items scripts will contain common functionality for that kind of items: like, the lever's script contains input events and signal (or at least call function in) level script that lever was toggled. But you can do it whatewer you like.

by (654 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.