public Cannon() { cannonColor = new ThreeColorGameObject("spr_cannon_red", "spr_cannon_blue", "spr_cannon_green"); cannonColor.Position = new Vector2(52, 398); cannon_barrel = new RotatableSpriteGameObject("spr_cannon_barrel"); cannon_barrel.Position = new Vector2(74, 404); cannon_barrel.Origin = new Vector2(34, 34); }
public void Shoot(InputHelper inputHelper, ThreeColorGameObject cannonColor, RotatableSpriteGameObject cannonBarrel) { Shooting = true; this.Color = cannonColor.Color; velocity = (inputHelper.MousePosition - cannonColor.GlobalPosition) * 1.2f; float opp = (float)Math.Sin(cannonBarrel.Angle) * cannonBarrel.Width * 0.6f; float adj = (float)Math.Cos(cannonBarrel.Angle) * cannonBarrel.Width * 0.6f; Position = cannonColor.Position + new Vector2(adj, opp) + new Vector2(3, 3); Visible = true; Painter.AssetManager.PlaySound("snd_shoot_paint"); }