NotKawaiiGirl Posted April 23, 2018 Share Posted April 23, 2018 (edited) Hello! I'm working in a game that use physics like asteroids, the arcades game, but i'm having trouble making "the ship" to move. I'm using whatever sprites I found for testing, so right now the ship is the guy from the first official tutorial in the page of Phaser 3. TL;DR How do I use velocityFromRotation() work for my sprite. I've read the documentation but I just don't get it. Thank you, btw. I put here the code. For now, "the ship" is called "dude". game.js Edited April 23, 2018 by NotKawaiiGirl I uploaded the wrong file Link to comment Share on other sites More sharing options...
samme Posted April 24, 2018 Share Posted April 24, 2018 See line 216 http://labs.phaser.io/edit.html?src=src\physics\arcade\space.js. You can use either sprite.body.velocity or sprite.body.acceleration for the vector argument. NotKawaiiGirl 1 Link to comment Share on other sites More sharing options...
NotKawaiiGirl Posted April 26, 2018 Author Share Posted April 26, 2018 Thank you very much! Now i've the movement i wanted. Now I'm having trouble with socket.io, because when I get information from the server and want to use it to create sprites/images I don't know how to do it. I'm not sure about how the scenes work and when i try to use this.physics.add.sprite outsite of preload-create-update it says there is not such thing. I'm attaching the server and client files in this post. If anyone can suggest a way of creating the sprites/images outside the basic scenes (So i can use the data obtained from the server) I would really appreciate. THANK YOU! game.js server.js Link to comment Share on other sites More sharing options...
Recommended Posts