Skip to content

Commit

Permalink
Merge pull request #71 from vs26625/main
Browse files Browse the repository at this point in the history
Team Level - Winter
  • Loading branch information
vs26625 authored May 9, 2024
2 parents 804b0c0 + 7732acf commit b979ae3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions assets/js/platformer3x/BackgroundNarwhal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import GameEnv from './GameEnv.js';
import Background from './Background.js';

export class BackgroundNarwhal extends Background {
constructor(canvas, image, data) {
super(canvas, image, data);

this.parallaxSpeed = 2;
}

// speed is used to background parallax behavior
update() {
this.speed = this.parallaxSpeed;
super.update();
}

draw() {
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);
super.draw();
}

}

export default BackgroundNarwhal;
3 changes: 3 additions & 0 deletions assets/js/platformer3x/GameSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import BackgroundMountains from './BackgroundMountains.js';
import BackgroundTransitions from './BackgroundTransitions.js';
import BackgroundClouds from './BackgroundClouds.js';
import BackgroundWinter from './BackgroundWinter.js';
import BackgroundNarwhal from './BackgroundNarwhal.js';
import BackgroundSnow from './BackgroundSnow.js';
import BackgroundFish from './BackgroundFish.js';
import Platform from './Platform.js';
Expand Down Expand Up @@ -297,6 +298,7 @@ const GameSetup = {
castles: { src: "/images/platformer/backgrounds/castles.png" },
winter: { src: "/images/platformer/backgrounds/winter.png" },
snow: { src: "/images/platformer/backgrounds/snowfall.png" },
narwhal: { src: "/images/platformer/backgrounds/narwhal.png" },
mini: { src: "/images/platformer/backgrounds/mini.png" },
},
transitions: {
Expand Down Expand Up @@ -897,6 +899,7 @@ const GameSetup = {
const winterObjects = [
// GameObject(s), the order is important to z-index...
{ name: 'winter', id: 'background', class: BackgroundWinter, data: this.assets.backgrounds.winter },
{ name: 'narwhal', id: 'background', class: BackgroundNarwhal, data: this.assets.backgrounds.narwhal },
{ name: 'snow', id: 'background', class: BackgroundSnow, data: this.assets.backgrounds.snow },
{ name: 'snowyfloor', id: 'platform', class: Platform, data: this.assets.platforms.snowyfloor },
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: this.assets.platforms.snowywood, xPercentage: 0.2, yPercentage: 0.82 },
Expand Down
Binary file added images/platformer/backgrounds/narwhal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b979ae3

Please sign in to comment.