-
Notifications
You must be signed in to change notification settings - Fork 258
Add defeated animation when caught in stealth level #551
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
Conversation
f68e931 to
a7e7ddf
Compare
manuq
left a comment
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 would like to give this a try myself.
| COZY, | ||
| ## Player is engaged in combat. Player can use combat actions. | ||
| FIGHTING, | ||
| CAUGHT |
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 wonder if this really has to be a new player mode. For the stealth game the player is "cozy". The only thing that's needed when caught is to play an animation, and stop handling player input.
| return instant_detection_area.get_overlapping_bodies().front() | ||
| for body in instant_detection_area.get_overlapping_bodies(): | ||
| if body is Player and not body.caught: | ||
| return body |
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.
Why has this changed? It is not explained.
| var player: Node2D = detection_area.get_overlapping_bodies().front() | ||
| for body in detection_area.get_overlapping_bodies(): | ||
| if body is Player and not body.caught: | ||
| if not _is_sight_to_point_blocked(body.global_position): | ||
| return body |
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.
Same here, I wonder why this change is needed.
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.
Hi! I changed this because, to allow defeat animations to play, I could no longer rely on PROCESS_MODE_DISABLED to stop everything. This created a problem: if one guard detected the player and others saw them in the area, multiple guards would trigger alerts for an already detected player.
Iterating through all the overlapping bodies might seem unnecessary if only the player should be in that detection layer, but I added this logic as a safety precaution. If someone accidentally adds another node to the detection layer or group, this prevents errors such as trying to access .caught in a scene that doesn't define it
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.
Thanks for the explanation @Arebuayon !
|
Converting this PR to draft while I iterate on it. |
a7e7ddf to
7ab6152
Compare
|
Superseded by #654 |
No description provided.