(joystickIndex)
| 32 | shuffle(colorNames); |
| 33 | |
| 34 | function Player(joystickIndex) { |
| 35 | SDL.joystickOpen(joystickIndex); |
| 36 | players[joystickIndex] = this; |
| 37 | this.name = SDL.joystickName(joystickIndex); |
| 38 | var colorName = this.colorName = colorNames[joystickIndex % colorNames.length]; |
| 39 | var angle = 2 * Math.PI / numPlayers * joystickIndex; |
| 40 | this.x = Math.floor(Math.sin(angle) * 50 * (numPlayers - 1)) + screen.w / 2; |
| 41 | this.y = Math.floor(Math.cos(angle) * 50 * (numPlayers - 1)) + screen.h / 2; |
| 42 | this.jx = 0; this.jy = 0; |
| 43 | this.speed = 0.3; |
| 44 | console.log("New %s player using %s", colorName[0].toUpperCase() + colorName.substr(1), this.name); |
| 45 | } |
| 46 | Player.prototype.tick = function (delta) { |
| 47 | this.x += this.jx * delta * this.speed; |
| 48 | this.y += this.jy * delta * this.speed; |
nothing calls this directly
no outgoing calls
no test coverage detected