Closed itsOgden closed 10 years ago
Have you checked out how the supercollider demo does it?
I've looked, but I must be missing it because I can't seem to find it.
Hi @itsOgden,
to be clear, you have a custom loadLevel
method where you load your stuff manually (no level made with weltmeister) and once your done with that you spawn your entities?
If yes, can you show us that code? Until now I did it like in the SUPERCOLLIDER demo. So I loaded my level with loadLevel
and added my stuff after calling parent at the buildLevel
method.
@itsOgden much like a lot of other methods ImpactJS provided, Impact++ breaks those down into smaller chunks to try and avoid sequencing issues. Originally I think we also wanted to try to setup deferred/lazy level loading, hence the separation of loading and building, but we found it was not possible unless we reworked a lot of the underlying ImpactJS architecture. @Pattentrick is correct, you want to put the code that spawns entities into your game's buildLevel
method, after you call the parent method.
Does this work for you?
@itsOgden here is the comments that explain it in the supercollider demo: https://github.com/collinhover/impactplusplus/blob/master/examples/supercollider/lib/game/main.js#L84
@collinhover @Pattentrick That's perfect, guys! Thanks again. Aside from a little weirdness where an entity I am using for UI was getting duplicated (which I remedied by selectively killing it on reset) everything is perfect.
Me again... lol
Currently I am only using
loadLevel
to load the background image and a few collision tiles. All of my entities are spawned throughspawnEntity
on init or at various times in gameplay.So, with that said, I know that I can tell the game to
loadLevel
again and it will reset the level and kill all of the entities (that aren't on the ui layer?). But for whatever reason, I can't spawn all of the entities again using the same method. Any idea what would be going on or what I should be doing instead?