@mrwhisky wrote:
i have a problem with these bullets. they have a random spread (accuracy kind of) that shoots them in a "random range" direction according to mouse position. shooting top right corner the spread is fine, but shooting in the top left corner there is almost no spread at all
float rndSpread = (float)rnd.Next(-100 + (100 - (int)spread), 100 - (100 - (int)spread)) / 1000;
new Projectile(position, bulletSprite, new Vector2(mousePos.X + rndSpread, mousePos.Y + rndSpread), damage, projectileSpeed);
shooting in the top right corner the variation in the vector 2 is pretty big
shooting in the top left corner there is very very minimal variation
i have absolutely no idea why its happeningThe spread goes + - 0.030
This is shooting top right corner:
spread : -0,026
direction : {X:0,8739144 Y:-0,4860798}
spread : 0,015
direction : {X:0,8994952 Y:-0,4369305}this is shooting top left corner:
spread : 0,004
direction : {X:-0,8919316 Y:-0,4521703}
spread : -0,027
direction : {X:-0,8859066 Y:-0,4638638}[Fixed] [NOT]
added a separate random number for x and y and this apparently fixed it
Turns out i have another problem where the closer my mouse is to the player the wider the spread, so wide it goes 360 fuck me
Posts: 3
Participants: 2