Jump to content

new to phaser would like some help


ibb671
 Share

Recommended Posts

Hello im new to phaser and programming in general. I never really understood programming until I started with phaser. I'm enjoying it so far. I wanted to ask if anyone can help me with my code. I am practicing by making a project similar to the monster wants candy tutorial. I having trouble with the scoring of my game. Here is the section of the code that i have put in the update loop.

killSprite:function(){
        this.mothersDayItems.forEach(function(element){
            if(element.y>this.game.world.height-130 && element.frame!=6){
                element.kill();
                this.decreaseScore();//starting score is 5 and this function decreases by 1
                this.particleBurst(element.x,element.y-20);
                
            }else if(element.frame==6 && element.y>this.game.world.height-120){
                element.kill();
                this.particleBurst(element.x,element.y-20);
            }
            

        },this)

    },

 

When i console.log() the score when 1 item reaches the bottom it decreases almost up to -60.

Hope this screen shot will help. Thank you guys in advance.

Screenshot (39).png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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