Going to next scene
Eastbound
Member, BASIC Posts: 1,074
There must be an easy way to do this, but from searching I can't. I'm making a puzzle game that has an object once you hit it, it goes to the next scene.
In each scene I put an attribute called level, and I want to just check "If scene.level = 1, change scene to next level"
I can't select anything from a scene when creating a rule.
In each scene I put an attribute called level, and I want to just check "If scene.level = 1, change scene to next level"
I can't select anything from a scene when creating a rule.
Comments
I just tried and was able to do it.
be aware that only instances have access to scene attributes, the prototype of the actor does not.
You'll have to click on the actor that's already in the Scene.
If you have done this, and it's still not working,
I would just delete that instance and drag a new one out.
sometimes GS gets out of sync, and the instances don't get updated with the prototype.
That is how you change an actor's image, for example. If you need lots of actors that behave the same, but have have different images. In Danger Cats!, for example, I have all those objects - they are all the same prototype "block" actor, I just changed each one's png image. and you can tweak everybody's size/position as well.
I wouldn't change everybody's behaviors willy-nilly, though - that's why the padlock is there. just tpo make sure you don't add behaviors all over the place accidentally.
That being said. I usually have one actor in each Scene that acts as a "Level Monitor". The are no behaviors in this Actor's prototype, it's just a box - and it is set to invisible, and placed just outside the stage area.
This actor has access to the camera, and sets a global cameraOffsetX and cameraOffsetY, it also sets a global "currentLevel" integer as well. Other things specific to the Scene can be set this Actor.
I would make your Scene.level attribute global as well - that way all Actors have access to it. I would get rid of scene.level, and just make a similar level monitor.
Hope this helps!
Joe