game: paddle can move
This commit is contained in:
parent
2bd0624100
commit
3dc07803eb
@ -47,23 +47,18 @@ class Game
|
|||||||
this.time = new Time();
|
this.time = new Time();
|
||||||
this.last_pos = null
|
this.last_pos = null
|
||||||
this._inited = false;
|
this._inited = false;
|
||||||
this._wall_drew = false;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sides(ctx)
|
draw_sides(ctx)
|
||||||
{
|
{
|
||||||
if (this._wall_drew !== true)
|
this.walls.forEach(wall => {
|
||||||
{
|
wall.draw(ctx);
|
||||||
this.walls.forEach(wall => {
|
});
|
||||||
wall.draw(ctx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.players.forEach(player => {
|
this.players.forEach(player => {
|
||||||
player.draw(ctx);
|
player.draw(ctx);
|
||||||
});
|
});
|
||||||
this._wall_drew = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
draw(ctx)
|
draw(ctx)
|
||||||
|
@ -48,7 +48,7 @@ export default class extends AbstractView
|
|||||||
this.my_player.update_paddle(this.keys_pressed);
|
this.my_player.update_paddle(this.keys_pressed);
|
||||||
this.draw();
|
this.draw();
|
||||||
this.game.time.new_frame();
|
this.game.time.new_frame();
|
||||||
clearInterval(loop_id);
|
//clearInterval(loop_id);
|
||||||
// 1 sec fps
|
// 1 sec fps
|
||||||
}, 1000 / 60);
|
}, 1000 / 60);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user