haxball / haxball-issues

115 stars 43 forks source link

Player Touches The Box #1802

Open nguyenbinhbo opened 1 year ago

nguyenbinhbo commented 1 year ago

Hi can anyone help me write a code for example here are 2 balls with traits: "box" if i touch one of those balls then the ball i touch will disappear image

guguxh commented 1 year ago

Using Node-Haxball you can get all events related about this, like when the player touches the disc.

nguyenbinhbo commented 1 year ago

Using Node-Haxball you can get all events related about this, like when the player touches the disc.

but can you help me do it on headless API?

wxyz-abcd commented 1 year ago

If you really have to use the headless API, you would have to write a seperate collision logic in the onGameTick callback to understand when the collision occurs, and it would affect performance a lot. Or maybe you can use some map tricks that i dont know very well, like making one of the discs invMass=0 and the making the other one's bCoef=100 or something like that could work maybe.

nguyenbinhbo commented 1 year ago

If you really have to use the headless API, you would have to write a seperate collision logic in the onGameTick callback to understand when the collision occurs, and it would affect performance a lot. Or maybe you can use some map tricks that i dont know very well, like making one of the discs invMass=0 and the making the other one's bCoef=100 or something like that could work maybe.

is there any way i can getDiscProperties all balls have traits: box when player touches a ball that has traits: box the room will getPlayerDiscProperties if player's position is close to a ball that has traits: box then the ball is close to player that will disappear

thenorthstar commented 1 year ago

Hi can anyone help me write a code for example here are 2 balls with traits: "box" if i touch one of those balls then the ball i touch will disappear image

@nguyenbinhbo It's already explained on @wxyz-abcd's discord but let me explain for those who aren't a part of that server. Just add very high damping to balls, like 10000. Thanks to @Skarmunds for the idea.