Skip to content

Conversation

@Davidek523
Copy link
Collaborator

Pull Request Template

Type of Pull Request

Only check one box per pull request.

  • πŸ› οΈ Code - Changes to the codebase.
  • πŸ”„ Revert - Reverts a previously merged commit or PR.
  • πŸ“„ Documentation - Updates to documentation files.
  • 🎡 Audio - Changes to audio files.
  • 🎨 Asset - Updates to design or visual assets.

Summary

This PR adds obstacles objects to the game. Now when the player comes in contact with such a object, the player will receive damage and on the screen it will be shown how much!

Related Issues

This PR closes issue(s) #120


βœ… Checklist:

  • Tested the changes locally.
  • Verified that no breaking changes are introduced.
  • Updated documentation (if applicable).

🏷️ Labels:

type: ..., area: ..., game-..., ...

Davidek523 added 11 commits May 26, 2025 14:14
Added:
- new state for obstacles
- state methods within this class
Added:
- obstacles to the map
- in setup drew the obstacles onto the map
- in obstacle state added logic for collision
Fixed:
- in game running:
Typo from the imported class
- obstacle state:
logical issues with collision
Changed:
- Removed the object state from states and refactored it to not use state anymore
- Changed file name and the file place
Called:
- object handler in game running
Fixed:
- issue where message of dealing damage was not showing up
Changed:
- commentend display flip method in object handler to save frames
Changed:
- the black block for the message transparent
Changed:
- the color of the message
Small fix groups
Fixed all the typehints
Copy link
Collaborator

@ultimateownsz ultimateownsz left a comment

Choose a reason for hiding this comment

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

Hi, since there is no objective for the player yet, I think what could work with the collisions is that is the player health < 0, that it will reset the player's position to the starting position.
image


Also, I think it could be helpful if you make it that you see the player getting a white border or flashing sprite that it shows to the player that you hit an object, because now it is static, and the drawing order could be different, so the player's (rectangle for now) behind the obstacle, instead of over the obstacle.
image

Fixed:
- Health going infinitly low
Added:
- a flashing effect when the player gets hurt by the obstacles
Changed:
- the location of the dt from the handler to the game loop
Fixed:
- Flash not working properly
Removed:
- unnecessary delta time
Finished:
- when the player comes in contact with a obstacle the rect will flash
Added:
- when the player reaches 0 health, he will respawn at the start position with the maximum amount of health
Fixed:
- typehint issues
@Davidek523 Davidek523 requested a review from ultimateownsz June 2, 2025 12:08
@Davidek523
Copy link
Collaborator Author

Addressed the issues that you mentioned! Could you take a look?

@ultimateownsz
Copy link
Collaborator

ultimateownsz commented Jun 2, 2025

It's looking good, could you also add the collision with islands? And make the flashing player hit only when it's bein hit and not constantly?

Fixed:
- constant flashing when the player stays on the obstacle.
Changed:
- the file name to object_manager
- class name to ObjectManager
- as requested
@Davidek523
Copy link
Collaborator Author

Fixed the issues you we're talking about and also changed the name of the file and the class as requested! Everything works, no bugs!

Copy link
Collaborator

@ultimateownsz ultimateownsz left a comment

Choose a reason for hiding this comment

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

Looking good, it all works. Before I forget, I would only want you to add unit tests since your obstacle_manager is a new feature for the project. Do this and your code can be merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants