0 votes

I want to implement unique logic per level, and it seems that my code is quite cumbersome because I defined all the logic per level only on a single function of a single file. The levels are not to be changed; they will stay the same in the same scene.

Inside Main.gd

func _physics_process(delta):
    match level:
        1: ...
        2: ...
        3: ...

In every logic, I'm constantly changing the physics bodies' velocity so put it inside the _physics_process function.

I don't think if that's the good idea to get working with, but I think there's always a better one.

asked Jan 3, 2019 in Engine by ryugomez (32 points)

1 Answer

0 votes

I would create a base Level scene that has the logic common to all levels, and then create scenes Level1, Level2, and so on which inherit from it. Each of these child scenes can have their own script attached with the logic specific to that level.

answered Jan 3, 2019 by anomalocaris (56 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 How to use this Q&A? before posting your first questions.