diff --git a/assets/js/platformer/GameSetterBossFight.js b/assets/js/platformer/GameSetterBossFight.js index 6d34602..7fab986 100644 --- a/assets/js/platformer/GameSetterBossFight.js +++ b/assets/js/platformer/GameSetterBossFight.js @@ -1,7 +1,7 @@ import Background from './Background.js' import BackgroundTransitions from './BackgroundTransitions.js'; import Platform from './Platform.js'; -import JumpPlatform2 from './PlatformJump2.js'; +//import JumpPlatform2 from './PlatformJump2.js'; import BlockPlatform from './BlockPlatform.js'; import Coin from './Coin.js'; import skibidiTitan from './SkibidiTitan.js'; diff --git a/assets/js/platformer/GameSetterSkibidi.js b/assets/js/platformer/GameSetterSkibidi.js index 1703c62..64001a9 100644 --- a/assets/js/platformer/GameSetterSkibidi.js +++ b/assets/js/platformer/GameSetterSkibidi.js @@ -1,7 +1,7 @@ import Background from './Background.js' import BackgroundTransitions from './BackgroundTransitions.js'; import Platform from './Platform.js'; -import JumpPlatform2 from './PlatformJump2.js'; +//import JumpPlatform2 from './PlatformJump2.js'; import BlockPlatform from './BlockPlatform.js'; import Coin from './Coin.js'; import skibidiTitan from './SkibidiTitan.js'; @@ -105,7 +105,7 @@ const assets = { island: { src: "/images/platformer/platforms/island.png" }, block: { src: "/images/platformer/platforms/brick_block.png" }, //MAY need 3 new variables: sizeRatio, widthRatio, and heightRatio - + /* itemBlock2: { //power-up src: "/images/platformer/sprites/jumppowerup.png", //spritesheet sizeRatio: 0.000000001, @@ -118,6 +118,7 @@ const assets = { hitbox: { widthPercentage: 0, heightPercentage: 0 } }, + */ }, backgrounds: { boss: { src: "/images/platformer/backgrounds/BossBackground.png", parallaxSpeed: 0.4, moveOnKeyAction: true }, @@ -510,7 +511,7 @@ const assets = { { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.7, yPercentage: 0.84 }, { name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.3, yPercentage: 0.4 }, ///{ name: 'coin', id: 'coin', class: Coin, data: assets.obstacles.vbucks, xPercentage: 0.475, yPercentage: 0.5 }, - { name: 'itemBlock2', id: 'jumpPlatform', class: JumpPlatform2, data: assets.platforms.itemBlock2, xPercentage: 0.56, yPercentage: 0.8 }, //item block is a platform + // { name: 'itemBlock2', id: 'jumpPlatform', class: JumpPlatform2, data: assets.platforms.itemBlock2, xPercentage: 0.56, yPercentage: 0.8 }, //item block is a platform //{ name: 'itemBlock2', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.itemBlock2, xPercentage: 0.56, yPercentage: 0.8 }, //item block is a platform { name: 'coin', id: 'coin', class: Coin, data: assets.obstacles.coin, xPercentage: 0.35, yPercentage: 0.85 }, { name: 'coin', id: 'coin', class: Coin, data: assets.obstacles.coin, xPercentage: 0.3, yPercentage: 0.34 }, diff --git a/assets/js/platformer/PlatformJump2.js b/assets/js/platformer/PlatformJump2.js deleted file mode 100644 index 654b300..0000000 --- a/assets/js/platformer/PlatformJump2.js +++ /dev/null @@ -1,73 +0,0 @@ -import GameControl from './GameControl.js'; -import GameEnv from './GameEnv.js'; -import GameObject from './GameObject.js'; - -export class JumpPlatform2 extends GameObject { // Created new class for the power-up collision. File allows the object to be collected like the coin - constructor(canvas, image, data, xPercentage, yPercentage, name) { - super(canvas, image, data); - this.platformX = xPercentage * GameEnv.innerWidth; - this.platformY = yPercentage; - this.data = data; - this.name = name; - this.relativeX = ""; //used for the item block's spritesheet. - - } - - // Required, but no update action - update() { - this.collisionChecks(); - //this.movePlatform(); it break the collision event, so I suggest to move this function to BlockPlaform - } - - - - collisionAction() { - // Collision only applies to the item block when Mario collides with it - if (this.collisionData.touchPoints.other.id === "player" && this.name === "itemBlock2") { - this.handleItemBlockCollision(); - } - } - - handleItemBlockCollision() { - // Make the item block disappear by hiding it - this.isVisible = false; - // Update status of key - GameEnv.powerUpCollected = true - console.log("Power-up collected!") - // Remove the block from the display - this.canvas.style.display = 'none'; - } - - // Set platform position - size() { - // Formula for Height should be on constant ratio, using a proportion of 832 - const scaledHeight = GameEnv.innerHeight * (this.data.sizeRatio / 82); - const scaledWidth = GameEnv.innerHeight * .1; // width of jump platform is 1/10 of height - const platformX = this.platformX - const platformY = (GameEnv.bottom - scaledHeight) * this.platformY; - this.x = platformX - this.y = platformY - - // set variables used in Display and Collision algorithms - this.bottom = platformY; - this.collisionHeight = scaledHeight; - this.collisionWidth = scaledWidth; - - //this.canvas.width = this.width; - //this.canvas.height = this.height; - this.canvas.style.width = `${scaledWidth}px`; - this.canvas.style.height = `${scaledHeight}px`; - this.canvas.style.position = 'absolute'; - this.canvas.style.left = `${platformX}px`; - this.canvas.style.bottom = `${platformY}px`; - } - - // Draw position is always 0,0 - draw() { - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - this.ctx.drawImage(this.image, 0, 0, this.canvas.width / this.data.widthRatio, this.canvas.height / this.data.heightRatio); - } - -} - -export default JumpPlatform2; \ No newline at end of file diff --git a/assets/js/platformer/PlayerSkibidi.js b/assets/js/platformer/PlayerSkibidi.js index 2bbfc6f..28701ab 100644 --- a/assets/js/platformer/PlayerSkibidi.js +++ b/assets/js/platformer/PlayerSkibidi.js @@ -71,7 +71,7 @@ export class PlayerSkibidi extends PlayerBaseOneD { this.handleCollisionEvent("finishline"); this.handleCollisionEvent("SkibidiToilet"); this.handleCollisionEvent("laser"); - this.handleCollisionEvent("powerup"); // created a new case where it detects for collision between player and power-up + //this.handleCollisionEvent("powerup"); // created a new case where it detects for collision between player and power-up } handleDeath() {