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

Incorporate certain object dynamics #2846

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

weluvgoatz
Copy link
Member

@weluvgoatz weluvgoatz commented Mar 25, 2024

For my 100th PR, I decided to fix some old issues I had involving the dynamics between some objects. Included in this PR are the following:

  • Rocks no longer hurt Tux and bounce off of him, making rock puzzles more fair.
  • Rocks now interact as expected with slick ice, water, bumpers, and trampolines.
  • Enemies now interact as expected with water, bumpers, and trampolines.
  • Objects oriented to the side (switches, darttraps, bumpers, stalactites, yeti stalactites, pushbuttons, ispys, and shards) now properly stick to moving objects which look like they can be stuck to (moving tilemaps, platforms, and fallblocks). [Fixes Implement objects sticking to solids #1782]

Note: I was hoping to incorporate some more general method for point 4, where I didn't have to specify every single interaction and I could just label some objects as "sticky" and "sticked" objects, but this proved to be difficult as I don't think the game is currently capable of describing objects in such a way that I could do that, and I did not want to spend this PR refactoring some part of the game just to include that little thing. Each of the different possible interactions tends to have to some slight variation from one another, and there aren't very many of these possible interactions, anyway.

@weluvgoatz weluvgoatz added type:feature status:needs-review Work needs to be reviewed by other people labels Mar 25, 2024
@Narre
Copy link
Contributor

Narre commented Mar 25, 2024

Not sure about the consistency of this behaviour. Also, the objects should probably only move with the tilemap/fallblock/... that's behind them to avoid situations like on the right side in the first video.

dynamics-2024-03-25_11.52.56.mp4

Also, this completely breaks this level (there are many more switches like this in it) and pretty much any level that has a lift controlled by a switch.

dynamics2-2024-03-25_11.54.44.mp4

@bruhmoent
Copy link
Member

Maybe objects should have the ability to be immovable

@VincentAraneo
Copy link

In my personal opinion, this idea is great. It would serve a lot in puzzle levels. An idea like that wouldn't be bad, you could make more creative levels with that idea

@tylerandari13
Copy link
Contributor

Also, this completely breaks this level (there are many more switches like this in it) and pretty much any level that has a lift controlled by a switch.

Not gonna lie this looks sick. I understand its technically broken but this would be a really cool thing to play around with.

Maybe objects should have the ability to be immovable

I agree, like an "immobile" option on the objects.

@tobbi
Copy link
Member

tobbi commented Apr 13, 2024

That is a lot of code duplication. Can this be done in other ways so we only have the same code once?

@weluvgoatz
Copy link
Member Author

That is a lot of code duplication. Can this be done in other ways so we only have the same code once?

I tried to find ways around it, but it appears the way each object is handled is done differently in such a way that at least I couldn't personally get it to work.

@tobbi
Copy link
Member

tobbi commented Apr 14, 2024

How about moving this to a parent GameObject BadGuy class method?

@tylerandari13
Copy link
Contributor

Are stalactites/yeti stalactites also sticky objects? And if not can they be?

@weluvgoatz
Copy link
Member Author

How about moving this to a parent GameObject BadGuy class method?

Now I am probably going to refactor the PR with this is mind.

- Rocks now interact with bumpers, water, slick ice, and trampolines.
- Rocks no longer hurt Tux.
- Now badguys can interact with bumpers, trampolines, and water.
Fixed a bug where if you threw a rock at a bumper on a moving platform it would reset to original position.
Copy link
Member

@Vankata453 Vankata453 left a comment

Choose a reason for hiding this comment

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

Functionality-wise, this seems to work really well!

Left some code-related comments.

src/object/bumper.cpp Outdated Show resolved Hide resolved
src/badguy/stalactite.cpp Outdated Show resolved Hide resolved
src/badguy/darttrap.cpp Outdated Show resolved Hide resolved
src/object/bumper.cpp Outdated Show resolved Hide resolved
src/object/bumper.hpp Outdated Show resolved Hide resolved
src/object/sticky_object.hpp Show resolved Hide resolved
src/trigger/switch.cpp Outdated Show resolved Hide resolved
src/object/sticky_object.cpp Outdated Show resolved Hide resolved
src/object/sticky_object.hpp Outdated Show resolved Hide resolved
src/object/shard.cpp Outdated Show resolved Hide resolved
Copy link
Member

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

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

Interesting, Dart traps don't shoot if too close to a platform, but if you put them a little bit far apart they do.

2024-04-28.16-05-28.mp4

@@ -147,11 +154,12 @@ DartTrap::get_settings()

result.add_float(_("Initial delay"), &m_initial_delay, "initial-delay");
result.add_bool(_("Enabled"), &m_enabled, "enabled", true);
result.add_bool(_("Sticky"), &m_sticky, "sticky", false);
Copy link
Member

Choose a reason for hiding this comment

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

Don't you think this sticky setting can be moved to the superclass?

Copy link
Member

Choose a reason for hiding this comment

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

I thought the same, but turns out that for some objects it should be configurable, but for others - not.

Copy link
Member

Choose a reason for hiding this comment

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

you can use result.remove for those that shouldnt be configurable

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's also a way.

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

Successfully merging this pull request may close these issues.

Implement objects sticking to solids
10 participants