add background

This commit is contained in:
Joowon Kim 2025-04-24 03:38:49 +09:00
parent ebfa850e7c
commit 11141a114f

View File

@ -8,6 +8,7 @@ let powerUps = [];
let deathZoneY = 600;
let spriteSheets = {};
let background_sky;
function preload() {
// 여기에 sprite들을 preload (ex: mario = loadImage("..."))
@ -19,10 +20,23 @@ function preload() {
function setup() {
createCanvas(800, 600);
const bgsource = spriteSheets.backgorunds;
background_sky = createImage(400,300);
background_sky.copy(bgsource,
514, 1565,
512, 512,
0, 0,
400,300);
}
function draw() {
background(135, 206, 235); // sky blue
for (let y = 0; y < height; y += background_sky.height) {
for (let x = 0; x < width; x += background_sky.width) {
image(background_sky, x, y);
}
}
// 임시 바닥
fill(100);