-
-
Notifications
You must be signed in to change notification settings - Fork 978
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
base: main
Are you sure you want to change the base?
new game: cat vs dog #1795
Conversation
Build checks have not completed. Possible reasons for this are:
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
} else { | ||
if (isGameStopped) { | ||
state = CatDog::State::Stopped; | ||
} else { | ||
state = CatDog::State::Prompt; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
if (isGameStopped) { | |
state = CatDog::State::Stopped; | |
} else { | |
state = CatDog::State::Prompt; | |
} | |
} | |
} else if (isGameStopped) { | |
state = CatDog::State::Stopped; | |
} else { | |
state = CatDog::State::Prompt; | |
} |
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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
#define HORIZON 18000 | ||
#define MIN_POWER 200 | ||
#define MAX_POWER 500 |
There was a problem hiding this comment.
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.
Classic 2000s game.
catdog-2023-07-08_00.02.03.mp4