CyberLord09 / CSSE1_Final

MIT License
0 stars 0 forks source link

Triangle#1 PullRequest#1 Explanation #4

Open CyberLord09 opened 3 months ago

CyberLord09 commented 3 months ago

Enemies Issues Fix

Our Fixes for Issues relating to Enemies in the Mario Game.

Fix Issues with Flying Goomba

As explained in the previous issue, the flying Goomba wasn't actually flying and the starting positions were messed up. To fix this, we edited the following code.


In GameSetup.js

{ name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.6, minPosition:  0.05 },
{ name: 'flyingGoomba', id: 'flyingGoomba', class: FlyingGoomba, data: this.assets.enemies.flyingGoomba, xPercentage:  0.35, minPosition: 0.3 }

These lines fix the initial X position of the Goomba so that they aren't stuck behind the pipe.


In GameSetup.js

{ name: 'goomba', id: 'goomba', class: Goomba, data: this.assets.enemies.goomba, xPercentage: 0.3, minPosition: 0.07}

This changes the minimum position of the Goomba so that it doesn't kill the player off spawn.


In FlyingGoomba.js

this.y = followPlayer(this.y, 0.1 * GameEnv.innerHeight, 0.02);

We changed the 0.04 to 0.02, so that the Flying Goomba spawns higher, making the Flying Goombas actually fly.


Overall, these changes ensure that the Flying Goomba is working properly, and behaving like a flying object.