player
This commit is contained in:
parent
1dd378518b
commit
6ad927571a
3 changed files with 9 additions and 2 deletions
BIN
assets/body.png
Normal file
BIN
assets/body.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 968 B |
4
game.js
4
game.js
|
@ -3,5 +3,7 @@ setInterval(game);
|
||||||
function game() {
|
function game() {
|
||||||
Renderer = new Render("canvas")
|
Renderer = new Render("canvas")
|
||||||
|
|
||||||
Renderer.AddPlayer(3, 5, )
|
let rubiks = new Player(1, 100, 50, "rubiks")
|
||||||
|
console.log(rubiks)
|
||||||
|
Renderer.AddPlayer(rubiks)
|
||||||
}
|
}
|
|
@ -2,13 +2,18 @@ class Render {
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.canvas = document.getElementById(id)
|
this.canvas = document.getElementById(id)
|
||||||
this.ctx = canvas.getContext("2d")
|
this.ctx = canvas.getContext("2d")
|
||||||
|
this.players = []
|
||||||
this.ReloadAff()
|
this.ReloadAff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddPlayer(id, pseudo, x, y, angle) {
|
||||||
|
this.players[id] = (id, pseudo, x, y, angle)
|
||||||
|
}
|
||||||
|
|
||||||
ReloadAff() {
|
ReloadAff() {
|
||||||
this.ctx.fillStyle = "red"
|
this.ctx.fillStyle = "red"
|
||||||
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
|
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
|
||||||
|
|
||||||
/*this.ctx.stokeStyle = "black"
|
/*this.ctx.stokeStyle = "black"
|
||||||
this.ctx.lineWidth = 1;
|
this.ctx.lineWidth = 1;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
|
Loading…
Reference in a new issue