scene:
{
preload: preload,
create: create,
update: update
}
This is how the scene is built in the phaser tutorial and I have no idea how to give it a key or how this works at all or how to add a new scene. Please help me learn this.
scene:
{
preload: preload,
create: create,
update: update
}
This is how the scene is built in the phaser tutorial and I have no idea how to give it a key or how this works at all or how to add a new scene. Please help me learn this.
I think I might understand some of it that I have done a bit of reaserch. So what I have typed above would go in the config like I did in my game but for to create a new phaser scene I would do
class MyScene extends Phaser.scene {
constructor() {
super({ key: 'MyScene"})
}
so I think that is how I would make a scene with a key, but how would I create a scene and put a preload create, and update function in my scene?
Ok, I have done more reasearch and I have figured out that you must do this
class MyScene extends Phaser.scene {
constructor() {
super({ key: 'MyScene"})
function preload()
{
//preload stuff here
}
function create()
{
//create stuff here
}
function update()
{
//update stuff here
}
}
Although now I must learn how to call these scenes because if you cannot call them they are basically useless
@samme you are a master at this stuff if you could please help me that would be so great and it would really help me in my next street fighter/super smash bros kind of game with all the fighting arenas as different scenes in phaser.
thanks so much for that samme!
Im sorry, but I still have another question, so I would do this to load scenes
new Phaser.Game({
scene: [
// Only ‘scene1’ will start.
new Scene1(‘Scene1’),
new Scene2(‘scene2’)
]
});
but if I were to do this, only scene 1 would start. How would I make it that if the player were to click or do something the scene would change. Is there a line of code that could do this. Like maybe Scene2.start(); or something simmilar?
this.input.once('pointerdown', () => {
this.scene.start('scene2');
});
Thanks so much for this! It has really helped me understand phaser better and my next game will now not make your computer fan super loud!