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

added sprint/running to player #153

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

hpatel292-seneca
Copy link
Contributor

This fixes #142

The issue was to increase player speed by 25% if the player has 50% or higher energy and 10% if the player has less than 50% energy.

My solution is:

const speed =
            pressed.size === 1
                ? player.state.energy >= 50
                    ? player.speed * 1.25
                    : player.speed * 1.1
                : player.state.energy >= 50
                  ? player.speed * 0.707106781188095 * 1.25 // Dot product for diagonal movement 45%
                  : player.speed * 0.707106781188095 * 1.1;

I am checking the player's energy level, and if it is 50% or higher, I increase the speed by 25%. If the energy is less than 50%, I increase the speed by 10%."

Copy link

🙏 Thanks for your pull request @hpatel292-seneca, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
153 7 3
📑 Files Changed: Repo Stars: 🔱 Total Forks:
1 27 78

Copy link

🥳 Congratulations 🎉

Congrats on making your first Pull Request in the Zero To Mastery Organization!
You have been sent an invitation to join the ZTM github organization, please check your emails for further details!

ZTM Profile Badge

If you'd like the ZTM Badge to show up on your profile, you will need to follow this guide!

Copy link

🙏 Thanks for your pull request @hpatel292-seneca, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
153 7 3
📑 Files Changed: Repo Stars: 🔱 Total Forks:
1 27 78

Copy link

🙏 Thanks for your pull request @hpatel292-seneca, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
153 7 3
📑 Files Changed: Repo Stars: 🔱 Total Forks:
1 27 78

@hpatel292-seneca hpatel292-seneca marked this pull request as ready for review October 14, 2024 22:55
Copy link

🙏 Thanks for your pull request @hpatel292-seneca, The team will now review and merge this request. In the mean time why not check out some of the other opensource projects available, contributions are greatly appreciated!

Some of the most popular are


PR Statistics

#️⃣ PR Number: Line Additions: 🗑️ Line Deletions:
153 7 3
📑 Files Changed: Repo Stars: 🔱 Total Forks:
1 27 78

Copy link
Collaborator

@r4pt0s r4pt0s left a comment

Choose a reason for hiding this comment

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

🔥🔥🔥

@r4pt0s r4pt0s merged commit 7435555 into zero-to-mastery:main Oct 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sprint/running to player
2 participants