Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
XerusN committed Dec 6, 2024
2 parents 3a1c3fb + f48c61e commit cc3cb2a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 2 deletions.
Binary file removed assets/kelp2.webp
Binary file not shown.
Binary file added assets/kelp3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/kelp3.webp
Binary file not shown.
Binary file added assets/kelp4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/kelp4.webp
Binary file not shown.
Binary file added assets/kelp5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion ground.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ let groundStuff = [];
export async function initKelp(screen) {
const kelpTexture = await PIXI.Assets.load('./assets/kelp.png');
const kelpTexture2 = await PIXI.Assets.load('./assets/kelp2.png');
const kelpTexture3 = await PIXI.Assets.load('./assets/kelp3.png');
const kelpTexture4 = await PIXI.Assets.load('./assets/kelp4.png');
const kelpTexture5 = await PIXI.Assets.load('./assets/kelp5.png');
const coralTexture = await PIXI.Assets.load('./assets/corail1.png');
const coralTexture2 = await PIXI.Assets.load('./assets/corail2.png');
const treesTexture = await PIXI.Assets.load('./assets/trees.png');
Expand Down Expand Up @@ -33,7 +36,23 @@ export async function initKelp(screen) {
} else if (-20 <= heightmap[i] && heightmap[i] <= -10) {
randomTexture = Math.random() > 0.5 ? coralTexture : coralTexture2;
} else {
randomTexture = Math.random() > 0.5 ? kelpTexture : kelpTexture2;
switch (Math.floor(Math.random() * 5)) {
case 0:
randomTexture = kelpTexture;
break;
case 1:
randomTexture = kelpTexture2;
break;
case 2:
randomTexture = kelpTexture3;
break;
case 3:
randomTexture = kelpTexture4;
break;
case 4:
randomTexture = kelpTexture5;
break;
}
}
const stuff = new PIXI.Sprite(randomTexture);
stuff.width = 40;
Expand Down
2 changes: 1 addition & 1 deletion world.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function drawWorld(screen, heightmap) {
// Sky gradient
const skyGradient = new PIXI.Graphics();
skyGradient.beginFill(0x87CEEB)
.drawRect(0, -1000, heightmap.length * 20, 1000)
.drawRect(0, -1000, heightmap.length * 20, 2000)
.endFill();
screen.addChild(skyGradient);

Expand Down

0 comments on commit cc3cb2a

Please sign in to comment.