Last active
June 9, 2020 20:34
-
-
Save Srushtika/e229d98dbca3851ebc9c9099b592262f to your computer and use it in GitHub Desktop.
Code snippet 19 - For multiplayer space invaders article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startShipAndBullets() { | |
gameOn = true; | |
world = new p2.World({ | |
gravity: [0, -9.82], | |
}); | |
shipBody = new p2.Body({ | |
position: [shipX, shipY], | |
velocity: [calcRandomVelocity(), 0], | |
}); | |
world.addBody(shipBody); | |
startMovingPhysicsWorld(); | |
for (let playerId in players) { | |
startDownwardMovement(playerId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment