zero-to-mastery / ZTM-Quest

A fun little 2D top-down rpg where you can explore the world of zero-to-mastery. Be prepared for funny and serious content and of course, Bruno.
https://zero-to-mastery.github.io/ZTM-Quest/
27 stars 92 forks source link

added sprint/running to player #153

Closed hpatel292-seneca closed 1 month ago

hpatel292-seneca commented 1 month ago

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%."

zero-to-mastery-bot[bot] commented 1 month ago

🙏 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
zero-to-mastery-bot[bot] commented 1 month ago

🥳 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!

zero-to-mastery-bot[bot] commented 1 month ago

🙏 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
zero-to-mastery-bot[bot] commented 1 month ago

🙏 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
zero-to-mastery-bot[bot] commented 1 month ago

🙏 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