LaaW

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hi, I started making simple pong like game in phaser but i don't really want to use any tutorial step by step so i started making game, when i try to make movement for paddle i saw first problem. My paddle don't move and completely i have no idea why. Anybody can show me what's i'm doing wrong? There is a main file with js //this game will have only 1 state var GameState = { //load the game assets before the game starts preload: function() { //adding sprites this.load.image('ball','assets/images/ball.png'); this.load.image('paddle','assets/images/paddle.png'); }, //executed after everything is loaded create: function() { //adding background game.stage.backgroundColor = '#d3de33'; //adding ball ball = this.game.add.sprite(game.world.centerX,game.world.centerY,'ball'); ball.scale.setTo(0.1); //adding paddles paddleLeft = this.game.add.sprite(5, game.world.centerY, 'paddle'); paddleLeft.anchor.setTo(0.5,0.5); paddleRight = this.game.add.sprite(795, game.world.centerY, 'paddle'); paddleRight.anchor.setTo(0.5,0.5); //paddle movemment if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { paddleLeft.x -= 50; } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { paddleLeft.y += 50; }; }, update: function() { }, render(){ //render paddles game.debug.spriteInfo(paddleLeft, 20, 32); } }; //initiate the Phaser framework var game = new Phaser.Game(800, 600, Phaser.AUTO); game.state.add('GameState', GameState); game.state.start('GameState'); pong.rar