add background
This commit is contained in:
parent
ebfa850e7c
commit
11141a114f
16
sketch.js
16
sketch.js
|
@ -8,6 +8,7 @@ let powerUps = [];
|
||||||
let deathZoneY = 600;
|
let deathZoneY = 600;
|
||||||
|
|
||||||
let spriteSheets = {};
|
let spriteSheets = {};
|
||||||
|
let background_sky;
|
||||||
|
|
||||||
function preload() {
|
function preload() {
|
||||||
// 여기에 sprite들을 preload (ex: mario = loadImage("..."))
|
// 여기에 sprite들을 preload (ex: mario = loadImage("..."))
|
||||||
|
@ -19,10 +20,23 @@ function preload() {
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
createCanvas(800, 600);
|
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() {
|
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);
|
fill(100);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user