dernier commit de la journée
This commit is contained in:
parent
8081ccddf0
commit
16c23c0205
1 changed files with 48 additions and 3 deletions
51
canvas.js
51
canvas.js
|
@ -4,10 +4,20 @@ canvas = document.getElementById('canvas');
|
|||
function DrawGameCub(x, y){
|
||||
ctx = canvas.getContext('2d');
|
||||
const a = 10;
|
||||
ctx.fillStyle='brown';
|
||||
ctx.fillStyle='#DEB887';
|
||||
ctx.fillRect(x, y, a, a);
|
||||
ctx.save();
|
||||
}
|
||||
//fonction dessiner cube de bois avec img
|
||||
function imgDrawGameCub(x,y){
|
||||
ctx = canvas.getContext('2d');
|
||||
const dim = 100;
|
||||
let cubebois = new Image();
|
||||
cubebois.src = //lien de l'image;
|
||||
cubebois.addEventListener('load',function(){
|
||||
ctx.drawImage(cubebois,x,y,dim,dim);
|
||||
},false);
|
||||
}
|
||||
|
||||
//fonction pour dessiner des cercles du jeu
|
||||
function Drawcircle(x, y){
|
||||
|
@ -20,6 +30,16 @@ function Drawcircle(x, y){
|
|||
ctx.stroke();
|
||||
ctx.save();
|
||||
}
|
||||
//function pour dessiner des cercles à partir de l'image
|
||||
function imgDrawcircle(x,y){
|
||||
ctx = canvas.getContext('2d');
|
||||
const dim = 100;
|
||||
let circle = new Image();
|
||||
circle.src = //lien de l'image;
|
||||
circle.addEventListener('load',function(){
|
||||
ctx.drawImage(circle,x,y,dim,dim);
|
||||
},false);
|
||||
}
|
||||
|
||||
//fonction pour dessiner un cube du labyrinthe
|
||||
function DrawLabCub(){
|
||||
|
@ -44,9 +64,34 @@ function Mario(x, y){
|
|||
},false);
|
||||
}
|
||||
|
||||
//function généric qui dessine une image
|
||||
function DrawImg(That){
|
||||
ctx = canvas.getContext('2d');
|
||||
const dim = 20;
|
||||
let img= new Image();
|
||||
img.src = //lien de l'image;
|
||||
img.addEventListener('load',function(){
|
||||
ctx.drawImage(img,x,y,dim,dim);
|
||||
},false);
|
||||
ctx.save();
|
||||
}
|
||||
|
||||
//function qui met à jour le canvas
|
||||
function MajJeu(){
|
||||
|
||||
function MajJeu(Mat){
|
||||
while(true){
|
||||
ctx = canvas.getContext('2d');
|
||||
ctx.clearRect(0,0, canvas.width, canvas.height);
|
||||
let lignes= 0; // à définir plus tard
|
||||
let colones=0;// à définir plus tard
|
||||
for (let i=0; i< lignes; i++){
|
||||
for(let j=0; j< colones; j++){
|
||||
let obj = Mat[i][j];
|
||||
DrawImg(obj);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue