diff options
| author | Ben Beltran <ben@nsovocal.com> | 2013-11-22 06:53:08 -0600 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2013-11-22 06:53:08 -0600 |
| commit | 097781e6ad3f7bb1c13c16ff7b6bb7219764fb29 (patch) | |
| tree | 3ff629e90f2814d886ae2bbe484f64da824dbdf2 | |
| parent | 74c155708d85abfc2cf227c08de4f27003015b3f (diff) | |
Stuffffffff
17 files changed, 205 insertions, 24 deletions
diff --git a/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj b/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj index 1aedf53..2b327e7 100644 --- a/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj +++ b/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj @@ -110,7 +110,6 @@ </Compile> </ItemGroup> <ItemGroup> - <Folder Include="Fonts\" /> <Folder Include="Sound\" /> </ItemGroup> <ItemGroup> @@ -144,6 +143,13 @@ <Processor>TextureProcessor</Processor> </Compile> </ItemGroup> + <ItemGroup> + <Compile Include="Fonts\SegoeUIMono14.spritefont"> + <Name>SegoeUIMono14</Name> + <Importer>FontDescriptionImporter</Importer> + <Processor>FontDescriptionProcessor</Processor> + </Compile> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. diff --git a/Super Polarity.suo b/Super Polarity.suo Binary files differindex 8b2aaea..4f5c9c9 100644 --- a/Super Polarity.suo +++ b/Super Polarity.suo diff --git a/Super Polarity/ActorFactory.cs b/Super Polarity/ActorFactory.cs index 3a2dbab..9995707 100644 --- a/Super Polarity/ActorFactory.cs +++ b/Super Polarity/ActorFactory.cs @@ -18,6 +18,7 @@ namespace SuperPolarity mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position); ActorManager.CheckIn(mainShip); + Renderer.CheckIn(mainShip); return mainShip; } @@ -44,6 +45,7 @@ namespace SuperPolarity ship.SetPolarity(polarity); ActorManager.CheckIn(ship); + Renderer.CheckIn(ship); return ship; } @@ -62,8 +64,84 @@ namespace SuperPolarity bullet.Angle = angle; ActorManager.CheckIn(bullet); + Renderer.CheckIn(bullet); return bullet; } + + static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position) + { + StandardShip ship = new StandardShip(Game); + Texture2D texture; + + if (polarity == Ship.Polarity.Positive) + { + texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout"); + } + else + { + texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout"); + } + + ship.BoxDimensions.X = 10; + ship.BoxDimensions.Y = 10; + ship.BoxDimensions.W = 10; + ship.BoxDimensions.Z = 10; + + ship.Initialize(texture, position); + ship.MaxVelocity = 5.5f; + ship.FleeVelocity = 6.5f; + ship.ChargeVelocity = 5.5f; + ship.Value = 3; + ship.HP = 0; + ship.AngleChangeProbability = 20; + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + Renderer.CheckIn(ship); + + return ship; + } + + static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position) + { + StandardShip ship = new StandardShip(Game); + Texture2D texture; + + if (polarity == Ship.Polarity.Positive) + { + texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser"); + } + else + { + texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser"); + } + + ship.BoxDimensions.X = 40; + ship.BoxDimensions.Y = 40; + ship.BoxDimensions.W = 40; + ship.BoxDimensions.Z = 40; + + ship.Initialize(texture, position); + ship.MaxVelocity = 0.5f; + ship.FleeVelocity = 5; + ship.ChargeVelocity = 1; + ship.Value = 10; + ship.HP = 9; + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + Renderer.CheckIn(ship); + + return ship; + } } } diff --git a/Super Polarity/Actors/Actor.cs b/Super Polarity/Actors/Actor.cs index 8c71af0..c317796 100644 --- a/Super Polarity/Actors/Actor.cs +++ b/Super Polarity/Actors/Actor.cs @@ -19,7 +19,7 @@ namespace SuperPolarity protected Vector2 Origin; public bool Active; public Rectangle Box; - protected Vector4 BoxDimensions; + public Vector4 BoxDimensions; protected Texture2D BoxTexture; // Physical Properties @@ -29,9 +29,9 @@ namespace SuperPolarity public float Angle; // Constraints / Behavior - protected float MaxVelocity; + public float MaxVelocity; protected float AccelerationRate; - protected int HP; + public int HP; protected bool Immortal; public bool Dying; public int Value; @@ -52,6 +52,10 @@ namespace SuperPolarity public Actor(SuperPolarity newGame) { game = newGame; + BoxDimensions.X = 20; + BoxDimensions.Y = 20; + BoxDimensions.W = 15; + BoxDimensions.Z = 15; } public virtual void Initialize(Texture2D texture, Vector2 position) @@ -71,10 +75,6 @@ namespace SuperPolarity HP = 1; Immortal = false; - BoxDimensions.X = 20; - BoxDimensions.Y = 20; - BoxDimensions.W = 20; - BoxDimensions.Z = 20; Dying = false; Value = 1; @@ -88,7 +88,7 @@ namespace SuperPolarity protected void InitBox() { - Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Z)); + Box = new Rectangle((int)(Position.X - BoxDimensions.X), (int)(Position.Y - BoxDimensions.X), (int)(BoxDimensions.X + BoxDimensions.X + BoxDimensions.W), (int)(BoxDimensions.Y + BoxDimensions.Y + BoxDimensions.Z)); } public void AutoDeccelerate(GameTime gameTime) @@ -195,6 +195,10 @@ namespace SuperPolarity public void ChangeAngle() { + if (Math.Abs(Velocity.Y) <= 0.1 && Math.Abs(Velocity.X) <= 0.1) + { + return; + } Angle = (float)Math.Atan2(Velocity.Y, Velocity.X); } diff --git a/Super Polarity/Actors/Bullet.cs b/Super Polarity/Actors/Bullet.cs index 5a7be03..6b797c2 100644 --- a/Super Polarity/Actors/Bullet.cs +++ b/Super Polarity/Actors/Bullet.cs @@ -29,6 +29,7 @@ namespace SuperPolarity BoxDimensions.Y = 10; BoxDimensions.W = 10; BoxDimensions.Z = 10; + MaxVelocity = 8; InitBox(); particleEngine = ParticleEffectFactory.CreateBullet(position); } @@ -66,6 +67,7 @@ namespace SuperPolarity protected override void Die() { ActorManager.CheckOut(this); + Renderer.CheckOut(this); Parent.Children.Remove(this); } } diff --git a/Super Polarity/Actors/Ship.cs b/Super Polarity/Actors/Ship.cs index 2839c97..49d0b14 100644 --- a/Super Polarity/Actors/Ship.cs +++ b/Super Polarity/Actors/Ship.cs @@ -14,9 +14,9 @@ namespace SuperPolarity public Polarity CurrentPolarity; public uint MagneticRadius; - protected float FleeVelocity; - protected float ActVelocity; - protected float ChargeVelocity; + public float FleeVelocity; + public float ActVelocity; + public float ChargeVelocity; protected int RepelRadius; protected bool Magnetizing; @@ -25,11 +25,11 @@ namespace SuperPolarity MagneticRadius = 250; RepelRadius = 100; - HP = 5; + HP = 2; FleeVelocity = 5; - ActVelocity = 2; - ChargeVelocity = 1.5f; + ActVelocity = 1; + ChargeVelocity = 2.5f; CurrentPolarity = Polarity.Neutral; Magnetizing = false; } diff --git a/Super Polarity/Actors/StandardShip.cs b/Super Polarity/Actors/StandardShip.cs index 556be0f..ef2fe7f 100644 --- a/Super Polarity/Actors/StandardShip.cs +++ b/Super Polarity/Actors/StandardShip.cs @@ -12,9 +12,10 @@ namespace SuperPolarity class StandardShip : Ship { + protected bool Flashing; protected int ChangeRate; protected int CurrentTime; - protected int AngleChangeProbability; + public int AngleChangeProbability; protected int BouncePadding; protected float RotationFactor; protected Random Random; @@ -32,13 +33,11 @@ namespace SuperPolarity ChangeRate = 50; AngleChangeProbability = 50; BouncePadding = 0; - MaxVelocity = 1; + MaxVelocity = 2; CurrentTime = 0; RotationFactor = (float) (3 * Math.PI / 180); Random = new Random(BitConverter.ToInt32(cryptoResult, 0)); AddingAngle = true; - - HP = 5; } public override void Magnetize(Ship ship, float distance, float angle) @@ -60,6 +59,16 @@ namespace SuperPolarity Position += Velocity; UpdateBox(); Magnetizing = false; + + if (Flashing) + { + Color = new Color(255, 255, 255, 128); + Flashing = false; + } + else + { + Color = Color.White; + } } protected void AutoMove() @@ -131,6 +140,7 @@ namespace SuperPolarity { var theBullet = (Bullet)other; TakeDamage(theBullet.Power); + Flashing = true; } } diff --git a/Super Polarity/BasicGenerator.cs b/Super Polarity/BasicGenerator.cs new file mode 100644 index 0000000..7cc4544 --- /dev/null +++ b/Super Polarity/BasicGenerator.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; + +namespace SuperPolarity +{ + class BasicGenerator + { + public enum Ships : byte { Ship, Scout, Battlecruiser }; + + protected Ships ShipType; + protected SuperPolarity Game; + protected int ScoreThreshold; + protected int Rate; + protected int CurrentTime; + protected Random Randomizer; + protected Vector2 Position; + + public void Initialize(SuperPolarity game, Vector2 position, Ships shipType, int rate, int scoreThreshold) + { + Game = game; + ShipType = shipType; + ScoreThreshold = scoreThreshold; + Rate = rate; + Randomizer = new Random(); + Position = position; + } + + public void Update(GameTime gameTime) + { + if (Game.Player.Score > ScoreThreshold) + { + CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; + + if (CurrentTime >= Rate) + { + CurrentTime = 0; + Spawn(); + } + } + } + + protected void Spawn() + { + var polarity = Ship.Polarity.Positive; + + if (Randomizer.Next(2) == 1) + { + polarity = Ship.Polarity.Negative; + } + + if (ShipType == Ships.Ship) + { + ActorFactory.CreateShip(polarity, Position); + } + + if (ShipType == Ships.Scout) + { + ActorFactory.CreateScout(polarity, Position); + } + + if (ShipType == Ships.Battlecruiser) + { + ActorFactory.CreateCruiser(polarity, Position); + } + + } + } +} diff --git a/Super Polarity/GameScreen.cs b/Super Polarity/GameScreen.cs index 4404b16..28fd7b7 100644 --- a/Super Polarity/GameScreen.cs +++ b/Super Polarity/GameScreen.cs @@ -12,6 +12,8 @@ namespace SuperPolarity { public GameScreen(SuperPolarity newGame) : base(newGame) {} + private BasicGenerator generatorTest; + public override void Initialize() { InputController.RegisterEventForButton("changePolarity", Buttons.A); @@ -23,17 +25,24 @@ namespace SuperPolarity public override void LoadContent() { + + generatorTest = new BasicGenerator(); + generatorTest.Initialize(Game, new Vector2(100, 600), BasicGenerator.Ships.Scout, 3000, 10); + Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); - Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); - Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200))); - Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200))); + ActorFactory.CreateMainShip(playerPosition); + ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)); + ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)); + ActorFactory.CreateScout(Ship.Polarity.Negative, new Vector2(500, 500)); + ActorFactory.CreateCruiser(Ship.Polarity.Positive, new Vector2(40, 40)); } public override void Update(GameTime gameTime) { InputController.UpdateInput(); ActorManager.Update(gameTime); + generatorTest.Update(gameTime); } public override void Draw(SpriteBatch spriteBatch) diff --git a/Super Polarity/Super Polarity.csproj b/Super Polarity/Super Polarity.csproj index 2cd1d08..27ea7c5 100644 --- a/Super Polarity/Super Polarity.csproj +++ b/Super Polarity/Super Polarity.csproj @@ -39,6 +39,7 @@ <Compile Include="ActorManager.cs" /> <Compile Include="Actors\StandardShip.cs" /> <Compile Include="Actors\Bullet.cs" /> + <Compile Include="BasicGenerator.cs" /> <Compile Include="GameScreen.cs" /> <Compile Include="InputController.cs" /> <Compile Include="Actors\MainShip.cs" /> @@ -126,7 +127,7 @@ <None Include="Content\Graphics\neutral-ship.xnb"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> - <None Include="Content\Graphics\neutral-supercruiser.xnb"> + <None Include="neutral-supercruiser.xnb"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Include="Content\Graphics\positive-cruiser.xnb"> diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe Binary files differindex 0612174..0740117 100644 --- a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe +++ b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb Binary files differindex 670745d..b09aea1 100644 --- a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb +++ b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb diff --git a/Super Polarity/neutral-supercruiser.xnb b/Super Polarity/neutral-supercruiser.xnb Binary files differnew file mode 100644 index 0000000..1389842 --- /dev/null +++ b/Super Polarity/neutral-supercruiser.xnb diff --git a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache Binary files differindex c7e2aaa..bb51f56 100644 --- a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache +++ b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt b/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt index 9c92990..e25ddab 100644 --- a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt +++ b/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt @@ -17,7 +17,6 @@ C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarit C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-destroyer.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-scout.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-ship.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-supercruiser.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-cruiser.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-destroyer.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-scout.xnb @@ -29,3 +28,4 @@ C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarit C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-ship.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\square.xnb C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\SegoeUIMono14.xnb +C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\neutral-supercruiser.xnb diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.exe b/Super Polarity/obj/x86/Debug/Super Polarity.exe Binary files differindex 0612174..0740117 100644 --- a/Super Polarity/obj/x86/Debug/Super Polarity.exe +++ b/Super Polarity/obj/x86/Debug/Super Polarity.exe diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.pdb b/Super Polarity/obj/x86/Debug/Super Polarity.pdb Binary files differindex 670745d..b09aea1 100644 --- a/Super Polarity/obj/x86/Debug/Super Polarity.pdb +++ b/Super Polarity/obj/x86/Debug/Super Polarity.pdb |