Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by whappit

Hey there guys,

I have a level and when it starts I want some function to run to see if some conditions are met and then spawn a few entities. But how do I do this? I dont want to edit in my LevelName.js because of weltmeister.

is there an event I can listen to. Or maybe I can put in a trigger in weltmeister that calls a function or something?

Thanks guys!

1 decade ago by sviudes

You can override loadLevel method of your Game class:

loadLevel: function(data){
    this.parent(data);

    if (data == LevelDesired){
        // Spawn your additional entities here
    }
}

1 decade ago by whappit

Ah awesome, thanks! My solution was to create a spawner entity that I placed outside the level. It can do all I want, but ill use your more elegant solution in next projects!

Gr.
Page 1 of 1
« first « previous next › last »