Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// This will configure your weapon for storing.
- /// </summary>
- public string Configure(ushort[] Target, PlayerPositionEvent p)
- {
- position = Target;
- int bombXVel, bombYVel;
- int playerXVel, playerYVel;
- // If the player being tracked has fired a bomb
- // Save the spot where the bomb was fired
- bombStart = new ushort[2] { p.MapPositionX, p.MapPositionY };
- // Compute the velocity of the bomb
- bombXVel = (int)(-xChange[p.ShipRotation] * 2000);
- bombYVel = (int)(-yChange[p.ShipRotation] * 2000);
- // Convert the player's velocity out of ss format
- playerXVel = (int)(p.VelocityX);
- if (playerXVel > (ushort.MaxValue / 2))
- playerXVel = playerXVel - ushort.MaxValue;
- playerYVel = (int)(p.VelocityY);
- if (playerYVel > (ushort.MaxValue / 2))
- playerYVel = playerYVel - ushort.MaxValue;
- // Add the reformatted velocity to the bomb velocity
- bombXVel = bombXVel + playerXVel;
- if (bombXVel > (ushort.MaxValue / 2))
- bombXVel = bombXVel - ushort.MaxValue;
- bombYVel = bombYVel + playerYVel;
- if (bombYVel > (ushort.MaxValue / 2))
- bombYVel = bombYVel - ushort.MaxValue;
- bombForce = (int)(Math.Sqrt(bombXVel * bombXVel + bombYVel * bombYVel));
- bombVel = new int[2] { bombXVel, bombYVel };
- playerVel = new int[2] { playerXVel, playerYVel };
- string result = CalculateHit();
- if (result == "~miss")
- return result;
- else return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement