haxball / haxball-issues

115 stars 43 forks source link

Improve getBallPosition() #388

Open olehmisar opened 6 years ago

olehmisar commented 6 years ago

Ball radius is not always fixed. Map makers can change ball size. Could you add/replace getBallPosition() function with getBall() function which returns x, y, and radius? Hope for that.

Leo-MapCreator commented 6 years ago

What about getBall(): x, y, radius, speedx, speedy?

olehmisar commented 6 years ago

Yeah, great idea. And to be consistent basro should change getPlayerList() function which will return array of objects of this type: { id, name, team, admin, position: { x, y, speedx, speedy } }

Leo-MapCreator commented 6 years ago

honestly, getPlayersList does not need that, you can get the other things easily with just the id

olehmisar commented 6 years ago

No, it needs because you cannot get player speed anywhere

Leo-MapCreator commented 6 years ago

Then improve getPlayerPosition instead of getPlayerList

olehmisar commented 6 years ago

There is no getPlayerPosition() function

FrescoPL commented 6 years ago

Since the ball radius is coded inside the stadium file, maybe something like getStadium could be added as an extension of this idea.

olehmisar commented 6 years ago

@basro, modify onStadiumChange() to accept stadium contents as second argument.

Leo-MapCreator commented 6 years ago

@olegmisar PlayerObject position : {"x": float, "y": float} The player's position in the field, if the player is not in the field the value will be null.

olehmisar commented 6 years ago

Omg, leo, read our conversation again, you don't understand what is going on.

Leo-MapCreator commented 6 years ago

You that does not understand it, im showing you the command you said it didnt exist, even though the name isnt the same because i didnt remember the name of the command the first time and i didnt want to expend time looking for that

saviola777 commented 6 years ago

@Leo-MapCreator You get the PlayerObject from the getPlayerList() function, so that's the function that has to be changed, and that's exactly what @olegmisar suggested.