Why aren't my walls solid?

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.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.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);
        this.walls.setAll('body.allowGravity', false);
        this.walls.setAll('body.immovable', true);



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.