Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed airdrop glitch #341

Merged
merged 5 commits into from
Jun 19, 2024
Merged

Fixed airdrop glitch #341

merged 5 commits into from
Jun 19, 2024

Conversation

hotDuckWhatsUp
Copy link
Contributor

The airdrops don't overlap anymore.

Now when an airdrop has landed it will check if its colliding with other airdrops and move.
The airdrop now checks if its colliding with any other airdrops and fixes its position.
Copy link
Contributor

@kenos1 kenos1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix these issues

@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> {
amount: Infinity,
source: crate
});
if (object.definition.idString == "airdrop_crate_locked" && object != crate){
var xDif = crate.position.x - object.position.x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use var

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead, use const

@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> {
amount: Infinity,
source: crate
});
if (object.definition.idString == "airdrop_crate_locked" && object != crate){
var xDif = crate.position.x - object.position.x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need xDif and yDif as we have a vector subtraction function

@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> {
amount: Infinity,
source: crate
});
if (object.definition.idString == "airdrop_crate_locked" && object != crate){
var xDif = crate.position.x - object.position.x
if (xDif <= 0){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please run pnpm lint to fix inconsistent spacing

@@ -70,6 +72,25 @@ export class Parachute extends BaseGameObject<ObjectCategory.Parachute> {
amount: Infinity,
source: crate
});
if (object.definition.idString == "airdrop_crate_locked" && object != crate){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking for idStrings is bad but this may be the only option so add a comment saying it is a hack

}
var position = Vec.create(xDif, yDif);
crate.hitbox = object.hitbox.transform(position);
crate.position = crate.hitbox.getCenter()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent semicolons, run pnpm lint

Copy link
Collaborator

@Err0r430 Err0r430 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linted, added comments. Does a small fix and works for me

@Err0r430
Copy link
Collaborator

Added

@Err0r430 Err0r430 closed this Jun 19, 2024
@Err0r430 Err0r430 reopened this Jun 19, 2024
@Err0r430 Err0r430 merged commit 960de41 into HasangerGames:master Jun 19, 2024
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants