Open luizxd0 opened 3 months ago
https://github.com/user-attachments/assets/0fcfd267-ba35-45ea-9534-6e4f6521b129
Wrong behaviour. When the projectile hits the mirror going "downwards". It should bounce and reflect it still going downwards but on the opposite direction, but instead, it reflects the projectile "upwards".
https://github.com/user-attachments/assets/7aa920c9-1d7c-4946-b1a1-6f6d94a2b0ce
Correct behaviour. When the projectile is going "downwards" it should keep going "downwards" but on the opposite direction creating a "bounce" effect.
Can you please provide me the function that computes this behavior? It would speed up the process, otherwise I'll have to scan through the project and understand a lot more things than needed to fix the error. @luizxd0.
The function in question is _castWeatherMirror in world.js file. line 818. It might be worth it to check the projectile class as well in shoot.js file.
The issue is that it is inverting the angle in a wrong way using the invert function inside the _castWeatherMirror.
It should take into consideration the angle of the projectile when it hits the mirror, but instead, it is taking into account only the initial angle from when the projectil is shot, creating a wrong behaviour. Also, the function itself doesnt change the projectile trajetory, when it hits the mirror, the current projectile disappears and another one is created by:
"if (shoot.config.countMirror<10)this.addbulets(shoot)"
So it is actually creating a new bullet with different properties and a wrong angle.
To be able to test it properly, you can disable all the other weathers in gametypes.js and leave only Mirror activated:
Types.WEATHERS.active = [ //Types.WEATHERS.list.thor, //Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.wind_change, // Types.WEATHERS.list.no_items, // Types.WEATHERS.list.no_items, // Types.WEATHERS.list.sun, // Types.WEATHERS.list.lightning, // Types.WEATHERS.list.black, //Types.WEATHERS.list.random, Types.WEATHERS.list.mirror, // Types.WEATHERS.list.tornado ]
Some known issues:
Tornado - Shot goes around tornado in a weird non smooth way, needs fixing. Mirror - Fixed. Lightning - Also feels exaggerated. Wind - I'm not sure the state of this. Dark Weather - Fixed. Sun weather - Fixed.