• Content count

  • Joined

  • Last visited

  1. knyaka

    Sprite movement direction

    This doesn't work because on load or create sprite initializes movement direction so if I try angle sprite it change movement direction too. var player function preload () { game.load.image('ship', '/mygame/assets/img/PNG/playerShip2_green.png') } function create () { player = game.add.sprite(,, 'ship') player.anchor.setTo(0.5) player.scale.setTo(0.5) player.angle = 90 // or player.rotation = Math.PI /2 } This turns sprite on keypress and don't change movement direction too Nevertheless, thank all for answers. I could find only two ways to change movement direction. 1: Change sprite orientation (rotate image before load) (I had to find another set of sprites ) 2: Add extra degrees on keypress rotation into update function. function update() { if (cursors.up.isDown) { game.physics.arcade.accelerationFromRotation(player.rotation + 300, 200, player.body.acceleration); } } But second is awful because I need to add this extra degrees to all child objects like bullets, turret and others ><.
  2. knyaka

    Sprite movement direction

    Hello, I'm new to Phaser and stuck with movement direction. I'm loaded spritesheet, added sprite with spaceship, made gameinput binding and pressed up to increase acceleration. All was fine, ship was moving, but.. he moved to the right and his head looking up , like this : (try to imagine: ship starts move and moves to the right without any rotation) So, that is the question: How can I rotate image on the 90 degrees or change movement direction from right to top? I tried to google it on some keyword variations: rotation, angle, movement direction. Tried to change keybindings. Tried to change sprite rotation and angle. Google did not give anything,keybindings, rotations same and I comes here with hope Spritesheet orientation: all sprites are looking up. I cannot rotate spritesheet because atlas will broke. Thank you in advance.