mirror of
https://github.com/microsoft/Web-Dev-For-Beginners.git
synced 2025-08-30 01:50:19 +02:00
folder names
This commit is contained in:
24
6-space-game/2-drawing-to-canvas/your-work/app.js
Normal file
24
6-space-game/2-drawing-to-canvas/your-work/app.js
Normal file
@@ -0,0 +1,24 @@
|
||||
function loadTexture(path) {
|
||||
return new Promise((resolve) => {
|
||||
const img = new Image();
|
||||
img.src = path;
|
||||
img.onload = () => {
|
||||
resolve(img);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function createEnemies(ctx, canvas, enemyImg) {
|
||||
// TODO draw enemies
|
||||
}
|
||||
|
||||
window.onload = async () => {
|
||||
canvas = document.getElementById('canvas');
|
||||
ctx = canvas.getContext('2d');
|
||||
// TODO load textures
|
||||
|
||||
// TODO draw black background
|
||||
// TODO draw hero
|
||||
// TODO uncomment the next line when you add enemies to screen
|
||||
//createEnemies(ctx, canvas, enemyImg);
|
||||
};
|
Reference in New Issue
Block a user