pnj
This commit is contained in:
parent
8f337c1960
commit
b7e546c67f
2 changed files with 26 additions and 30 deletions
|
@ -1,31 +1,3 @@
|
|||
let cars = [new Car(renderer, 0, 0),
|
||||
new Car(renderer, 0, 7),
|
||||
new Car(renderer, 1, 7),
|
||||
new Car(renderer, 1, 13),
|
||||
new Car(renderer, 1, 14),
|
||||
new Car(renderer, 0, 15)];
|
||||
|
||||
|
||||
|
||||
|
||||
PNJS.push(new PNJ(500, 100));
|
||||
PNJS.push(new PNJ(700, 100));
|
||||
PNJS.push(new PNJ(500, 600));
|
||||
PNJS.push(new PNJ(200, 700));
|
||||
|
||||
function updateBullets(dt)
|
||||
{
|
||||
for(let i = bullets.length-1;i>=0;i--)
|
||||
{
|
||||
bullets[i].update(dt);
|
||||
bullets[i].checkCollisions(squares,circles);
|
||||
if(bullets[i].deleted)
|
||||
{
|
||||
bullets.splice(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let dt = 1.;
|
||||
let currentTime = new Date();
|
||||
function game() {
|
||||
|
|
|
@ -9,7 +9,18 @@ let inp = new Input("canvas");
|
|||
let bullets = [];
|
||||
let circles = [];
|
||||
let squares = [];
|
||||
let PNJS = [];
|
||||
let PNJS = [new PNJ(500, 100),
|
||||
new PNJ(700, 100),
|
||||
new PNJ(500, 600),
|
||||
new PNJ(200, 700)];
|
||||
|
||||
let cars = [new Car(renderer, 0, 0),
|
||||
new Car(renderer, 0, 7),
|
||||
new Car(renderer, 1, 7),
|
||||
new Car(renderer, 1, 13),
|
||||
new Car(renderer, 1, 14),
|
||||
new Car(renderer, 0, 15)];
|
||||
|
||||
|
||||
function updatePlayer(data)
|
||||
{
|
||||
|
@ -62,4 +73,17 @@ function addKill(idKilled,idKiller)
|
|||
if(p.id==idKiller)
|
||||
p.kill++;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateBullets(dt)
|
||||
{
|
||||
for(let i = bullets.length-1;i>=0;i--)
|
||||
{
|
||||
bullets[i].update(dt);
|
||||
bullets[i].checkCollisions(squares,circles);
|
||||
if(bullets[i].deleted)
|
||||
{
|
||||
bullets.splice(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue