landgreen / n-gon

2-d physics rogue-lite platformer shooter
https://landgreen.github.io/n-gon/
GNU General Public License v3.0
151 stars 222 forks source link

bug #306

Closed Whyisthisnotavalable closed 2 weeks ago

Whyisthisnotavalable commented 3 weeks ago

max difficulty with mass-energy equivalence makes the health bar appear but is empty

Whyisthisnotavalable commented 3 weeks ago

Pausing with the no healthbar constraint also makes it appear

landgreen commented 2 weeks ago

thanks, this is fixed in next patch.

landgreen commented 2 weeks ago

by the way, next patch is gonna be cool. I finally figured out how to flip the player upside down. So I'm making a level around that mechanic.

Whyisthisnotavalable commented 2 weeks ago

can't wait to see how it was done

kgurchiek commented 2 weeks ago

ooh that sounds really cool

LexLeethorMain commented 2 weeks ago

gravity flipping on a level would be cool, and a junk teck to flip gravity every 5 seconds would be funny

landgreen commented 2 weeks ago

The way I'm doing it is to flip the camera, which is just one line of code, and then about 60 lines of code to remove and reposition every element of the map from the bottom to the top. So I didn't have to rewrite any physics, but it feels completely authentic.

https://github.com/user-attachments/assets/1b6f4b69-1c6b-4bdd-997e-441f58b87dfa

kgurchiek commented 2 weeks ago

doesn't Matter.js have a gravity property you can modify? I remember messing with it at some point and by setting a negative y gravity I could balance out the game's normal gravity (so that the player just floats around), and then from there I could dynamically add to that to flip it in any direction

Whyisthisnotavalable commented 2 weeks ago

doesn't Matter.js have a gravity property you can modify? I remember messing with it at some point and by setting a negative y gravity I could balance out the game's normal gravity (so that the player just floats around), and then from there I could dynamically add to that to flip it in any direction

I did this before too, but then flipping the player upside down would make walking look like it would be walking in the other direction since the velocity is the opposite of what it's supposed to be

landgreen commented 2 weeks ago

matter.js has built in gravity, but I use my own custom gravity so I can have more control.

Sadly, flipping gravity doesn't flip the player's head and feet, jump physics, various mob physics, and probably 50 other edge cases, like buttons. Although negative mass field is basically flipping gravity.

kgurchiek commented 2 weeks ago

Yeah I meant to combine your player flip method with the gravity swap so that it could change direction easier, I imagine the current method of redoing the map upside down would break the more complex community maps that aren't built to handle it

landgreen commented 2 weeks ago

Yeah, my method is only going to be viable on one specific level. I don't think it would be possible to apply it to all maps without writing complex custom flip code for every map.