Jump to content

Search the Community

Showing results for tags 'asteroids-movement'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. Hello there! I'm working with this example (asteroids movement): LINK There is a strange behaviour that blows my brain out. It can be better seen on the attached video. All I've done was a small rotation and then just pressed UP cursor key. As you can see with the help of turned on debugger velocity vector rotates during fly until it reaches bottom-right corner of the bounding box. Also it force ship to fly wrong, it can be noticed even without debugger. Expected that velocity vector to be applied directly to where ship's nose is (or more correctly, ship have to move to the opposite side the engines work vector; see the picture). What can be the solution of this problems? Seems velocityFromRotation() function works not as expected. Or there is something been lost. Best regards, Nick Rimer 2019-11-01 12-02-08.mp4
  2. Hello, I'm now to Html5 game development (well game development in general not just html5) and phaser. I've decided on the phaser library because it gives me more control over the code and I find it more sustainable for me to know how things work. What I am looking for, is to make space games. Yes space game with player controlled ships, and for that I am experimenting with different types of controls. The easiest so far for me was to get a basic 8 direction movement(duh), which did not take long to make as everything was pretty straight forward. var game = new Phaser.Game(800, 600, Phaser.auto, 'phaser-example', { preload: preload, create: create, update: update, render: render }); var result = 'Press a key'; function preload() { //load assets game.load.image("shipbox", "/img/box.png"); } function create() { //Add keybinds pauseKey = game.input.keyboard.addKey(Phaser.Keyboard.P); UP = game.input.keyboard.addKey(Phaser.Keyboard.W); DOWN = game.input.keyboard.addKey(Phaser.Keyboard.S); RIGHT = game.input.keyboard.addKey(Phaser.Keyboard.D); LEFT = game.input.keyboard.addKey(Phaser.Keyboard.A); TURN_LEFT = game.input.keyboard.addKey(Phaser.Keyboard.Q); TURN_RIGHT = game.input.keyboard.addKey(Phaser.Keyboard.E); ship = game.add.group(); ship.create(200,200, 'shipbox'); ship.create(190,195, 'shipbox'); ship.create(190,205, 'shipbox'); ship.x = 200; ship.y = 200; ship.pivot.x = ship.x+ship.width/2; ship.pivot.y = ship.y+ship.height/2; } function update() { if (pauseKey.isDown){ result = "Paused"; }else if(RIGHT.isDown && UP.isDown){ ship.x +=1; ship.y -=1; result = "RIGHT+UP"; }else if(RIGHT.isDown && DOWN.isDown){ ship.x +=1; ship.y +=1; result = "RIGHT+DOWN"; }else if(LEFT.isDown && UP.isDown){ ship.x -=1; ship.y -=1; result = "LEFT+UP"; }else if(LEFT.isDown && DOWN.isDown){ ship.x -=1; ship.y +=1; result = "LEFT+DOWN"; }else if (RIGHT.isDown){ result = "RIGHT"; ship.x +=1; }else if (LEFT.isDown){ result = "LEFT"; ship.x -=1; }else if (UP.isDown){ result = "UP"; ship.y -=1; }else if (DOWN.isDown){ result = "DOWN"; ship.y +=1; }else if (TURN_LEFT.isDown){ result = "TURN LEFT"; ship.angle -=0.2; game.debug.text(ship.angle, 32, 64); }else if (TURN_RIGHT.isDown){ result = "TURN RIGHT"; ship.angle +=0.2; game.debug.text(ship.angle, 32, 64); }else { result = 'Press a key'; }; } function render(){ game.debug.text(result, 32, 32); } So with that out of the way I proceeded on doing asteroids movement, of which I found the asteriods movement example at http://phaser.io/examples/v2/arcade-physics/asteroids-movement ,and this brings me to my problem. I do not know if it's a software limitation or just me being new but when I try to use the same code but for a group all I get in return is a black screen. What I basically did was instead of : // Our player ship sprite = game.add.sprite(300, 300, 'ship'); sprite.anchor.set(0.5); I changed to // Our player ship sprite = game.add.group(); sprite.create(300, 300, 'ship'); sprite.create(290, 295, 'ship'); sprite.create(310, 305, 'ship'); My logic says this should be working, so why isn't it? I am trying to avoid using complicated math to calculate heading based on orientation and that's the reason for using the arcade physics. I was basically hoping for something along the lines of pressing "W" and the "ship group" moves forward (the forward direction based on current orientation angle). Any thoughts on this?
×
×
  • Create New...