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

new game: cat vs dog #1795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

new game: cat vs dog #1795

wants to merge 1 commit into from

Conversation

Boteium
Copy link

@Boteium Boteium commented Jul 7, 2023

Classic 2000s game.

catdog-2023-07-08_00.02.03.mp4

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Build checks have not completed. Possible reasons for this are:

  1. The checks need to be approved by a maintainer
  2. The branch has conflicts
  3. The firmware build has failed

@FintasticMan FintasticMan added the new app This thread is about a new app label Jul 13, 2023
Copy link
Contributor

@minacode minacode left a comment

Choose a reason for hiding this comment

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

Found some small things. There are a lot of magic numbers that could benefit a lot from being either documented better or (even better) calculated so we know where they are coming from and they must not be hand-tuned again in case of later code changes.

Overall nice game though 😊

@@ -383,6 +384,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/ApplicationList.cpp
displayapp/screens/Notifications.cpp
displayapp/screens/Twos.cpp
displayapp/screens/CatDog.cpp
Copy link
Contributor

Choose a reason for hiding this comment

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

You are adding this file twice (see line 371)

@@ -7,7 +7,7 @@
},
{
"file": "FontAwesome5-Solid+Brands+Regular.woff",
"range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf743"
Copy link
Contributor

Choose a reason for hiding this comment

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

Which icon (0xf743) gets removed here and why?

Comment on lines +78 to +84
} else {
if (isGameStopped) {
state = CatDog::State::Stopped;
} else {
state = CatDog::State::Prompt;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else {
if (isGameStopped) {
state = CatDog::State::Stopped;
} else {
state = CatDog::State::Prompt;
}
}
} else if (isGameStopped) {
state = CatDog::State::Stopped;
} else {
state = CatDog::State::Prompt;
}

Comment on lines +144 to +149
if (boneY >= HORIZON || boneX > 24000 || boneX < -2400) {
if (-2400 < boneX && boneX < 24000) {
if (isDogsTurn) {
handleDamage(abs(boneX - 21500) / 100);
} else {
handleDamage(abs(boneX - 500) / 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are all those magic numbers coming from? Can we replace them by a variable with a good name and constexpr?

boneX = 500;
boneVY -= 25 * speed / 10;
} else {
// 100*(240-BONE_SIZE-5)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is better to turn this into a constexpr instead.

Comment on lines +9 to +11
#define HORIZON 18000
#define MIN_POWER 200
#define MAX_POWER 500
Copy link
Contributor

Choose a reason for hiding this comment

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

We try to avoid the preprocessor when possible. This can be a constexpr as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new app This thread is about a new app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants