COMMIT ACADEMY
الذهاب إلى القناة على Telegram
Formations en OR relatives au numerique : Programmation Informatique, Infographie, Sécurité informatique , Marketing Digital et Bureautique. By @C0MM1T
إظهار المزيد684
المشتركون
لا توجد بيانات24 ساعات
لا توجد بيانات7 أيام
لا توجد بيانات30 أيام
أرشيف المشاركات
if(D=='ArrowUp'){move();Y[0]--;}
if(D=='ArrowDown'){move();Y[0]++;}
if(D=='ArrowRight'){move();X[0]++;}
if(D=='ArrowLeft'){move();X[0]--;}
Ce code permet au serpent de se deplacer.
if (X[0]==x && Y[0]==y){
L++;
while(p==0){
x=rand(),y=rand();p=1;
for (i=0; i<=L; i++){
if(x==X[i] && y==Y[i]) p=0;
}
}
}
p=0;
}
ce code attribut a la case d'or une nouvelle position libre à chaque fois que le serpent la touche, devenant ainsi plus longLes carrés qui sont tacés ne séfacent pas tous seuls quand le serpent se deplace. Pour les effacer il faut utiliser :
context.clearRect(PosX, PosY, tailleX, tailleY
);Si on ne le fais pas, le serpent va paraître toujours plus long en se déplaçant (sans avoir a toucher la case d'orée)
Pour tracer un carré, il faut utiliser :
context.fillRect(position_x, position_y, taille_x, taille_y);
Dans ce code les cases étaient de 50x50 (taille) et bien sûr les positions changeaient avec le temps.en canvas pour choisir la couleur des elements on utilise la fonction
context.fillStyle = "...";
il faut remplacer les points par un nom de couleur en anglais (dans ce code j'ai utilisé gold, green et black)NOUS LANCERONS DES FORMATIONS GRATUITES POUR TOUS CES DERNIERS MOIS DE L'ANNÉE.
MANIFESTEZ VOTRE INTÉRÊT 👍
À PARTIR D'OCTOBRE NOUS REPRENONS LES ACTIVITÉS ET NOUS PUBLIERONS RÉGULIÈREMENT.
MANIFESTEZ VOTRE SOUTIEN SVP🙏
Repost from N/a
NOTRE NOUVEAU CANAL CINÉMA POUR VOUS. DÉCOUVREZ ET REGARDEZ TOUS VOS FILMS, SÉRIES ET ANIMATIONS EN HD FR ET GRATUITEMENT DÈS LEUR SORTIE 👇
https://t.me/+iKRQ2Nd7YDQyNjI0
Repost from CINÉ UNIVERSE
💥DU NOUVEAU POUR VOUS :
BÉNÉFICIEZ DE TOUTES LES CHAÎNES EN ILLIMITÉ SUR TOUS VOS APPAREILS
(Télévision, Ordinateur, Smartphone)
Nous vous offrirons un test limité pour apprécier le service.
Pour prendre votre abonnement
👇🏽
@UniversTVPro
