From 95d7601b7742ed560a9d8e00269217f62fc7ce32 Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Sun, 10 Nov 2013 22:11:08 -0600 Subject: Chubas's House happened. --- Super Polarity/ParticleEngine.cs | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Super Polarity/ParticleEngine.cs (limited to 'Super Polarity/ParticleEngine.cs') diff --git a/Super Polarity/ParticleEngine.cs b/Super Polarity/ParticleEngine.cs new file mode 100644 index 0000000..5cf6bdb --- /dev/null +++ b/Super Polarity/ParticleEngine.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class ParticleEngine + { + private Random random; + public Vector2 EmitterLocation { get; set; } + private List particles; + private List textures; + + public ParticleEngine(List textures, Vector2 location) + { + EmitterLocation = location; + this.textures = textures; + this.particles = new List(); + random = new Random(); + } + + private Particle GenerateNewParticle() + { + Texture2D texture = textures[random.Next(textures.Count)]; + Vector2 position = EmitterLocation; + Vector2 velocity = new Vector2( + 1f * (float)(random.NextDouble() * 2 - 1), + 1f * (float)(random.NextDouble() * 2 - 1)); + float angle = 0; + float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1); + Color color = new Color( + (float)random.NextDouble(), + (float)random.NextDouble(), + (float)random.NextDouble()); + float size = (float)random.NextDouble(); + + int ttl = 20 + random.Next(40); + + return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl); + } + + public void Update() + { + int total = 10; + + for (int i = 0; i < total; i++) + { + particles.Add(GenerateNewParticle()); + } + + for (int particle = 0; particle < particles.Count; particle++) + { + particles[particle].Update(); + if (particles[particle].TTL <= 0) + { + particles.RemoveAt(particle); + particle--; + } + } + } + + public void Draw(SpriteBatch spriteBatch) + { + //spriteBatch.Begin(); + for (int index = 0; index < particles.Count; index++) + { + particles[index].Draw(spriteBatch); + } + //spriteBatch.End(); + } + } +} -- cgit From 2af83e98005a14c439b360a5b9ac636f594d9f0c Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Tue, 12 Nov 2013 06:44:55 -0600 Subject: Implements polarity system --- .../Graphics/negative-ship.png | Bin 0 -> 824 bytes .../Super Polarity ContentContent.contentproj | 7 + Super Polarity.suo | Bin 31744 -> 38400 bytes Super Polarity/Actor.cs | 154 ------------------- Super Polarity/ActorFactory.cs | 36 ++++- Super Polarity/ActorManager.cs | 41 ++++++ Super Polarity/Actors/Actor.cs | 161 ++++++++++++++++++++ Super Polarity/Actors/MainShip.cs | 163 +++++++++++++++++++++ Super Polarity/Actors/Ship.cs | 91 ++++++++++++ Super Polarity/Actors/StandardShip.cs | 114 ++++++++++++++ Super Polarity/Content/Graphics/negative-ship.xnb | Bin 0 -> 11707 bytes Super Polarity/Content/Graphics/player.xnb | Bin 32203 -> 0 bytes Super Polarity/InputController.cs | 82 ++++++++++- Super Polarity/MainShip.cs | 66 --------- Super Polarity/ParticleEngine.cs | 7 +- Super Polarity/Ship.cs | 38 ----- Super Polarity/Super Polarity.csproj | 10 +- Super Polarity/SuperPolarity.cs | 10 +- .../WindowsGL/Debug/Content/Graphics/player.xnb | Bin 32203 -> 0 bytes .../bin/WindowsGL/Debug/Super Polarity.exe | Bin 47104 -> 53248 bytes .../bin/WindowsGL/Debug/Super Polarity.pdb | Bin 50688 -> 58880 bytes .../DesignTimeResolveAssemblyReferencesInput.cache | Bin 8028 -> 8150 bytes .../Super Polarity.csproj.FileListAbsolute.txt | 1 + Super Polarity/obj/x86/Debug/Super Polarity.exe | Bin 47104 -> 53248 bytes Super Polarity/obj/x86/Debug/Super Polarity.pdb | Bin 50688 -> 58880 bytes 25 files changed, 708 insertions(+), 273 deletions(-) create mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png delete mode 100644 Super Polarity/Actor.cs create mode 100644 Super Polarity/Actors/Actor.cs create mode 100644 Super Polarity/Actors/MainShip.cs create mode 100644 Super Polarity/Actors/Ship.cs create mode 100644 Super Polarity/Actors/StandardShip.cs create mode 100644 Super Polarity/Content/Graphics/negative-ship.xnb delete mode 100644 Super Polarity/Content/Graphics/player.xnb delete mode 100644 Super Polarity/MainShip.cs delete mode 100644 Super Polarity/Ship.cs delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Content/Graphics/player.xnb (limited to 'Super Polarity/ParticleEngine.cs') diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png new file mode 100644 index 0000000..1407d5d Binary files /dev/null and b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png differ 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 4e7a9f0..f86c49e 100644 --- a/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj +++ b/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj @@ -129,6 +129,13 @@ TextureProcessor + + + negative-ship + TextureImporter + TextureProcessor + +