v.0.3
This commit is contained in:
parent
a25e69e92b
commit
aa6580dc22
9 changed files with 46 additions and 22 deletions
BIN
.vs/Bowling/DesignTimeBuild/.dtbcache.v2
Normal file
BIN
.vs/Bowling/DesignTimeBuild/.dtbcache.v2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.vs/ProjectEvaluation/bowling.metadata.v2
Normal file
BIN
.vs/ProjectEvaluation/bowling.metadata.v2
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/bowling.projects.v2
Normal file
BIN
.vs/ProjectEvaluation/bowling.projects.v2
Normal file
Binary file not shown.
|
@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bowling_Server", "Bowling_S
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetLib", "BowlingNetLib\NetLib.csproj", "{8F4FCE29-064E-45E4-AF43-87F31420EF2F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serializer", "Serializer\Serializer.csproj", "{37BE0268-E042-4FCD-973E-0BB9767F1768}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -29,10 +27,6 @@ Global
|
|||
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F4FCE29-064E-45E4-AF43-87F31420EF2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37BE0268-E042-4FCD-973E-0BB9767F1768}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37BE0268-E042-4FCD-973E-0BB9767F1768}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37BE0268-E042-4FCD-973E-0BB9767F1768}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37BE0268-E042-4FCD-973E-0BB9767F1768}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -8,7 +8,7 @@ using Microsoft.Xna.Framework.Input;
|
|||
|
||||
namespace Bowling.Classes
|
||||
{
|
||||
public enum State { Waiting, Flying, InGutter }
|
||||
public enum State { Waiting, Flying, InGutter, Gone }
|
||||
class Ball
|
||||
{
|
||||
private Vector2 position;
|
||||
|
@ -21,10 +21,12 @@ namespace Bowling.Classes
|
|||
private int gutter_bottom_y;
|
||||
private int gutter_height;
|
||||
private Arrow arrow;
|
||||
private int screenWidth;
|
||||
|
||||
public Vector2 Speed { get { return speed; } set { speed = value; } }
|
||||
public State State { get { return state; } set { state = value; } }
|
||||
|
||||
public Ball(Vector2 position, Vector2 speed, Color color, int gutter_top_y, int gutter_bottom_y, int gutter_height)
|
||||
public Ball(Vector2 position, Vector2 speed, Color color, int gutter_top_y, int gutter_bottom_y, int gutter_height, int screenWidth)
|
||||
{
|
||||
this.position = position;
|
||||
this.speed = speed;
|
||||
|
@ -33,6 +35,7 @@ namespace Bowling.Classes
|
|||
this.gutter_top_y = gutter_top_y;
|
||||
this.gutter_bottom_y = gutter_bottom_y;
|
||||
this.gutter_height = gutter_height;
|
||||
this.screenWidth = screenWidth;
|
||||
state = State.Waiting;
|
||||
arrow = new Arrow(new Vector2(60, gutter_top_y + (gutter_bottom_y - gutter_top_y) / 2));
|
||||
}
|
||||
|
@ -40,14 +43,14 @@ namespace Bowling.Classes
|
|||
public void LoadContent(ContentManager manager)
|
||||
{
|
||||
arrow.LoadContent(manager);
|
||||
texture = manager.Load<Texture2D>("ball");
|
||||
texture = manager.Load<Texture2D>("ball (2)");
|
||||
radius = texture.Width / 2;
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch brush)
|
||||
{
|
||||
arrow.Draw(brush);
|
||||
brush.Draw(texture, position, color);
|
||||
brush.Draw(texture, position, color);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
|
@ -58,7 +61,7 @@ namespace Bowling.Classes
|
|||
case State.Waiting:
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.Space))
|
||||
{
|
||||
state = State.Flying;
|
||||
state = State.Flying;
|
||||
AwfulMath();
|
||||
}
|
||||
break;
|
||||
|
@ -66,16 +69,18 @@ namespace Bowling.Classes
|
|||
Go(); break;
|
||||
case State.InGutter:
|
||||
GoInGutter(); break;
|
||||
case State.Gone:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Go()
|
||||
{
|
||||
{
|
||||
position += speed;
|
||||
if (position.Y <= gutter_top_y - gutter_height)
|
||||
{
|
||||
state = State.InGutter;
|
||||
speed.Y = 0;
|
||||
state = State.InGutter;
|
||||
speed.Y = 0;
|
||||
position.Y = gutter_top_y - gutter_height;
|
||||
}
|
||||
if (position.Y >= gutter_bottom_y)
|
||||
|
@ -84,17 +89,19 @@ namespace Bowling.Classes
|
|||
speed.Y = 0;
|
||||
position.Y = gutter_bottom_y;
|
||||
}
|
||||
if (position.X >= screenWidth) state = State.Gone;
|
||||
}
|
||||
|
||||
private void GoInGutter()
|
||||
{
|
||||
position += speed;
|
||||
if (position.X >= screenWidth) state = State.Gone;
|
||||
}
|
||||
|
||||
private void AwfulMath()
|
||||
{
|
||||
speed.X = (float)Math.Sqrt(36 / ((1 + Math.Tan(arrow.Rotation) * (1 + Math.Tan(arrow.Rotation)))));
|
||||
speed.Y = (float)(speed.X * Math.Tan(arrow.Rotation));
|
||||
speed.X = (float)Math.Cos(arrow.Rotation) * 9;
|
||||
speed.Y = (float)Math.Sin(arrow.Rotation) * 9;
|
||||
}
|
||||
|
||||
public List<Pin> CollidesKeggles(List<Pin> pins)
|
||||
|
|
|
@ -22,6 +22,18 @@ namespace Bowling
|
|||
private static int gutter_bottom_y;
|
||||
private Texture2D whiteRectangle;
|
||||
private Ball ball;
|
||||
private Player player1;
|
||||
private Player player2;
|
||||
private Menu menu;
|
||||
private int rowWidth;
|
||||
private int rowHeight;
|
||||
private int tableMarginTop;
|
||||
private int tableMarginLeft;
|
||||
private Vector2 ballStartPosition;
|
||||
private List<Classes.UI.Label> tableLabels;
|
||||
private int intermediateScore;
|
||||
private Classes.UI.Label lblCountP1;
|
||||
private Classes.UI.Label lblCountP2;
|
||||
|
||||
private int knockedPins;
|
||||
|
||||
|
@ -31,8 +43,6 @@ namespace Bowling
|
|||
|
||||
Player player;
|
||||
|
||||
Menu menu;
|
||||
|
||||
public static int Gutter_height { get { return gutter_height; } }
|
||||
public static int Gutter_top_y { get { return gutter_top_y; } }
|
||||
public static int Gutter_bottom_y { get { return gutter_bottom_y; } }
|
||||
|
@ -41,7 +51,7 @@ namespace Bowling
|
|||
{
|
||||
_graphics = new GraphicsDeviceManager(this);
|
||||
_graphics.PreferredBackBufferWidth = 1500;
|
||||
_graphics.PreferredBackBufferHeight = 900;
|
||||
_graphics.PreferredBackBufferHeight = 1000;
|
||||
Content.RootDirectory = "Content";
|
||||
IsMouseVisible = true;
|
||||
}
|
||||
|
@ -51,9 +61,17 @@ namespace Bowling
|
|||
// TODO: Add your initialization logic here
|
||||
gutter_top_y = _graphics.PreferredBackBufferHeight / 2 - 50;
|
||||
gutter_bottom_y = _graphics.PreferredBackBufferHeight - 100;
|
||||
gutter_height = 20;
|
||||
ball = new Ball(new Vector2(10, gutter_top_y + (gutter_bottom_y - gutter_top_y) / 2 - 25), Vector2.Zero, Color.Blue, Gutter_top_y, gutter_bottom_y, gutter_height);
|
||||
gutter_height = 50;
|
||||
ballStartPosition = new Vector2(10, gutter_top_y + (gutter_bottom_y - gutter_top_y) / 2 - 25);
|
||||
ball = new Ball(ballStartPosition, Vector2.Zero, Color.Blue, Gutter_top_y, gutter_bottom_y, gutter_height, _graphics.PreferredBackBufferWidth);
|
||||
menu = new Menu();
|
||||
player2 = new Player();
|
||||
rowWidth = 80;
|
||||
rowHeight = 50;
|
||||
tableMarginTop = 20;
|
||||
tableMarginLeft = 20;
|
||||
tableLabels = new List<Classes.UI.Label>();
|
||||
intermediateScore = 0;
|
||||
|
||||
base.Initialize();
|
||||
}
|
||||
|
@ -100,7 +118,7 @@ namespace Bowling
|
|||
if (connect.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
gameState = GameState.Menu;
|
||||
player = new Player(connect.name); // Игрок, потом из него подключение к серверу
|
||||
player = new Player(connec t.name); // Игрок, потом из него подключение к серверу
|
||||
NetLib.NetLib.IP = connect.IP;
|
||||
NetLib.NetLib.port = connect.Port;
|
||||
NetLib.NetLib.Connect();
|
||||
|
@ -150,5 +168,10 @@ namespace Bowling
|
|||
knockedPins++;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetOpponentName()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue