Jump to content

leveling game play pop up screen


sinanqd10
 Share

Recommended Posts

Hi guys,

 

I would like to do leveling game that showing pop up to next level of the game play.

 

It means that when I stay in level 1, I have to show the pop up screen that display :

 

level 1:

instruction text

 

When I passed the level 1, then I have to move to the next level which display the different text :

 

new level 2:

new instruction text

 

here is my code that I have been doing:

var gameState  = {      create: function ()  {       this.popUp();   },   popUp: function ()  {                        mask = game.make.bitmapData(480, 360);            mask.fill(50, 50, 50);            sprite = game.add.sprite(0, 0, mask);            sprite.tint = 0x000000;            sprite.alpha = 0.5;            popupGroup = game.add.group();            var background = popupGroup.create(game.world.centerX, game.world.centerY, 'background');            background.anchor.set(0.5);            tween = game.add.tween(popupGroup).from({y: -400}, 800, Phaser.Easing.Bounce.Out, true, 500);            popupGroup.create(tween);            var style1 = {font: "14pt house-a-rama-kingpin", fill: "#076316", align: "center"};            var style2 = {font: "10pt house-a-rama-kingpin", fill: "#fefe00", align: "center"};            var style3 = {font: "8pt house-a-rama-kingpin", fill: "#65fefe", align: "left"};            var level = "Level 1";            var completeText = "To complete level 1\nYou Must:";            var instructText = "-Win 3 times within the limit time";            btn = game.add.button(game.world.centerX, game.world.centerY + 120, 'readyPlay', this.btnReadMore, this, 1, 0);            btn.anchor.set(0.5);            btn.input.useHandCursor = true;            var levelText1 = game.add.text(game.world.centerX, game.world.centerY - 120, level, style1);            levelText1.anchor.set(0.5);            popupGroup.add(levelText1);            var levelText2 = game.add.text(game.world.centerX, game.world.centerY - 80, completeText, style2);            levelText2.anchor.set(0.5);            popupGroup.add(levelText2);            var levelText3 = game.add.text(game.world.centerX - 40, game.world.centerY - 30, instructText, style3);            levelText3.anchor.set(0.5);            popupGroup.add(levelText3);            popupGroup.add(btn);                }};var levelState = {     create: function() {        this.nextLevel();     },     nextLevel: function () {            var level = {                level1 : 3                            };            if (winScore >= level.level1) {                game.state.start('gameState');            } else {                game.state.start('gameover');            }        }};

Can anyone guide me the way of doing level in the game? Thanks in advance !

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...