Jump to content

Why aren't my walls solid?


danmoople
 Share

Recommended Posts

Hello everybody! I created a little scene with walls. Bottom wall is solid. But left and right are not. Why? Can you please help me?

preload: function()
    {
        game.load.image('mario', 'images/mario.png');
        game.load.image('WallH', 'images/wallH.png');
        game.load.image('WallW', 'images/wallW.png');
    },
    
    create: function()
    {
        game.physics.startSystem(Phaser.Physics.ARCADE);
        game.stage.backgroundColor = "3984db";
        game.physics.arcade.gravity.y = 1200;
        this.cursor = game.input.keyboard.createCursorKeys();

        this.mario = game.add.sprite(game.width / 2, game.height / 2, 'mario');
        this.mario.anchor.setTo(0.5,0.5);
        this.mario.scale.setTo(0.15,0.15);
        
        this.walls = game.add.group();
        this.walls.enableBody = true;
        this.walls.enableBody = true;
        
        this.downWallH = game.add.sprite(0, 540, 'WallH', 0, this.walls);
        this.leftWallW = game.add.sprite(0,0, 'WallW', 0, this.walls);
        this.rightWallW = game.add.sprite(822,0, 'WallW', 0, this.walls);
        
        game.physics.arcade.enable(this.mario);
        this.walls.setAll('body.allowGravity', false);
        this.walls.setAll('body.immovable', true);
        
        
    },
...

 

0W79gYZkdXo.jpg

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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