Bruno58

Character Selection menu

Recommended Posts

Hi Im currently working in a phaser.js game and I wanted to add switchable characters.

I have My Main.state

I have My game over Screen in Over.state and in the game over screen I have a button to where I click and we go to the store Items thats where I want to put my switchable characters store.js

I kinda have an idea on how to do it but I want to hear it from you all my character state are as follows:

 preload: function () {                                            
    this.load.spritesheet('bird', 'assets/bird.png',52 ,28, 7);
 },  

 create: function () {                                                    
    /////Bird///////////////////////////////////////////////////
    this.bird = this.game.add.sprite(100, 200, 'bird');
 },

simple character I want to be able to switch by selecting another in my store page.

Share this post


Link to post
Share on other sites

you can pass initialization values for state via state.init so you can have state for choosing character and when character is chosen you can run:

// choosing character state
game.state.start('playState', clearWorldBoolean, clearCacheBoolean, paramsYouWantToPass)

// playState
init: function(paramsYouWantToPass) {
//do whatever you need to do with chosencharacter passed via paramsYouWantToPass
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.