From 4fc09567c557a1110180940cca40fd7144921026 Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Mon, 3 Feb 2014 10:06:44 -0600 Subject: Removes spaces. --- .../Super Polarity Content.csproj | 65 ----- .../Fonts/SegoeUIMono14.spritefont | 60 ---- .../Fonts/bigfont.png | Bin 18385 -> 0 bytes .../Fonts/smallfont.png | Bin 8490 -> 0 bytes .../Graphics/circle.png | Bin 355 -> 0 bytes .../Graphics/diamond.png | Bin 388 -> 0 bytes .../Graphics/main-ship.png | Bin 1838 -> 0 bytes .../Graphics/negative-cruiser.png | Bin 3283 -> 0 bytes .../Graphics/negative-destroyer.png | Bin 1720 -> 0 bytes .../Graphics/negative-scout.png | Bin 1487 -> 0 bytes .../Graphics/negative-ship.png | Bin 824 -> 0 bytes .../Graphics/negative-supercruiser.png | Bin 3097 -> 0 bytes .../Graphics/neutral-cruiser.png | Bin 2924 -> 0 bytes .../Graphics/neutral-destroyer.png | Bin 1559 -> 0 bytes .../Graphics/neutral-scout.png | Bin 1305 -> 0 bytes .../Graphics/neutral-ship.png | Bin 1579 -> 0 bytes .../Graphics/neutral-supercruiser.png | Bin 2969 -> 0 bytes .../Graphics/pause-screen.png | Bin 34294 -> 0 bytes .../Graphics/polaritydemotitle.png | Bin 16528 -> 0 bytes .../Graphics/positive-cruiser.png | Bin 3290 -> 0 bytes .../Graphics/positive-destroyer.png | Bin 1738 -> 0 bytes .../Graphics/positive-scout.png | Bin 1486 -> 0 bytes .../Graphics/positive-ship.png | Bin 1812 -> 0 bytes .../Graphics/positive-supercruiser.png | Bin 3093 -> 0 bytes .../Graphics/square.png | Bin 169 -> 0 bytes .../Graphics/star.png | Bin 380 -> 0 bytes .../Sound/polaritytheme.wav | Bin 48384044 -> 0 bytes .../Super Polarity ContentContent.contentproj | 192 ------------- Super Polarity.sln | 162 ----------- Super Polarity.suo | Bin 59392 -> 0 bytes Super Polarity/ActorFactory.cs | 144 ---------- Super Polarity/ActorManager.cs | 160 ----------- Super Polarity/Actors/Actor.cs | 267 ------------------ Super Polarity/Actors/Bullet.cs | 80 ------ Super Polarity/Actors/MainShip.cs | 314 --------------------- Super Polarity/Actors/Ship.cs | 92 ------ Super Polarity/Actors/StandardShip.cs | 155 ---------- Super Polarity/BasicGenerator.cs | 77 ----- Super Polarity/Content/Fonts/SegoeUIMono14.xnb | Bin 20142 -> 0 bytes Super Polarity/Content/Fonts/bigfont.xnb | Bin 115931 -> 0 bytes Super Polarity/Content/Fonts/smallfont.xnb | Bin 50395 -> 0 bytes Super Polarity/Content/Graphics/circle.xnb | Bin 1211 -> 0 bytes Super Polarity/Content/Graphics/diamond.xnb | Bin 1211 -> 0 bytes Super Polarity/Content/Graphics/main-ship.xnb | Bin 11707 -> 0 bytes .../Content/Graphics/negative-cruiser.xnb | Bin 72187 -> 0 bytes .../Content/Graphics/negative-destroyer.xnb | Bin 11707 -> 0 bytes Super Polarity/Content/Graphics/negative-scout.xnb | Bin 5707 -> 0 bytes Super Polarity/Content/Graphics/negative-ship.xnb | Bin 11707 -> 0 bytes .../Content/Graphics/negative-supercruiser.xnb | Bin 72187 -> 0 bytes .../Content/Graphics/neutral-cruiser.xnb | Bin 72187 -> 0 bytes .../Content/Graphics/neutral-destroyer.xnb | Bin 11707 -> 0 bytes Super Polarity/Content/Graphics/neutral-scout.xnb | Bin 5707 -> 0 bytes Super Polarity/Content/Graphics/neutral-ship.xnb | Bin 11707 -> 0 bytes .../Content/Graphics/neutral-supercruiser.xnb | Bin 72187 -> 0 bytes Super Polarity/Content/Graphics/pause-screen.xnb | Bin 3686587 -> 0 bytes .../Content/Graphics/polaritydemotitle.xnb | Bin 3686587 -> 0 bytes .../Content/Graphics/positive-cruiser.xnb | Bin 72187 -> 0 bytes .../Content/Graphics/positive-destroyer.xnb | Bin 11707 -> 0 bytes Super Polarity/Content/Graphics/positive-scout.xnb | Bin 5707 -> 0 bytes Super Polarity/Content/Graphics/positive-ship.xnb | Bin 11707 -> 0 bytes .../Content/Graphics/positive-supercruiser.xnb | Bin 72187 -> 0 bytes Super Polarity/Content/Graphics/square.xnb | Bin 1147 -> 0 bytes Super Polarity/Content/Graphics/star.xnb | Bin 1147 -> 0 bytes Super Polarity/Content/Sound/bomb.wav | Bin 403244 -> 0 bytes Super Polarity/Content/Sound/bullet.wav | Bin 201644 -> 0 bytes Super Polarity/Content/Sound/gameover.wav | Bin 1612844 -> 0 bytes Super Polarity/Content/Sound/hit.wav | Bin 403244 -> 0 bytes Super Polarity/Content/Sound/life.wav | Bin 403244 -> 0 bytes Super Polarity/Content/Sound/polaritychange.wav | Bin 403244 -> 0 bytes Super Polarity/Content/Sound/polaritytheme.wav | Bin 48384044 -> 0 bytes Super Polarity/GameScreen.cs | 209 -------------- Super Polarity/Icon.ico | Bin 32038 -> 0 bytes Super Polarity/InputController.cs | 248 ---------------- Super Polarity/LetterChooseWidget.cs | 84 ------ Super Polarity/MenuItem.cs | 11 - Super Polarity/MenuWidget.cs | 11 - Super Polarity/NameChooserWidget.cs | 99 ------- Super Polarity/Particle.cs | 51 ---- Super Polarity/ParticleEffectFactory.cs | 66 ----- Super Polarity/ParticleEngine.cs | 86 ------ Super Polarity/Player.cs | 81 ------ Super Polarity/Program.cs | 26 -- Super Polarity/Properties/AssemblyInfo.cs | 36 --- Super Polarity/Renderer.cs | 42 --- Super Polarity/ScoreScreen.cs | 108 ------- Super Polarity/Screen.cs | 40 --- Super Polarity/ScreenManager.cs | 55 ---- Super Polarity/Super Polarity.csproj | 196 ------------- Super Polarity/Super Polarity.csproj.user | 3 - Super Polarity/SuperPolarity.cs | 161 ----------- Super Polarity/TitleScreen.cs | 50 ---- Super Polarity/Widget.cs | 92 ------ .../bin/WindowsGL/Debug/GameName1.vshost.exe | Bin 11600 -> 0 bytes .../WindowsGL/Debug/GameName1.vshost.exe.manifest | 11 - .../bin/WindowsGL/Debug/Lidgren.Network.dll | Bin 118272 -> 0 bytes .../bin/WindowsGL/Debug/MonoGame.Framework.dll | Bin 637440 -> 0 bytes Super Polarity/bin/WindowsGL/Debug/OpenTK.dll | Bin 3290624 -> 0 bytes Super Polarity/bin/WindowsGL/Debug/SDL.dll | Bin 324096 -> 0 bytes .../bin/WindowsGL/Debug/Super Polarity.exe | Bin 72704 -> 0 bytes .../bin/WindowsGL/Debug/Super Polarity.pdb | Bin 128512 -> 0 bytes .../bin/WindowsGL/Debug/Super Polarity.vshost.exe | Bin 11600 -> 0 bytes Super Polarity/bin/WindowsGL/Debug/Tao.Sdl.dll | Bin 69632 -> 0 bytes Super Polarity/neutral-supercruiser.xnb | Bin 72187 -> 0 bytes .../DesignTimeResolveAssemblyReferencesInput.cache | Bin 9636 -> 0 bytes .../obj/x86/Debug/ResolveAssemblyReference.cache | Bin 17159 -> 0 bytes .../Super Polarity.csproj.FileListAbsolute.txt | 42 --- Super Polarity/obj/x86/Debug/Super Polarity.exe | Bin 72704 -> 0 bytes Super Polarity/obj/x86/Debug/Super Polarity.pdb | Bin 128512 -> 0 bytes Super Polarity/scores.txt | 0 SuperPolarity.sln | 162 +++++++++++ SuperPolarity.userprefs | 12 + SuperPolarity/ActorFactory.cs | 144 ++++++++++ SuperPolarity/ActorManager.cs | 160 +++++++++++ SuperPolarity/Actors/Actor.cs | 267 ++++++++++++++++++ SuperPolarity/Actors/Bullet.cs | 80 ++++++ SuperPolarity/Actors/MainShip.cs | 314 +++++++++++++++++++++ SuperPolarity/Actors/Ship.cs | 92 ++++++ SuperPolarity/Actors/StandardShip.cs | 155 ++++++++++ SuperPolarity/BasicGenerator.cs | 77 +++++ SuperPolarity/Content/Fonts/SegoeUIMono14.xnb | Bin 0 -> 20142 bytes SuperPolarity/Content/Fonts/bigfont.xnb | Bin 0 -> 115931 bytes SuperPolarity/Content/Fonts/smallfont.xnb | Bin 0 -> 50395 bytes SuperPolarity/Content/Graphics/circle.xnb | Bin 0 -> 1211 bytes SuperPolarity/Content/Graphics/diamond.xnb | Bin 0 -> 1211 bytes SuperPolarity/Content/Graphics/main-ship.xnb | Bin 0 -> 11707 bytes .../Content/Graphics/negative-cruiser.xnb | Bin 0 -> 72187 bytes .../Content/Graphics/negative-destroyer.xnb | Bin 0 -> 11707 bytes SuperPolarity/Content/Graphics/negative-scout.xnb | Bin 0 -> 5707 bytes SuperPolarity/Content/Graphics/negative-ship.xnb | Bin 0 -> 11707 bytes .../Content/Graphics/negative-supercruiser.xnb | Bin 0 -> 72187 bytes SuperPolarity/Content/Graphics/neutral-cruiser.xnb | Bin 0 -> 72187 bytes .../Content/Graphics/neutral-destroyer.xnb | Bin 0 -> 11707 bytes SuperPolarity/Content/Graphics/neutral-scout.xnb | Bin 0 -> 5707 bytes SuperPolarity/Content/Graphics/neutral-ship.xnb | Bin 0 -> 11707 bytes .../Content/Graphics/neutral-supercruiser.xnb | Bin 0 -> 72187 bytes SuperPolarity/Content/Graphics/pause-screen.xnb | Bin 0 -> 3686587 bytes .../Content/Graphics/polaritydemotitle.xnb | Bin 0 -> 3686587 bytes .../Content/Graphics/positive-cruiser.xnb | Bin 0 -> 72187 bytes .../Content/Graphics/positive-destroyer.xnb | Bin 0 -> 11707 bytes SuperPolarity/Content/Graphics/positive-scout.xnb | Bin 0 -> 5707 bytes SuperPolarity/Content/Graphics/positive-ship.xnb | Bin 0 -> 11707 bytes .../Content/Graphics/positive-supercruiser.xnb | Bin 0 -> 72187 bytes SuperPolarity/Content/Graphics/square.xnb | Bin 0 -> 1147 bytes SuperPolarity/Content/Graphics/star.xnb | Bin 0 -> 1147 bytes SuperPolarity/Content/Sound/bomb.wav | Bin 0 -> 403244 bytes SuperPolarity/Content/Sound/bullet.wav | Bin 0 -> 201644 bytes SuperPolarity/Content/Sound/gameover.wav | Bin 0 -> 1612844 bytes SuperPolarity/Content/Sound/hit.wav | Bin 0 -> 403244 bytes SuperPolarity/Content/Sound/life.wav | Bin 0 -> 403244 bytes SuperPolarity/Content/Sound/polaritychange.wav | Bin 0 -> 403244 bytes SuperPolarity/Content/Sound/polaritytheme.wav | Bin 0 -> 48384044 bytes SuperPolarity/GameScreen.cs | 209 ++++++++++++++ SuperPolarity/Icon.ico | Bin 0 -> 32038 bytes SuperPolarity/InputController.cs | 248 ++++++++++++++++ SuperPolarity/LetterChooseWidget.cs | 84 ++++++ SuperPolarity/MenuItem.cs | 11 + SuperPolarity/MenuWidget.cs | 11 + SuperPolarity/NameChooserWidget.cs | 99 +++++++ SuperPolarity/Particle.cs | 51 ++++ SuperPolarity/ParticleEffectFactory.cs | 66 +++++ SuperPolarity/ParticleEngine.cs | 86 ++++++ SuperPolarity/Player.cs | 81 ++++++ SuperPolarity/Program.cs | 26 ++ SuperPolarity/Properties/AssemblyInfo.cs | 36 +++ SuperPolarity/Renderer.cs | 42 +++ SuperPolarity/ScoreScreen.cs | 108 +++++++ SuperPolarity/Screen.cs | 40 +++ SuperPolarity/ScreenManager.cs | 55 ++++ SuperPolarity/SuperPolarity.cs | 161 +++++++++++ SuperPolarity/SuperPolarity.csproj | 196 +++++++++++++ SuperPolarity/TitleScreen.cs | 50 ++++ SuperPolarity/Widget.cs | 92 ++++++ SuperPolarity/neutral-supercruiser.xnb | Bin 0 -> 72187 bytes SuperPolarity/scores.txt | 0 .../SuperPolarityContent.csproj | 65 +++++ .../Fonts/SegoeUIMono14.spritefont | 60 ++++ .../SuperPolarityContentContent/Fonts/bigfont.png | Bin 0 -> 18385 bytes .../Fonts/smallfont.png | Bin 0 -> 8490 bytes .../Graphics/circle.png | Bin 0 -> 355 bytes .../Graphics/diamond.png | Bin 0 -> 388 bytes .../Graphics/main-ship.png | Bin 0 -> 1838 bytes .../Graphics/negative-cruiser.png | Bin 0 -> 3283 bytes .../Graphics/negative-destroyer.png | Bin 0 -> 1720 bytes .../Graphics/negative-scout.png | Bin 0 -> 1487 bytes .../Graphics/negative-ship.png | Bin 0 -> 824 bytes .../Graphics/negative-supercruiser.png | Bin 0 -> 3097 bytes .../Graphics/neutral-cruiser.png | Bin 0 -> 2924 bytes .../Graphics/neutral-destroyer.png | Bin 0 -> 1559 bytes .../Graphics/neutral-scout.png | Bin 0 -> 1305 bytes .../Graphics/neutral-ship.png | Bin 0 -> 1579 bytes .../Graphics/neutral-supercruiser.png | Bin 0 -> 2969 bytes .../Graphics/pause-screen.png | Bin 0 -> 34294 bytes .../Graphics/polaritydemotitle.png | Bin 0 -> 16528 bytes .../Graphics/positive-cruiser.png | Bin 0 -> 3290 bytes .../Graphics/positive-destroyer.png | Bin 0 -> 1738 bytes .../Graphics/positive-scout.png | Bin 0 -> 1486 bytes .../Graphics/positive-ship.png | Bin 0 -> 1812 bytes .../Graphics/positive-supercruiser.png | Bin 0 -> 3093 bytes .../Graphics/square.png | Bin 0 -> 169 bytes .../SuperPolarityContentContent/Graphics/star.png | Bin 0 -> 380 bytes .../Sound/polaritytheme.wav | Bin 0 -> 48384044 bytes .../SuperPolarityContentContent.contentproj | 192 +++++++++++++ SuperPolarityMac/ActorFactory.cs | 144 ++++++++++ SuperPolarityMac/ActorManager.cs | 160 +++++++++++ SuperPolarityMac/BasicGenerator.cs | 77 +++++ SuperPolarityMac/Content/logo.png | Bin 8994 -> 0 bytes SuperPolarityMac/Game1.cs | 110 -------- SuperPolarityMac/GameScreen.cs | 209 ++++++++++++++ SuperPolarityMac/Icon.ico | Bin 0 -> 32038 bytes SuperPolarityMac/Info.plist | 17 -- SuperPolarityMac/InputController.cs | 248 ++++++++++++++++ SuperPolarityMac/LetterChooseWidget.cs | 84 ++++++ SuperPolarityMac/Main.cs | 44 --- SuperPolarityMac/MenuItem.cs | 11 + SuperPolarityMac/MenuWidget.cs | 11 + SuperPolarityMac/NameChooserWidget.cs | 99 +++++++ SuperPolarityMac/Particle.cs | 51 ++++ SuperPolarityMac/ParticleEffectFactory.cs | 66 +++++ SuperPolarityMac/ParticleEngine.cs | 86 ++++++ SuperPolarityMac/Player.cs | 81 ++++++ SuperPolarityMac/Program.cs | 26 ++ SuperPolarityMac/Properties/AssemblyInfo.cs | 27 -- SuperPolarityMac/Renderer.cs | 42 +++ SuperPolarityMac/ScoreScreen.cs | 108 +++++++ SuperPolarityMac/Screen.cs | 40 +++ SuperPolarityMac/ScreenManager.cs | 55 ++++ SuperPolarityMac/SuperPolarity.cs | 161 +++++++++++ SuperPolarityMac/TitleScreen.cs | 50 ++++ SuperPolarityMac/Widget.cs | 92 ++++++ SuperPolarityMac/neutral-supercruiser.xnb | Bin 0 -> 72187 bytes 230 files changed, 5433 insertions(+), 3774 deletions(-) delete mode 100644 Super Polarity Content/Super Polarity Content/Super Polarity Content.csproj delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/circle.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/diamond.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/main-ship.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-cruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-destroyer.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-scout.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/negative-supercruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-cruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-destroyer.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-scout.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-ship.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-supercruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/positive-cruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/positive-destroyer.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/positive-scout.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/positive-ship.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/positive-supercruiser.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/square.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Graphics/star.png delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav delete mode 100644 Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj delete mode 100644 Super Polarity.sln delete mode 100644 Super Polarity.suo delete mode 100644 Super Polarity/ActorFactory.cs delete mode 100644 Super Polarity/ActorManager.cs delete mode 100644 Super Polarity/Actors/Actor.cs delete mode 100644 Super Polarity/Actors/Bullet.cs delete mode 100644 Super Polarity/Actors/MainShip.cs delete mode 100644 Super Polarity/Actors/Ship.cs delete mode 100644 Super Polarity/Actors/StandardShip.cs delete mode 100644 Super Polarity/BasicGenerator.cs delete mode 100644 Super Polarity/Content/Fonts/SegoeUIMono14.xnb delete mode 100644 Super Polarity/Content/Fonts/bigfont.xnb delete mode 100644 Super Polarity/Content/Fonts/smallfont.xnb delete mode 100644 Super Polarity/Content/Graphics/circle.xnb delete mode 100644 Super Polarity/Content/Graphics/diamond.xnb delete mode 100644 Super Polarity/Content/Graphics/main-ship.xnb delete mode 100644 Super Polarity/Content/Graphics/negative-cruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/negative-destroyer.xnb delete mode 100644 Super Polarity/Content/Graphics/negative-scout.xnb delete mode 100644 Super Polarity/Content/Graphics/negative-ship.xnb delete mode 100644 Super Polarity/Content/Graphics/negative-supercruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/neutral-cruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/neutral-destroyer.xnb delete mode 100644 Super Polarity/Content/Graphics/neutral-scout.xnb delete mode 100644 Super Polarity/Content/Graphics/neutral-ship.xnb delete mode 100644 Super Polarity/Content/Graphics/neutral-supercruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/pause-screen.xnb delete mode 100644 Super Polarity/Content/Graphics/polaritydemotitle.xnb delete mode 100644 Super Polarity/Content/Graphics/positive-cruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/positive-destroyer.xnb delete mode 100644 Super Polarity/Content/Graphics/positive-scout.xnb delete mode 100644 Super Polarity/Content/Graphics/positive-ship.xnb delete mode 100644 Super Polarity/Content/Graphics/positive-supercruiser.xnb delete mode 100644 Super Polarity/Content/Graphics/square.xnb delete mode 100644 Super Polarity/Content/Graphics/star.xnb delete mode 100644 Super Polarity/Content/Sound/bomb.wav delete mode 100644 Super Polarity/Content/Sound/bullet.wav delete mode 100644 Super Polarity/Content/Sound/gameover.wav delete mode 100644 Super Polarity/Content/Sound/hit.wav delete mode 100644 Super Polarity/Content/Sound/life.wav delete mode 100644 Super Polarity/Content/Sound/polaritychange.wav delete mode 100644 Super Polarity/Content/Sound/polaritytheme.wav delete mode 100644 Super Polarity/GameScreen.cs delete mode 100644 Super Polarity/Icon.ico delete mode 100644 Super Polarity/InputController.cs delete mode 100644 Super Polarity/LetterChooseWidget.cs delete mode 100644 Super Polarity/MenuItem.cs delete mode 100644 Super Polarity/MenuWidget.cs delete mode 100644 Super Polarity/NameChooserWidget.cs delete mode 100644 Super Polarity/Particle.cs delete mode 100644 Super Polarity/ParticleEffectFactory.cs delete mode 100644 Super Polarity/ParticleEngine.cs delete mode 100644 Super Polarity/Player.cs delete mode 100644 Super Polarity/Program.cs delete mode 100644 Super Polarity/Properties/AssemblyInfo.cs delete mode 100644 Super Polarity/Renderer.cs delete mode 100644 Super Polarity/ScoreScreen.cs delete mode 100644 Super Polarity/Screen.cs delete mode 100644 Super Polarity/ScreenManager.cs delete mode 100644 Super Polarity/Super Polarity.csproj delete mode 100644 Super Polarity/Super Polarity.csproj.user delete mode 100644 Super Polarity/SuperPolarity.cs delete mode 100644 Super Polarity/TitleScreen.cs delete mode 100644 Super Polarity/Widget.cs delete mode 100644 Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe delete mode 100644 Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe.manifest delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Lidgren.Network.dll delete mode 100644 Super Polarity/bin/WindowsGL/Debug/MonoGame.Framework.dll delete mode 100644 Super Polarity/bin/WindowsGL/Debug/OpenTK.dll delete mode 100644 Super Polarity/bin/WindowsGL/Debug/SDL.dll delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Super Polarity.vshost.exe delete mode 100644 Super Polarity/bin/WindowsGL/Debug/Tao.Sdl.dll delete mode 100644 Super Polarity/neutral-supercruiser.xnb delete mode 100644 Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache delete mode 100644 Super Polarity/obj/x86/Debug/ResolveAssemblyReference.cache delete mode 100644 Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt delete mode 100644 Super Polarity/obj/x86/Debug/Super Polarity.exe delete mode 100644 Super Polarity/obj/x86/Debug/Super Polarity.pdb delete mode 100644 Super Polarity/scores.txt create mode 100644 SuperPolarity.sln create mode 100644 SuperPolarity.userprefs create mode 100644 SuperPolarity/ActorFactory.cs create mode 100644 SuperPolarity/ActorManager.cs create mode 100644 SuperPolarity/Actors/Actor.cs create mode 100644 SuperPolarity/Actors/Bullet.cs create mode 100644 SuperPolarity/Actors/MainShip.cs create mode 100644 SuperPolarity/Actors/Ship.cs create mode 100644 SuperPolarity/Actors/StandardShip.cs create mode 100644 SuperPolarity/BasicGenerator.cs create mode 100644 SuperPolarity/Content/Fonts/SegoeUIMono14.xnb create mode 100644 SuperPolarity/Content/Fonts/bigfont.xnb create mode 100644 SuperPolarity/Content/Fonts/smallfont.xnb create mode 100644 SuperPolarity/Content/Graphics/circle.xnb create mode 100644 SuperPolarity/Content/Graphics/diamond.xnb create mode 100644 SuperPolarity/Content/Graphics/main-ship.xnb create mode 100644 SuperPolarity/Content/Graphics/negative-cruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/negative-destroyer.xnb create mode 100644 SuperPolarity/Content/Graphics/negative-scout.xnb create mode 100644 SuperPolarity/Content/Graphics/negative-ship.xnb create mode 100644 SuperPolarity/Content/Graphics/negative-supercruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/neutral-cruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/neutral-destroyer.xnb create mode 100644 SuperPolarity/Content/Graphics/neutral-scout.xnb create mode 100644 SuperPolarity/Content/Graphics/neutral-ship.xnb create mode 100644 SuperPolarity/Content/Graphics/neutral-supercruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/pause-screen.xnb create mode 100644 SuperPolarity/Content/Graphics/polaritydemotitle.xnb create mode 100644 SuperPolarity/Content/Graphics/positive-cruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/positive-destroyer.xnb create mode 100644 SuperPolarity/Content/Graphics/positive-scout.xnb create mode 100644 SuperPolarity/Content/Graphics/positive-ship.xnb create mode 100644 SuperPolarity/Content/Graphics/positive-supercruiser.xnb create mode 100644 SuperPolarity/Content/Graphics/square.xnb create mode 100644 SuperPolarity/Content/Graphics/star.xnb create mode 100644 SuperPolarity/Content/Sound/bomb.wav create mode 100644 SuperPolarity/Content/Sound/bullet.wav create mode 100644 SuperPolarity/Content/Sound/gameover.wav create mode 100644 SuperPolarity/Content/Sound/hit.wav create mode 100644 SuperPolarity/Content/Sound/life.wav create mode 100644 SuperPolarity/Content/Sound/polaritychange.wav create mode 100644 SuperPolarity/Content/Sound/polaritytheme.wav create mode 100644 SuperPolarity/GameScreen.cs create mode 100644 SuperPolarity/Icon.ico create mode 100644 SuperPolarity/InputController.cs create mode 100644 SuperPolarity/LetterChooseWidget.cs create mode 100644 SuperPolarity/MenuItem.cs create mode 100644 SuperPolarity/MenuWidget.cs create mode 100644 SuperPolarity/NameChooserWidget.cs create mode 100644 SuperPolarity/Particle.cs create mode 100644 SuperPolarity/ParticleEffectFactory.cs create mode 100644 SuperPolarity/ParticleEngine.cs create mode 100644 SuperPolarity/Player.cs create mode 100644 SuperPolarity/Program.cs create mode 100644 SuperPolarity/Properties/AssemblyInfo.cs create mode 100644 SuperPolarity/Renderer.cs create mode 100644 SuperPolarity/ScoreScreen.cs create mode 100644 SuperPolarity/Screen.cs create mode 100644 SuperPolarity/ScreenManager.cs create mode 100644 SuperPolarity/SuperPolarity.cs create mode 100644 SuperPolarity/SuperPolarity.csproj create mode 100644 SuperPolarity/TitleScreen.cs create mode 100644 SuperPolarity/Widget.cs create mode 100644 SuperPolarity/neutral-supercruiser.xnb create mode 100644 SuperPolarity/scores.txt create mode 100644 SuperPolarityContent/SuperPolarityContent/SuperPolarityContent.csproj create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Fonts/SegoeUIMono14.spritefont create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Fonts/bigfont.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Fonts/smallfont.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/circle.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/diamond.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/main-ship.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-cruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-destroyer.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-scout.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-ship.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-supercruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-cruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-destroyer.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-scout.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-ship.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-supercruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/pause-screen.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/polaritydemotitle.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-cruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-destroyer.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-scout.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-ship.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-supercruiser.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/square.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Graphics/star.png create mode 100644 SuperPolarityContent/SuperPolarityContentContent/Sound/polaritytheme.wav create mode 100644 SuperPolarityContent/SuperPolarityContentContent/SuperPolarityContentContent.contentproj create mode 100644 SuperPolarityMac/ActorFactory.cs create mode 100644 SuperPolarityMac/ActorManager.cs create mode 100644 SuperPolarityMac/BasicGenerator.cs delete mode 100644 SuperPolarityMac/Content/logo.png delete mode 100644 SuperPolarityMac/Game1.cs create mode 100644 SuperPolarityMac/GameScreen.cs create mode 100644 SuperPolarityMac/Icon.ico delete mode 100644 SuperPolarityMac/Info.plist create mode 100644 SuperPolarityMac/InputController.cs create mode 100644 SuperPolarityMac/LetterChooseWidget.cs delete mode 100644 SuperPolarityMac/Main.cs create mode 100644 SuperPolarityMac/MenuItem.cs create mode 100644 SuperPolarityMac/MenuWidget.cs create mode 100644 SuperPolarityMac/NameChooserWidget.cs create mode 100644 SuperPolarityMac/Particle.cs create mode 100644 SuperPolarityMac/ParticleEffectFactory.cs create mode 100644 SuperPolarityMac/ParticleEngine.cs create mode 100644 SuperPolarityMac/Player.cs create mode 100644 SuperPolarityMac/Program.cs delete mode 100644 SuperPolarityMac/Properties/AssemblyInfo.cs create mode 100644 SuperPolarityMac/Renderer.cs create mode 100644 SuperPolarityMac/ScoreScreen.cs create mode 100644 SuperPolarityMac/Screen.cs create mode 100644 SuperPolarityMac/ScreenManager.cs create mode 100644 SuperPolarityMac/SuperPolarity.cs create mode 100644 SuperPolarityMac/TitleScreen.cs create mode 100644 SuperPolarityMac/Widget.cs create mode 100644 SuperPolarityMac/neutral-supercruiser.xnb diff --git a/Super Polarity Content/Super Polarity Content/Super Polarity Content.csproj b/Super Polarity Content/Super Polarity Content/Super Polarity Content.csproj deleted file mode 100644 index 4cc2f56..0000000 --- a/Super Polarity Content/Super Polarity Content/Super Polarity Content.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - - {8528C189-5B94-48F8-8C64-D4D6658E52F6} - {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Windows - x86 - Library - Properties - ContentBuilder - IgnoreMe - v4.0 - Client - v4.0 - bin\$(Configuration) - Windows - HiDef - 70f11b5f-d758-4efc-943f-95989437d224 - Library - x86 - false - - - Windows - - - Windows8 - - - Android - - - iOS - - - OSX - - - Linux - - - PSM - - - - - - - {468F8415-7D38-4718-B0B4-E18F1A427136} - Super Polarity ContentContent %28Content%29 - Content - - - - - - \ No newline at end of file diff --git a/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont b/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont deleted file mode 100644 index 6c68f5d..0000000 --- a/Super Polarity Content/Super Polarity ContentContent/Fonts/SegoeUIMono14.spritefont +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - Segoe UI Mono - - - 14 - - - 0 - - - true - - - - - - - - - - - - ~ - - - - diff --git a/Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png b/Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png deleted file mode 100644 index 67307dd..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Fonts/bigfont.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png b/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png deleted file mode 100644 index 51a2c14..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Fonts/smallfont.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/circle.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/circle.png deleted file mode 100644 index ede9996..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/circle.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/diamond.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/diamond.png deleted file mode 100644 index f06a523..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/diamond.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/main-ship.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/main-ship.png deleted file mode 100644 index 168ce43..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/main-ship.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-cruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-cruiser.png deleted file mode 100644 index 0461e90..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-cruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-destroyer.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-destroyer.png deleted file mode 100644 index 25244f2..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-destroyer.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-scout.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-scout.png deleted file mode 100644 index fdc372b..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-scout.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png deleted file mode 100644 index 1407d5d..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-ship.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-supercruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-supercruiser.png deleted file mode 100644 index 344ef93..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/negative-supercruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-cruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-cruiser.png deleted file mode 100644 index 3f5be69..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-cruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-destroyer.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-destroyer.png deleted file mode 100644 index 458ec8e..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-destroyer.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-scout.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-scout.png deleted file mode 100644 index e7a1364..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-scout.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-ship.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-ship.png deleted file mode 100644 index 6b0a767..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-ship.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-supercruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-supercruiser.png deleted file mode 100644 index 183b71c..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/neutral-supercruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png deleted file mode 100644 index 0d6db73..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/pause-screen.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png deleted file mode 100644 index 10a9b92..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/polaritydemotitle.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-cruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-cruiser.png deleted file mode 100644 index 62da8bc..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-cruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-destroyer.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-destroyer.png deleted file mode 100644 index 735d473..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-destroyer.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-scout.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-scout.png deleted file mode 100644 index 1970625..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-scout.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-ship.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-ship.png deleted file mode 100644 index 9d07a8c..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-ship.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-supercruiser.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-supercruiser.png deleted file mode 100644 index 6b2a77b..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/positive-supercruiser.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png deleted file mode 100644 index 960c50a..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/square.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Graphics/star.png b/Super Polarity Content/Super Polarity ContentContent/Graphics/star.png deleted file mode 100644 index 4f207f4..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Graphics/star.png and /dev/null differ diff --git a/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav b/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav deleted file mode 100644 index 28a6bce..0000000 Binary files a/Super Polarity Content/Super Polarity ContentContent/Sound/polaritytheme.wav and /dev/null 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 deleted file mode 100644 index 12417a2..0000000 --- a/Super Polarity Content/Super Polarity ContentContent/Super Polarity ContentContent.contentproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - {468F8415-7D38-4718-B0B4-E18F1A427136} - {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Windows - x86 - Library - Properties - Super_Polarity_ContentContentContent - v4.0 - v4.0 - Windows - bin\$(MonoGamePlatform)\$(Configuration) - Content - x86 - - - Windows - - - Windows8 - - - Android - - - iOS - - - OSX - - - Linux - - - PSM - - - - - - - - - - $(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGameContentProcessors.dll - - - - - main-ship - TextureProcessor - - - negative-cruiser - TextureProcessor - - - negative-destroyer - TextureProcessor - - - negative-scout - TextureProcessor - - - negative-supercruiser - TextureProcessor - - - neutral-cruiser - TextureProcessor - - - neutral-destroyer - TextureProcessor - - - neutral-scout - TextureProcessor - - - neutral-ship - TextureProcessor - - - neutral-supercruiser - TextureProcessor - - - positive-cruiser - TextureProcessor - - - positive-destroyer - TextureProcessor - - - positive-scout - TextureProcessor - - - positive-ship - TextureProcessor - - - positive-supercruiser - TextureProcessor - - - - - pause-screen - TextureImporter - TextureProcessor - - - - - circle - TextureImporter - TextureProcessor - - - diamond - TextureImporter - TextureProcessor - - - star - TextureImporter - TextureProcessor - - - - - negative-ship - TextureImporter - TextureProcessor - - - - - square - TextureImporter - TextureProcessor - - - - - SegoeUIMono14 - FontDescriptionImporter - FontDescriptionProcessor - - - - - polaritytheme - WavImporter - SongProcessor - - - - - polaritydemotitle - TextureImporter - TextureProcessor - - - - - bigfont - TextureImporter - FontTextureProcessor - - - smallfont - TextureImporter - FontTextureProcessor - - - - - \ No newline at end of file diff --git a/Super Polarity.sln b/Super Polarity.sln deleted file mode 100644 index 6742318..0000000 --- a/Super Polarity.sln +++ /dev/null @@ -1,162 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Super Polarity", "Super Polarity\Super Polarity.csproj", "{2585188B-339D-44CD-9599-1A80AA30DE13}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Super Polarity Content", "Super Polarity Content\Super Polarity Content\Super Polarity Content.csproj", "{8528C189-5B94-48F8-8C64-D4D6658E52F6}" -EndProject -Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "Super Polarity ContentContent", "Super Polarity Content\Super Polarity ContentContent\Super Polarity ContentContent.contentproj", "{468F8415-7D38-4718-B0B4-E18F1A427136}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Android|Any CPU = Android|Any CPU - Android|Mixed Platforms = Android|Mixed Platforms - Android|x86 = Android|x86 - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - iOS|Any CPU = iOS|Any CPU - iOS|Mixed Platforms = iOS|Mixed Platforms - iOS|x86 = iOS|x86 - Linux|Any CPU = Linux|Any CPU - Linux|Mixed Platforms = Linux|Mixed Platforms - Linux|x86 = Linux|x86 - OSX|Any CPU = OSX|Any CPU - OSX|Mixed Platforms = OSX|Mixed Platforms - OSX|x86 = OSX|x86 - PSM|Any CPU = PSM|Any CPU - PSM|Mixed Platforms = PSM|Mixed Platforms - PSM|x86 = PSM|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - Windows|Any CPU = Windows|Any CPU - Windows|Mixed Platforms = Windows|Mixed Platforms - Windows|x86 = Windows|x86 - Windows8|Any CPU = Windows8|Any CPU - Windows8|Mixed Platforms = Windows8|Mixed Platforms - Windows8|x86 = Windows8|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Any CPU.ActiveCfg = Debug|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|x86.ActiveCfg = Debug|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|x86.Build.0 = Debug|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|x86.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Any CPU.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Mixed Platforms.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Mixed Platforms.Build.0 = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|x86.ActiveCfg = Release|x86 - {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|x86.Build.0 = Release|x86 - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Any CPU.ActiveCfg = Android|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Any CPU.Build.0 = Android|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Mixed Platforms.Build.0 = Android|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|x86.ActiveCfg = Android|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Any CPU.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Any CPU.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Mixed Platforms.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|x86.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Any CPU.ActiveCfg = iOS|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Any CPU.Build.0 = iOS|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Mixed Platforms.Build.0 = iOS|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|x86.ActiveCfg = iOS|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Any CPU.ActiveCfg = Linux|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Any CPU.Build.0 = Linux|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Mixed Platforms.Build.0 = Linux|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|x86.ActiveCfg = Linux|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Any CPU.ActiveCfg = OSX|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Any CPU.Build.0 = OSX|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Mixed Platforms.Build.0 = OSX|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|x86.ActiveCfg = OSX|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Any CPU.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Any CPU.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Mixed Platforms.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|x86.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Any CPU.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Any CPU.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Mixed Platforms.Build.0 = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|x86.ActiveCfg = PSM|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Any CPU.ActiveCfg = Windows|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Any CPU.Build.0 = Windows|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Mixed Platforms.Build.0 = Windows|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|x86.ActiveCfg = Windows|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Any CPU.Build.0 = Windows8|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Mixed Platforms.Build.0 = Windows8|Any CPU - {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|x86.ActiveCfg = Windows8|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|Any CPU.ActiveCfg = Android|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|x86.ActiveCfg = Android|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|Any CPU.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|x86.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|Any CPU.ActiveCfg = iOS|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|x86.ActiveCfg = iOS|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|Any CPU.ActiveCfg = Linux|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|x86.ActiveCfg = Linux|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|Any CPU.ActiveCfg = OSX|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|x86.ActiveCfg = OSX|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|Any CPU.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|x86.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|Any CPU.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|x86.ActiveCfg = PSM|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|Any CPU.ActiveCfg = Windows|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|x86.ActiveCfg = Windows|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU - {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|x86.ActiveCfg = Windows8|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Super Polarity.suo b/Super Polarity.suo deleted file mode 100644 index 360a22a..0000000 Binary files a/Super Polarity.suo and /dev/null differ diff --git a/Super Polarity/ActorFactory.cs b/Super Polarity/ActorFactory.cs deleted file mode 100644 index f9c7697..0000000 --- a/Super Polarity/ActorFactory.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Content; - -namespace SuperPolarity -{ - static class ActorFactory - { - static internal SuperPolarity Game; - - static public MainShip CreateMainShip(Vector2 position) - { - MainShip mainShip = new MainShip(Game); - mainShip.Initialize(Game.Content.Load("Graphics\\main-ship"), position); - - ActorManager.CheckIn(mainShip); - - return mainShip; - } - - static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position) - { - StandardShip ship = new StandardShip(Game); - Texture2D texture; - - if (polarity == Ship.Polarity.Positive) - { - texture = Game.Content.Load("Graphics\\positive-ship"); - } - else if (polarity == Ship.Polarity.Negative) - { - texture = Game.Content.Load("Graphics\\negative-ship"); - } - else - { - texture = Game.Content.Load("Graphics\\neutral-ship"); - } - - ship.Initialize(texture, position); - ship.SetPolarity(polarity); - - ActorManager.CheckIn(ship); - - return ship; - } - - internal static void SetGame(SuperPolarity game) - { - ActorFactory.Game = game; - } - - internal static Bullet CreateBullet(Vector2 position, float angle) - { - Bullet bullet = new Bullet(Game); - - bullet.Initialize(Game.Content.Load("Graphics\\square"), position); - - bullet.Angle = angle; - - ActorManager.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("Graphics\\positive-scout"); - } - else if (polarity == Ship.Polarity.Negative) - { - texture = Game.Content.Load("Graphics\\negative-scout"); - } - else - { - texture = Game.Content.Load("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.2f; - ship.FleeVelocity = 6.5f; - ship.ChargeVelocity = 5.5f; - ship.Value = 3; - ship.HP = 0; - ship.AngleChangeProbability = 20; - ship.SetPolarity(polarity); - - ActorManager.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("Graphics\\positive-cruiser"); - } - else if (polarity == Ship.Polarity.Negative) - { - texture = Game.Content.Load("Graphics\\negative-cruiser"); - } - else - { - texture = Game.Content.Load("Graphics\\neutral-cruiser"); - } - - ship.BoxDimensions.X = 40; - ship.BoxDimensions.Y = 40; - ship.BoxDimensions.W = 40; - ship.BoxDimensions.Z = 40; - - ship.Initialize(texture, position); - ship.MagneticRadius = 1000; - ship.RepelRadius = 200; - ship.MaxVelocity = 0.5f; - ship.FleeVelocity = 5; - ship.ChargeVelocity = 1; - ship.Value = 10; - ship.HP = 29; - ship.SetPolarity(polarity); - - ActorManager.CheckIn(ship); - - return ship; - } - } -} diff --git a/Super Polarity/ActorManager.cs b/Super Polarity/ActorManager.cs deleted file mode 100644 index f5587b9..0000000 --- a/Super Polarity/ActorManager.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - static class ActorManager - { - - static SuperPolarity Game; - static int OutlierBounds; - static IList Actors; - - static ActorManager() - { - OutlierBounds = 100; - Actors = new List(); - } - - static public void CheckIn(Actor actor) - { - Actors.Add(actor); - } - - static public void CheckOut(Actor actor) - { - actor.CleanUp(); - Actors.Remove(actor); - actor = null; - } - - static public void Update(GameTime gameTime) - { - CheckActors(); - CheckOutliers(); - foreach (Actor actor in Actors) - { - actor.Update(gameTime); - } - } - - static public void Draw(SpriteBatch spriteBatch) - { - foreach (Actor actor in Actors) - { - actor.Draw(spriteBatch); - } - } - - static void CheckActors() - { - for (var i = Actors.Count - 1; i >= 0; i--) - { - if (i >= Actors.Count) { - i = Actors.Count - 1; - } - - if (Actors.Count == 0) - { - return; - } - - Actor actor = Actors[i]; - for (var j = i - 1; j >= 0; j--) - { - Actor other = Actors[j]; - - CheckCollision(actor, other); - - if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship))) - { - CheckMagnetism((Ship)actor, (Ship)other); - } - } - } - } - - static void CheckCollision(Actor actor, Actor other) - { - var collision = Rectangle.Intersect(actor.Box, other.Box); - var inverseCollision = Rectangle.Intersect(other.Box, actor.Box); - if (!collision.IsEmpty && !actor.Dying && !other.Dying) - { - actor.Collide(other, collision); - other.Collide(actor, inverseCollision); - } - - } - - static void CheckMagnetism(Ship actor, Ship other) - { - if (actor.CurrentPolarity != Ship.Polarity.Neutral && other.CurrentPolarity != Ship.Polarity.Neutral) - { - var dy = other.Position.Y - actor.Position.Y; - var dx = other.Position.X - actor.Position.X; - var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); - var angle = (float) Math.Atan2(dy, dx); - var otherAngle = (float)Math.Atan2(-dy, -dx); - - if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius) - { - actor.Magnetize(other, (float)linearDistance, angle); - other.Magnetize(actor, (float)linearDistance, otherAngle); - } - } - } - - static void CheckOutliers() - { - for (var i = Actors.Count; i > 0; i--) - { - var actor = Actors[i-1]; - if (actor.Position.X < -OutlierBounds || actor.Position.Y < -OutlierBounds || - actor.Position.X > Game.GraphicsDevice.Viewport.Width + OutlierBounds || - actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds) - { - CheckOut(actor); - if (actor.Parent != null) - { - actor.Parent.Children.Remove(actor); - } - } - } - } - - static public void Empty() - { - foreach (Actor actor in Actors) { - actor.CleanUp(); - } - Actors.Clear(); - } - - internal static void SetGame(SuperPolarity game) - { - Game = game; - } - - public static void Bomb() - { - for (var i = Actors.Count - 1; i >= 0; i--) - { - var actor = Actors[i]; - if (actor.GetType() == typeof(StandardShip)) - { - CheckOut(actor); - Renderer.CheckOut(actor); - } - } - } - - public static int CountBaddies() - { - return Actors.Where(a => a.GetType() == typeof(StandardShip)).Count(); - } - } -} diff --git a/Super Polarity/Actors/Actor.cs b/Super Polarity/Actors/Actor.cs deleted file mode 100644 index 3bb06be..0000000 --- a/Super Polarity/Actors/Actor.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Actor - { - protected SuperPolarity game; - - public List Children; - - // Graphics / In-Game - protected Texture2D Texture; - protected Vector2 Origin; - public bool Active; - public Rectangle Box; - public Vector4 BoxDimensions; - protected Texture2D BoxTexture; - - // Physical Properties - public Vector2 Position; - protected Vector2 Velocity; - protected Vector2 Acceleration; - public float Angle; - - // Constraints / Behavior - public float MaxVelocity; - protected float AccelerationRate; - public int HP; - protected bool Immortal; - public bool Dying; - public int Value; - protected Color Color; - - public Actor Parent; - - public int Width - { - get { return Texture.Width; } - } - - public int Height - { - get { return Texture.Height; } - } - - 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) - { - Texture = texture; - Position = position; - Active = true; - - Children = new List(); - - Origin = new Vector2(Texture.Width / 2, Texture.Height / 2); - Velocity = new Vector2(0, 0); - Acceleration = new Vector2(0, 0); - - MaxVelocity = 5; - AccelerationRate = 10; - - HP = 1; - Immortal = false; - - Dying = false; - Value = 1; - - InitBox(); - BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1); - BoxTexture.SetData(new Color[] { Color.White }); - - Color = Color.White; - } - - protected void InitBox() - { - 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) - { - if (Acceleration.X == 0 && Velocity.X > 0) - { - if (AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds > Velocity.X) - { - Velocity.X = 0; - Acceleration.X = 0; - } - else - { - Acceleration.X = -AccelerationRate; - } - } - - if (Acceleration.X == 0 && Velocity.X < 0) - { - if (-AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds < Velocity.X) - { - Velocity.X = 0; - Acceleration.X = 0; - } - else - { - Acceleration.X = AccelerationRate; - } - } - - if (Acceleration.Y == 0 && Velocity.Y > 0) - { - if (AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds > Velocity.Y) - { - Velocity.Y = 0; - Acceleration.Y = 0; - } - else - { - Acceleration.Y = -AccelerationRate; - } - } - - if (Acceleration.Y == 0 && Velocity.Y < 0) - { - if (-AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds < Velocity.Y) - { - Velocity.Y = 0; - Acceleration.Y = 0; - } - else - { - Acceleration.Y = AccelerationRate; - } - } - } - - public virtual void Update(GameTime gameTime) - { - Move(gameTime); - ChangeAngle(); - CheckOutliers(); - UpdateBox(); - } - - protected virtual void UpdateBox() - { - Box.X = (int)(Position.X - BoxDimensions.X); - Box.Y = (int)(Position.Y - BoxDimensions.Y); - } - - public virtual void Move(GameTime gameTime) - { - AutoDeccelerate(gameTime); - - var maxVelocity = MaxVelocity; - - Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds; - Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds; - - if (Velocity.X > MaxVelocity) - { - Velocity.X = MaxVelocity; - } - - if (Velocity.X < -MaxVelocity) - { - Velocity.X = -MaxVelocity; - } - - if (Velocity.Y > MaxVelocity) - { - Velocity.Y = MaxVelocity; - } - - if (Velocity.Y < -MaxVelocity) - { - Velocity.Y = -MaxVelocity; - } - - Position.X = Position.X + Velocity.X; - Position.Y = Position.Y + Velocity.Y; - } - - 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); - } - - public virtual void Draw(SpriteBatch spriteBatch) - { - Actor child = null; - - // TODO: Check what's up with the null children. - if (Children == null) - { - return; - } - for (var i = Children.Count - 1; i >= 0; i--) - { - child = Children[i]; - child.Draw(spriteBatch); - } - - spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); - //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); - } - - void CheckOutliers() - { - for (var i = Children.Count; i > 0; i--) - { - var actor = Children[i - 1]; - if (actor.Position.X < -SuperPolarity.OutlierBounds || actor.Position.Y < -SuperPolarity.OutlierBounds || - actor.Position.X > game.GraphicsDevice.Viewport.Width + SuperPolarity.OutlierBounds || - actor.Position.Y > game.GraphicsDevice.Viewport.Height + SuperPolarity.OutlierBounds) - { - Children.Remove(actor); - } - } - } - - public virtual void Collide(Actor other, Rectangle collision) - { - } - - public void TakeDamage(int amount) - { - if (!Immortal) - { - HP = HP - amount; - if (HP < 0) - { - Die(); - } - } - } - - protected virtual void Die() - { - Dying = true; - } - - public virtual void CleanUp() - { - Texture = null; - BoxTexture = null; - Children = null; - Texture = null; - } - } -} diff --git a/Super Polarity/Actors/Bullet.cs b/Super Polarity/Actors/Bullet.cs deleted file mode 100644 index d20289c..0000000 --- a/Super Polarity/Actors/Bullet.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Bullet : Actor - { - protected ParticleEngine particleEngine; - public int Power; - - public Bullet(SuperPolarity newGame) - : base(newGame) - { - } - - ~Bullet() - { - particleEngine = null; - } - - public override void Initialize(Texture2D texture, Vector2 position) - { - base.Initialize(texture, position); - BoxDimensions.X = 10; - BoxDimensions.Y = 10; - BoxDimensions.W = 10; - BoxDimensions.Z = 10; - MaxVelocity = 8; - InitBox(); - particleEngine = ParticleEffectFactory.CreateBullet(position); - } - - public override void Update(GameTime gameTime) - { - Velocity.X = (float)(MaxVelocity * Math.Cos(Angle)); - Velocity.Y = (float)(MaxVelocity * Math.Sin(Angle)); - - Power = 1; - - Position += Velocity; - UpdateBox(); - - particleEngine.Update(); - particleEngine.EmitterLocation = Position; - } - - public override void Draw(SpriteBatch spriteBatch) - { - base.Draw(spriteBatch); - particleEngine.Draw(spriteBatch); - } - - public override void Collide(Actor other, Rectangle collision) - { - if (Dying) { return; } - if (other.GetType().IsAssignableFrom(typeof(StandardShip))) - { - Die(); - return; - } - } - - protected override void Die() - { - ActorManager.CheckOut(this); - Renderer.CheckOut(this); - Parent.Children.Remove(this); - } - - public override void CleanUp() - { - base.CleanUp(); - this.particleEngine = null; - } - } -} diff --git a/Super Polarity/Actors/MainShip.cs b/Super Polarity/Actors/MainShip.cs deleted file mode 100644 index bf4f3bb..0000000 --- a/Super Polarity/Actors/MainShip.cs +++ /dev/null @@ -1,314 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Audio; - -namespace SuperPolarity -{ - class MainShip : Ship - { - - public static Color BlueColor; - public static Color RedColor; - - ParticleEngine particleEngine; - - protected bool Shooting; - protected int ShotCooldown; - - protected float CurrentImmortalTime; - protected float MaxImmortalTime; - protected bool Flashing; - - protected SoundEffect PolarityChange; - protected SoundEffect ShootSound; - protected SoundEffect Hit; - - public MainShip(SuperPolarity newGame) : base(newGame) {} - - ~MainShip() - { - particleEngine = null; - } - - public override void Initialize(Texture2D texture, Vector2 position) - { - base.Initialize(texture, position); - - MainShip.BlueColor = new Color(211, 230, 234); - MainShip.RedColor = new Color(235, 160, 185); - - PolarityChange = game.Content.Load("Sound\\polaritychange"); - ShootSound = game.Content.Load("Sound\\bullet"); - Hit = game.Content.Load("Sound\\hit"); - - InitParticleEngine(); - SetPolarity(Polarity.Positive); - - ActVelocity = 2.5f; - - ShotCooldown = 50; - MaxImmortalTime = 1500; - - BoxDimensions.X = 2; - BoxDimensions.Y = 2; - BoxDimensions.W = 2; - BoxDimensions.Z = 2; - InitBox(); - - BindInput(); - } - - void InitParticleEngine() - { - particleEngine = ParticleEffectFactory.CreatePolarCircle(Position); - } - - void BindInput() - { - InputController.Bind("moveX", HandleHorizontalMovement); - InputController.Bind("moveY", HandleVerticalMovement); - InputController.Bind("changePolarity", HandleChangePolarity); - InputController.Bind("shoot", HandleShot); - } - - protected void HandleShot(float value) - { - - Shooting = true; - Timer t = new Timer(new TimerCallback(UnlockShot)); - t.Change(ShotCooldown, Timeout.Infinite); - - if (Children.Count > 10) - { - return; - } - - var bullet = ActorFactory.CreateBullet(Position, Angle); - - Children.Add(bullet); - bullet.Parent = this; - - ShootSound.Play(); - } - - protected void UnlockShot(object state) - { - InputController.Unlock("shoot"); - Shooting = false; - } - - protected void HandleChangePolarity(float value) - { - SwitchPolarity(); - } - - public void HandleHorizontalMovement(float value) - { - if (value >= -0.5 && value <= 0.5) - { - value = 0; - } - - Velocity.X = value * MaxVelocity; - } - - public void HandleVerticalMovement(float value) - { - if (value >= -0.5 && value <= 0.5) - { - value = 0; - } - - Velocity.Y = value * MaxVelocity; - } - - public override void SwitchPolarity() - { - base.SwitchPolarity(); - SwitchParticleEngine(CurrentPolarity); - PolarityChange.Play(); - game.Player.ResetMultiplier(); - } - - public override void SetPolarity(Polarity newPolarity) - { - base.SetPolarity(newPolarity); - SwitchParticleEngine(newPolarity); - } - - protected void SwitchParticleEngine(Polarity polarity) - { - if (polarity == Polarity.Positive) - { - particleEngine.Color = MainShip.RedColor; - } - else if (polarity == Polarity.Negative) - { - particleEngine.Color = MainShip.BlueColor; - } - else - { - particleEngine.Color = Color.Gray; - } - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - particleEngine.EmitterLocation = Position; - particleEngine.Update(); - ConstrainToEdges(); - UpdateImmortality(gameTime); - } - - public void UpdateImmortality(GameTime gameTime) - { - if (Immortal) - { - CurrentImmortalTime += gameTime.ElapsedGameTime.Milliseconds; - - if (Flashing) - { - Color = new Color(255, 255, 255, 128); - } - else - { - Color = Color.White; - } - - Flashing = !Flashing; - - if (CurrentImmortalTime > MaxImmortalTime) - { - Immortal = false; - Color = Color.White; - } - } - } - - public override void Move(GameTime gameTime) - { - var VelocityLimit = MaxVelocity; - var SavedVelocity = new Vector2(Velocity.X, Velocity.Y); - - if (Shooting) - { - VelocityLimit = ActVelocity; - } - - if (SavedVelocity.X > VelocityLimit) - { - SavedVelocity.X = VelocityLimit; - } - - if (SavedVelocity.X < -VelocityLimit) - { - SavedVelocity.X = -VelocityLimit; - } - - if (SavedVelocity.Y > VelocityLimit) - { - SavedVelocity.Y = VelocityLimit; - } - - if (SavedVelocity.Y < -VelocityLimit) - { - SavedVelocity.Y = -VelocityLimit; - } - - Position.X = Position.X + SavedVelocity.X; - Position.Y = Position.Y + SavedVelocity.Y; - } - - public override void Magnetize(Ship ship, float distance, float angle) - { - } - - protected void ConstrainToEdges() - { - if (Position.X < 0) - { - Position.X = 0; - - if (Velocity.X < 0) - { - Velocity.X = 0; - } - } - if (Position.X > game.GraphicsDevice.Viewport.Width) - { - Position.X = game.GraphicsDevice.Viewport.Width; - - if (Velocity.X > 0) - { - Velocity.X = 0; - } - } - if (Position.Y < 0) - { - Position.Y = 0; - - if (Velocity.Y < 0) - { - Velocity.Y = 0; - } - } - if (Position.Y > game.GraphicsDevice.Viewport.Height) - { - Position.Y = game.GraphicsDevice.Viewport.Height; - - if (Velocity.Y < 0) - { - Velocity.Y = 0; - } - } - } - - public override void Draw(SpriteBatch spriteBatch) - { - particleEngine.Draw(spriteBatch); - base.Draw(spriteBatch); - } - - public override void Collide(Actor other, Rectangle collision) - { - if (other.GetType().IsAssignableFrom(typeof(StandardShip)) && - !Immortal) - { - Die(); - } - } - - protected override void Die() - { - game.Player.Lives = game.Player.Lives - 1; - game.Player.ResetMultiplier(); - if (game.Player.Lives < 0) - { - Dying = true; - game.GameOver(); - } - else { - Hit.Play(); - Immortal = true; - CurrentImmortalTime = 0; - } - } - - public override void CleanUp() - { - base.CleanUp(); - particleEngine = null; - InputController.Unbind("moveX", HandleHorizontalMovement); - InputController.Unbind("moveY", HandleVerticalMovement); - InputController.Unbind("changePolarity", HandleChangePolarity); - InputController.Unbind("shoot", HandleShot); - } - } -} diff --git a/Super Polarity/Actors/Ship.cs b/Super Polarity/Actors/Ship.cs deleted file mode 100644 index 229f639..0000000 --- a/Super Polarity/Actors/Ship.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Ship : Actor - { - public enum Polarity : byte { Negative, Positive, Neutral }; - - public Polarity CurrentPolarity; - public uint MagneticRadius; - - public float FleeVelocity; - public float ActVelocity; - public float ChargeVelocity; - public int RepelRadius; - - protected bool Magnetizing; - - public Ship(SuperPolarity newGame) : base(newGame) { - MagneticRadius = 250; - RepelRadius = 100; - - HP = 2; - - FleeVelocity = 5; - ActVelocity = 1; - ChargeVelocity = 2.5f; - CurrentPolarity = Polarity.Neutral; - Magnetizing = false; - } - - public virtual void SwitchPolarity() - { - if (CurrentPolarity == Polarity.Positive) - { - CurrentPolarity = Polarity.Negative; - } - else - { - CurrentPolarity = Polarity.Positive; - } - } - - public virtual void SetPolarity(Polarity newPolarity) - { - CurrentPolarity = newPolarity; - } - - public virtual void Shoot() - { - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - Magnetizing = false; - } - - public virtual void Magnetize(Ship ship, float distance, float angle) - { - Magnetizing = true; - Polarity polarity = ship.CurrentPolarity; - - if (polarity != CurrentPolarity) - { - Attract(angle); - } - else - { - Repel(distance, angle); - } - } - - protected void Attract(float angle) - { - Velocity.X = (float) (ChargeVelocity * Math.Cos(angle)); - Velocity.Y = (float) (ChargeVelocity * Math.Sin(angle)); - } - - protected void Repel(float distance, float angle) - { - if (distance > RepelRadius) { Magnetizing = false; return; } - Velocity.X = -(float)(FleeVelocity * Math.Cos(angle)); - Velocity.Y = -(float)(FleeVelocity * Math.Sin(angle)); - } - } -} diff --git a/Super Polarity/Actors/StandardShip.cs b/Super Polarity/Actors/StandardShip.cs deleted file mode 100644 index ef2fe7f..0000000 --- a/Super Polarity/Actors/StandardShip.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Content; -using System.Security.Cryptography; - -namespace SuperPolarity -{ - class StandardShip : Ship - { - - protected bool Flashing; - protected int ChangeRate; - protected int CurrentTime; - public int AngleChangeProbability; - protected int BouncePadding; - protected float RotationFactor; - protected Random Random; - protected bool AddingAngle; - - public StandardShip(SuperPolarity newGame) : base(newGame) {} - - public override void Initialize(Texture2D texture, Vector2 position) - { - base.Initialize(texture, position); - - var cryptoResult = new byte[4]; - new RNGCryptoServiceProvider().GetBytes(cryptoResult); - - ChangeRate = 50; - AngleChangeProbability = 50; - BouncePadding = 0; - MaxVelocity = 2; - CurrentTime = 0; - RotationFactor = (float) (3 * Math.PI / 180); - Random = new Random(BitConverter.ToInt32(cryptoResult, 0)); - AddingAngle = true; - } - - public override void Magnetize(Ship ship, float distance, float angle) - { - if (ship.GetType() == typeof(MainShip)) { - base.Magnetize(ship, distance, angle); - } - } - - public override void Update(GameTime gameTime) - { - CurrentTime += gameTime.ElapsedGameTime.Milliseconds; - if (!Magnetizing) - { - AutoMove(); - BounceBack(); - } - ChangeAngle(); - Position += Velocity; - UpdateBox(); - Magnetizing = false; - - if (Flashing) - { - Color = new Color(255, 255, 255, 128); - Flashing = false; - } - else - { - Color = Color.White; - } - } - - protected void AutoMove() - { - float newAngle = Angle; - - if (CurrentTime < ChangeRate) - { - return; - } - - if (Random.Next(AngleChangeProbability) == 2) - { - AddingAngle = !AddingAngle; - } - - CurrentTime = 0; - - if (AddingAngle) - { - newAngle += (float) ( Random.NextDouble() * RotationFactor); - } - else - { - newAngle -= (float) (Random.NextDouble() * RotationFactor); - } - - Velocity.X = (float) (MaxVelocity * Math.Cos(newAngle)); - Velocity.Y = (float) (MaxVelocity * Math.Sin(newAngle)); - } - - protected void BounceBack() - { - if (Position.X + Width < -BouncePadding && Velocity.X < 0) - { - Velocity.X = -Velocity.X; - } - - if (Position.Y + Height < -BouncePadding && Velocity.Y < 0) - { - Velocity.Y = -Velocity.Y; - } - - if (Position.X > game.GraphicsDevice.Viewport.Width + BouncePadding && Velocity.X > 0) - { - Velocity.X = -Velocity.X; - } - - if (Position.Y > game.GraphicsDevice.Viewport.Height + BouncePadding && Velocity.Y > 0) - { - Velocity.Y = -Velocity.Y; - } - } - - public override void Collide(Actor other, Rectangle collision) - { - if (Dying) - { - return; - } - - if (other.GetType() == typeof(MainShip)) - { - Die(); - return; - } - - if (other.GetType() == typeof(Bullet)) - { - var theBullet = (Bullet)other; - TakeDamage(theBullet.Power); - Flashing = true; - } - } - - protected override void Die() - { - ActorManager.CheckOut(this); - Renderer.CheckOut(this); - game.Player.AddScore(Value); - game.Player.AddMultiplier(1); - } - } -} diff --git a/Super Polarity/BasicGenerator.cs b/Super Polarity/BasicGenerator.cs deleted file mode 100644 index ba51742..0000000 --- a/Super Polarity/BasicGenerator.cs +++ /dev/null @@ -1,77 +0,0 @@ -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; - CurrentTime = rate; - } - - public void Update(GameTime gameTime) - { - if (ActorManager.CountBaddies() > 50) - { - return; - } - - 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) - { - Renderer.CheckIn(ActorFactory.CreateShip(polarity, Position)); - } - - if (ShipType == Ships.Scout) - { - Renderer.CheckIn(ActorFactory.CreateScout(polarity, Position)); - } - - if (ShipType == Ships.Battlecruiser) - { - Renderer.CheckIn(ActorFactory.CreateCruiser(polarity, Position)); - } - - } - } -} diff --git a/Super Polarity/Content/Fonts/SegoeUIMono14.xnb b/Super Polarity/Content/Fonts/SegoeUIMono14.xnb deleted file mode 100644 index 51c4abd..0000000 Binary files a/Super Polarity/Content/Fonts/SegoeUIMono14.xnb and /dev/null differ diff --git a/Super Polarity/Content/Fonts/bigfont.xnb b/Super Polarity/Content/Fonts/bigfont.xnb deleted file mode 100644 index c1d876c..0000000 Binary files a/Super Polarity/Content/Fonts/bigfont.xnb and /dev/null differ diff --git a/Super Polarity/Content/Fonts/smallfont.xnb b/Super Polarity/Content/Fonts/smallfont.xnb deleted file mode 100644 index a87e66a..0000000 Binary files a/Super Polarity/Content/Fonts/smallfont.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/circle.xnb b/Super Polarity/Content/Graphics/circle.xnb deleted file mode 100644 index 3471449..0000000 Binary files a/Super Polarity/Content/Graphics/circle.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/diamond.xnb b/Super Polarity/Content/Graphics/diamond.xnb deleted file mode 100644 index 8bda70c..0000000 Binary files a/Super Polarity/Content/Graphics/diamond.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/main-ship.xnb b/Super Polarity/Content/Graphics/main-ship.xnb deleted file mode 100644 index 7108e2f..0000000 Binary files a/Super Polarity/Content/Graphics/main-ship.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/negative-cruiser.xnb b/Super Polarity/Content/Graphics/negative-cruiser.xnb deleted file mode 100644 index 5c9f41d..0000000 Binary files a/Super Polarity/Content/Graphics/negative-cruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/negative-destroyer.xnb b/Super Polarity/Content/Graphics/negative-destroyer.xnb deleted file mode 100644 index fe13745..0000000 Binary files a/Super Polarity/Content/Graphics/negative-destroyer.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/negative-scout.xnb b/Super Polarity/Content/Graphics/negative-scout.xnb deleted file mode 100644 index a5a2e7a..0000000 Binary files a/Super Polarity/Content/Graphics/negative-scout.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/negative-ship.xnb b/Super Polarity/Content/Graphics/negative-ship.xnb deleted file mode 100644 index ed41216..0000000 Binary files a/Super Polarity/Content/Graphics/negative-ship.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/negative-supercruiser.xnb b/Super Polarity/Content/Graphics/negative-supercruiser.xnb deleted file mode 100644 index b77f364..0000000 Binary files a/Super Polarity/Content/Graphics/negative-supercruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/neutral-cruiser.xnb b/Super Polarity/Content/Graphics/neutral-cruiser.xnb deleted file mode 100644 index ac99113..0000000 Binary files a/Super Polarity/Content/Graphics/neutral-cruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/neutral-destroyer.xnb b/Super Polarity/Content/Graphics/neutral-destroyer.xnb deleted file mode 100644 index 69b5924..0000000 Binary files a/Super Polarity/Content/Graphics/neutral-destroyer.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/neutral-scout.xnb b/Super Polarity/Content/Graphics/neutral-scout.xnb deleted file mode 100644 index 5e9ff59..0000000 Binary files a/Super Polarity/Content/Graphics/neutral-scout.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/neutral-ship.xnb b/Super Polarity/Content/Graphics/neutral-ship.xnb deleted file mode 100644 index 04259be..0000000 Binary files a/Super Polarity/Content/Graphics/neutral-ship.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/neutral-supercruiser.xnb b/Super Polarity/Content/Graphics/neutral-supercruiser.xnb deleted file mode 100644 index 1389842..0000000 Binary files a/Super Polarity/Content/Graphics/neutral-supercruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/pause-screen.xnb b/Super Polarity/Content/Graphics/pause-screen.xnb deleted file mode 100644 index 2307009..0000000 Binary files a/Super Polarity/Content/Graphics/pause-screen.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/polaritydemotitle.xnb b/Super Polarity/Content/Graphics/polaritydemotitle.xnb deleted file mode 100644 index 2fa9cf3..0000000 Binary files a/Super Polarity/Content/Graphics/polaritydemotitle.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/positive-cruiser.xnb b/Super Polarity/Content/Graphics/positive-cruiser.xnb deleted file mode 100644 index b65d2bd..0000000 Binary files a/Super Polarity/Content/Graphics/positive-cruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/positive-destroyer.xnb b/Super Polarity/Content/Graphics/positive-destroyer.xnb deleted file mode 100644 index d773175..0000000 Binary files a/Super Polarity/Content/Graphics/positive-destroyer.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/positive-scout.xnb b/Super Polarity/Content/Graphics/positive-scout.xnb deleted file mode 100644 index 2b8f9fe..0000000 Binary files a/Super Polarity/Content/Graphics/positive-scout.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/positive-ship.xnb b/Super Polarity/Content/Graphics/positive-ship.xnb deleted file mode 100644 index e4e21f1..0000000 Binary files a/Super Polarity/Content/Graphics/positive-ship.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/positive-supercruiser.xnb b/Super Polarity/Content/Graphics/positive-supercruiser.xnb deleted file mode 100644 index 2ecca79..0000000 Binary files a/Super Polarity/Content/Graphics/positive-supercruiser.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/square.xnb b/Super Polarity/Content/Graphics/square.xnb deleted file mode 100644 index 5a88d89..0000000 Binary files a/Super Polarity/Content/Graphics/square.xnb and /dev/null differ diff --git a/Super Polarity/Content/Graphics/star.xnb b/Super Polarity/Content/Graphics/star.xnb deleted file mode 100644 index 763addf..0000000 Binary files a/Super Polarity/Content/Graphics/star.xnb and /dev/null differ diff --git a/Super Polarity/Content/Sound/bomb.wav b/Super Polarity/Content/Sound/bomb.wav deleted file mode 100644 index 5af439b..0000000 Binary files a/Super Polarity/Content/Sound/bomb.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/bullet.wav b/Super Polarity/Content/Sound/bullet.wav deleted file mode 100644 index 6586489..0000000 Binary files a/Super Polarity/Content/Sound/bullet.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/gameover.wav b/Super Polarity/Content/Sound/gameover.wav deleted file mode 100644 index cac9d23..0000000 Binary files a/Super Polarity/Content/Sound/gameover.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/hit.wav b/Super Polarity/Content/Sound/hit.wav deleted file mode 100644 index 43433cd..0000000 Binary files a/Super Polarity/Content/Sound/hit.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/life.wav b/Super Polarity/Content/Sound/life.wav deleted file mode 100644 index a1d0436..0000000 Binary files a/Super Polarity/Content/Sound/life.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/polaritychange.wav b/Super Polarity/Content/Sound/polaritychange.wav deleted file mode 100644 index 25b59a4..0000000 Binary files a/Super Polarity/Content/Sound/polaritychange.wav and /dev/null differ diff --git a/Super Polarity/Content/Sound/polaritytheme.wav b/Super Polarity/Content/Sound/polaritytheme.wav deleted file mode 100644 index 28a6bce..0000000 Binary files a/Super Polarity/Content/Sound/polaritytheme.wav and /dev/null differ diff --git a/Super Polarity/GameScreen.cs b/Super Polarity/GameScreen.cs deleted file mode 100644 index 783e3c1..0000000 --- a/Super Polarity/GameScreen.cs +++ /dev/null @@ -1,209 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Media; -using Microsoft.Xna.Framework.Input; - -namespace SuperPolarity -{ - class GameScreen : Screen - { - public GameScreen(SuperPolarity newGame) : base(newGame) {} - - protected List Generators; - - protected int LivesRate; - protected int CurrentLivesRate; - protected int BombRate; - protected int CurrentBombRate; - protected SoundEffect BombSound; - protected SoundEffect LifeSound; - - protected bool Flashing; - - protected bool IsPaused; - protected Texture2D PauseScreen; - - public override void Initialize() - { - Generators = new List(); - - CurrentBombRate = 1; - BombRate = 6000; - - LivesRate = 10000; - CurrentLivesRate = 1; - - InputController.RegisterEventForButton("changePolarity", Buttons.A); - InputController.RegisterEventForKey("changePolarity", Keys.Z); - - InputController.RegisterEventForButton("shoot", Buttons.X); - InputController.RegisterEventForKey("shoot", Keys.X); - - InputController.Bind("pause", HandlePause); - - PauseScreen = Game.Content.Load("Graphics\\pause-screen"); - } - - protected void HandlePause(float value) - { - Console.WriteLine("Paused"); - IsPaused = !IsPaused; - - if (IsPaused) - { - MediaPlayer.Volume = 0.05f; - } - else - { - MediaPlayer.Volume = 1; - } - } - - public override void LoadContent() - { - CreateGenerators(); - - Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X + Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); - - BombSound = Game.Content.Load("Sound\\bomb"); - LifeSound = Game.Content.Load("Sound\\life"); - - Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); - - Game.PlaySong("game"); - } - - protected void CalculateBomb() - { - if (Game.Player.Score >= BombRate * CurrentBombRate) - { - ActorManager.Bomb(); - Flashing = true; - BombSound.Play(); - CurrentBombRate = CurrentBombRate + 1; - } - } - - protected void CalculateLife() - { - if (Game.Player.Score >= LivesRate * CurrentLivesRate) - { - Game.Player.Lives = Game.Player.Lives + 1; - LifeSound.Play(); - CurrentLivesRate = CurrentLivesRate + 1; - } - } - - public override void Update(GameTime gameTime) - { - CalculateBomb(); - CalculateLife(); - InputController.UpdateInput(IsPaused); - if (IsPaused) - { - return; - } - ActorManager.Update(gameTime); - - foreach (BasicGenerator generator in Generators) - { - generator.Update(gameTime); - } - } - - public override void Draw(SpriteBatch spriteBatch) - { - Renderer.Draw(spriteBatch); - Game.Player.Draw(spriteBatch); - - if (IsPaused) - { - spriteBatch.Draw(PauseScreen, new Vector2(0, 0), Color.White); - } - - if (Flashing) - { - Game.GraphicsDevice.Clear(Color.Black); - Flashing = false; - } - } - - protected void CreateGenerators() - { - // The basic ship generators. - var gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(-50, -50), BasicGenerator.Ships.Ship, 3000, 0); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, -50), BasicGenerator.Ships.Ship, 3000, 0); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); - Generators.Add(gen); - - // After 1.5k liberate some sporadic Scouts, and add two more ship generators. - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 3000, 1500); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 1500); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); - Generators.Add(gen); - - - // After 3k add more scouts. - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Scout, 3000, 3000); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Scout, 3000, 5000); - Generators.Add(gen); - - // After 5k release more ships and a cruiser. - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 1500, 5000); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 1500, 5000); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); - Generators.Add(gen); - - gen = new BasicGenerator(); - gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); - Generators.Add(gen); - } - - public override void CleanUp() - { - base.CleanUp(); - Generators.Clear(); - InputController.Unbind("pause", HandlePause); - Renderer.Empty(); - ActorManager.Empty(); - } - } -} diff --git a/Super Polarity/Icon.ico b/Super Polarity/Icon.ico deleted file mode 100644 index 13be62a..0000000 Binary files a/Super Polarity/Icon.ico and /dev/null differ diff --git a/Super Polarity/InputController.cs b/Super Polarity/InputController.cs deleted file mode 100644 index c92bb9c..0000000 --- a/Super Polarity/InputController.cs +++ /dev/null @@ -1,248 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework.Input; - -namespace SuperPolarity -{ - static class InputController - { - static Dictionary>> Listeners; - static Dictionary> RegisteredKeys; - static Dictionary> RegisteredButtons; - static List BlockedKeys; - static List BlockedButtons; - - static GamePadState InputGamePadState; - static KeyboardState InputKeyboardState; - - /* - * Registered Events. - * - * You register: name of the event (ie. attack) and a key associated with it. - * or button... Left Stick /always/ dispatches move event. - */ - - static InputController() - { - Listeners = new Dictionary>>(); - RegisteredButtons = new Dictionary>(); - RegisteredKeys = new Dictionary>(); - BlockedKeys = new List(); - BlockedButtons = new List(); - InputKeyboardState = new KeyboardState(); - InputGamePadState = new GamePadState(); - } - - public static void UpdateInput() - { - DispatchMoveEvents(); - DispatchRegisteredEvents(); - } - - public static void UpdateInput(bool highPriorityOnly) - { - Poll(); - DispatchPauseEvent(); - if (!highPriorityOnly) - { - UpdateInput(); - } - } - - public static void DispatchPauseEvent() - { - // OK THIS IS ALL KINDS OF WRONG. THIS IS A PLACEHOLDER BECAUSE DEMO! - var keyPressed = false; - if ((InputKeyboardState.IsKeyDown(Keys.Enter) || InputGamePadState.IsButtonDown(Buttons.Start))) { - keyPressed = true; - if(!BlockedButtons.Contains("pause") && !BlockedKeys.Contains("pause")) - { - BlockedButtons.Add("pause"); - BlockedKeys.Add("pause"); - Console.WriteLine("Dispatch"); - Dispatch("pause", 0); - } - } - - if (!keyPressed) - { - BlockedButtons.Remove("pause"); - BlockedKeys.Remove("pause"); - } - } - - private static void Poll() - { - InputGamePadState = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One); - InputKeyboardState = Keyboard.GetState(); - } - - public static void RegisterEventForKey(string eventName, Keys key) - { - List newKeyList; - if (!RegisteredKeys.ContainsKey(eventName)) - { - newKeyList = new List(); - RegisteredKeys.Add(eventName, newKeyList); - } - - RegisteredKeys.TryGetValue(eventName, out newKeyList); - - newKeyList.Add(key); - } - - public static void RegisterEventForButton(string eventName, Buttons button) - { - List newButtonList; - if (!RegisteredButtons.ContainsKey(eventName)) - { - newButtonList = new List(); - RegisteredButtons.Add(eventName, newButtonList); - } - - RegisteredButtons.TryGetValue(eventName, out newButtonList); - - newButtonList.Add(button); - } - - private static void DispatchRegisteredEvents() - { - var keyFired = false; - - foreach (KeyValuePair> entry in RegisteredKeys) { - keyFired = false; - foreach (Keys key in entry.Value) - { - if (InputKeyboardState.IsKeyDown(key)) - { - if (!BlockedKeys.Contains(entry.Key)) - { - BlockedKeys.Add(entry.Key); - Dispatch(entry.Key, 1); - } - keyFired = true; - break; - } - } - - if (!keyFired) - { - BlockedKeys.Remove(entry.Key); - } - } - - foreach (KeyValuePair> entry in RegisteredButtons) - { - keyFired = false; - foreach (Buttons button in entry.Value) - { - if (InputGamePadState.IsButtonDown(button)) - { - if (!BlockedButtons.Contains(entry.Key)) - { - BlockedButtons.Add(entry.Key); - Dispatch(entry.Key, 1); - } - keyFired = true; - break; - }; - } - - if (!keyFired) - { - BlockedButtons.Remove(entry.Key); - } - } - } - - private static void DispatchMoveEvents() - { - float xMovement = 0.0f; - float yMovement = 0.0f; - // Dispatch the moveX / MoveY events every frame. - - xMovement = InputGamePadState.ThumbSticks.Left.X; - yMovement = -InputGamePadState.ThumbSticks.Left.Y; - - if (InputKeyboardState.IsKeyDown(Keys.Left)) - { - xMovement = -1.0f; - } - - if (InputKeyboardState.IsKeyDown(Keys.Right)) - { - xMovement = 1.0f; - } - - if (InputKeyboardState.IsKeyDown(Keys.Up)) - { - yMovement = -1.0f; - } - - if (InputKeyboardState.IsKeyDown(Keys.Down)) - { - yMovement = 1.0f; - } - - Dispatch("moveX", xMovement); - Dispatch("moveY", yMovement); - } - - public static void Bind(string eventName, Action listener) - { - List> newListenerList; - List> listenerList; - bool foundListeners; - - if (!Listeners.ContainsKey(eventName)) { - newListenerList = new List>(); - Listeners.Add(eventName, newListenerList); - } - - foundListeners = Listeners.TryGetValue(eventName, out listenerList); - - listenerList.Add(listener); - } - - public static void Unbind(string eventName, Action listener) - { - List> listenerList; - bool foundListeners; - - if (!Listeners.ContainsKey(eventName)) - { - return; - } - - foundListeners = Listeners.TryGetValue(eventName, out listenerList); - - listenerList.Remove(listener); - } - - public static void Dispatch(string eventName, float value) - { - List> listenerList; - bool foundListeners; - - foundListeners = Listeners.TryGetValue(eventName, out listenerList); - - if (!foundListeners) - { - return; - } - - for (var i = listenerList.Count - 1; i >= 0; i--) - { - listenerList[i](value); - } - } - - public static void Unlock(string eventName) - { - BlockedButtons.Remove(eventName); - BlockedKeys.Remove(eventName); - } - } -} diff --git a/Super Polarity/LetterChooseWidget.cs b/Super Polarity/LetterChooseWidget.cs deleted file mode 100644 index e52733f..0000000 --- a/Super Polarity/LetterChooseWidget.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class LetterChooseWidget : Widget - { - int CurrentChar; - bool Locked; - int LockRate; - int CurrentTime; - - SpriteFont Font; - - public LetterChooseWidget(SuperPolarity game, Vector2 position) : base(game, position) - { - Active = false; - CurrentChar = 65; - Font = game.Content.Load("Fonts\\bigfont"); - LockRate = 300; - CurrentTime = 0; - - InputController.Bind("moveY", HandleMovement); - } - - public void HandleMovement(float value) - { - if (!Active) { return; } - - if (value > 0.8 && !Locked) { - CurrentChar = CurrentChar + 1; - - if (CurrentChar > 90) - { - CurrentChar = 32; - } - - Locked = true; - } - - if (value < -0.8 && !Locked) { - CurrentChar = CurrentChar - 1; - - if (CurrentChar < 32) - { - CurrentChar = 90; - } - - Locked = true; - } - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - - CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; - if (CurrentTime > LockRate) - { - CurrentTime = 0; - Locked = false; - } - } - - public string Value() - { - return char.ConvertFromUtf32(CurrentChar); - } - - public override void Draw(SpriteBatch spriteBatch) - { - var color = new Color(0, 0, 0, 128); - if (Active) - { - color = new Color(201, 0, 68, 255); - } - spriteBatch.DrawString(Font, Value(), Position, color); - } - } -} diff --git a/Super Polarity/MenuItem.cs b/Super Polarity/MenuItem.cs deleted file mode 100644 index 8e24c97..0000000 --- a/Super Polarity/MenuItem.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace SuperPolarity -{ - class MenuItem - { - } -} diff --git a/Super Polarity/MenuWidget.cs b/Super Polarity/MenuWidget.cs deleted file mode 100644 index 992ef43..0000000 --- a/Super Polarity/MenuWidget.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace SuperPolarity -{ - class MenuWidget - { - } -} diff --git a/Super Polarity/NameChooserWidget.cs b/Super Polarity/NameChooserWidget.cs deleted file mode 100644 index ce7c149..0000000 --- a/Super Polarity/NameChooserWidget.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class NameChooserWidget : Widget - { - int CurrentIndex; - bool Lock; - int LockRate; - int CurrentTime; - - public NameChooserWidget(SuperPolarity game, Vector2 position) - : base(game, position) - { - AppendChild(new LetterChooseWidget(game, new Vector2(position.X, position.Y))); - AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 32, position.Y))); - AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 64, position.Y))); - CurrentIndex = 0; - Children[CurrentIndex].Activate(); - LockRate = 300; - CurrentTime = 0; - - InputController.Bind("moveX", HandleMovement); - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - - CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; - if (CurrentTime > LockRate) - { - CurrentTime = 0; - Lock = false; - } - - foreach (LetterChooseWidget widget in Children) - { - widget.Update(gameTime); - } - } - - public void HandleMovement(float value) - { - if (value > 0.8 && !Lock) - { - Children[CurrentIndex].Deactivate(); - CurrentIndex = CurrentIndex + 1; - - if (CurrentIndex > Children.Count - 1) - { - CurrentIndex = 0; - } - - Lock = true; - } - - if (value < -0.8 && !Lock) - { - Children[CurrentIndex].Deactivate(); - CurrentIndex = CurrentIndex - 1; - - if (CurrentIndex < 0) - { - CurrentIndex = Children.Count - 1; - } - - Lock = true; - } - - Children[CurrentIndex].Activate(); - } - - public string Value() - { - var name = ""; - - foreach (LetterChooseWidget letter in Children) - { - name = name + letter.Value(); - } - - return name; - } - - public override void Draw(SpriteBatch spriteBatch) - { - foreach (LetterChooseWidget widget in Children) - { - widget.Draw(spriteBatch); - } - } - } -} diff --git a/Super Polarity/Particle.cs b/Super Polarity/Particle.cs deleted file mode 100644 index d65bac6..0000000 --- a/Super Polarity/Particle.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Particle - { - public Texture2D Texture { get; set; } - public Vector2 Position { get; set; } - public Vector2 Velocity { get; set; } - public float Angle { get; set; } - public float AngularVelocity { get; set; } - public Color Color { get; set; } - public float Size { get; set; } - public int TTL { get; set; } - - public Particle(Texture2D texture, Vector2 position, Vector2 velocity, - float angle, float angularVelocity, Color color, float size, int ttl) - { - Texture = texture; - Position = position; - Velocity = velocity; - Angle = angle; - AngularVelocity = angularVelocity; - Color = color; - Size = size; - TTL = ttl; - } - - public void Update() - { - TTL--; - Position += Velocity; - Angle += AngularVelocity; - } - - public void Draw(SpriteBatch spriteBatch) - { - Rectangle sourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height); - Vector2 origin = new Vector2(Texture.Width / 2, Texture.Height / 2); - - spriteBatch.Draw(Texture, Position, sourceRectangle, Color, - Angle, origin, Size, SpriteEffects.None, 0f); - } - - } -} diff --git a/Super Polarity/ParticleEffectFactory.cs b/Super Polarity/ParticleEffectFactory.cs deleted file mode 100644 index 0cd9ed3..0000000 --- a/Super Polarity/ParticleEffectFactory.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - static class ParticleEffectFactory - { - static Game Game; - static Random random; - - static ParticleEffectFactory() - { - random = new Random(); - } - - public static ParticleEngine CreatePolarCircle(Vector2 location) - { - List texturesList = new List(); - - //texturesList.Add(Game.Content.Load("Graphics\\circle")); - texturesList.Add(Game.Content.Load("Graphics\\diamond")); - texturesList.Add(Game.Content.Load("Graphics\\square")); - - ParticleEngine particleEngine = new ParticleEngine(texturesList, location); - - particleEngine.Color = new Color(239, 203, 204); - particleEngine.TTL = 10; - particleEngine.TTLRandomFactor = 5; - particleEngine.ScatterFactor = 40; - particleEngine.ParticleCount = 50; - particleEngine.StretchFactor = 2.8f; - - - return particleEngine; - } - - public static ParticleEngine CreateBullet(Vector2 location) - { - List texturesList = new List(); - - texturesList.Add(Game.Content.Load("Graphics\\circle")); - //texturesList.Add(Game.Content.Load("Graphics\\diamond")); - texturesList.Add(Game.Content.Load("Graphics\\square")); - - ParticleEngine particleEngine = new ParticleEngine(texturesList, location); - - particleEngine.Color = Color.Gray; - particleEngine.TTL = 5; - particleEngine.TTLRandomFactor = 5; - particleEngine.ScatterFactor = 5; - particleEngine.ParticleCount = 10; - particleEngine.StretchFactor = 1; - - return particleEngine; - } - - internal static void SetGame(Game game) - { - ParticleEffectFactory.Game = game; - } - } -} diff --git a/Super Polarity/ParticleEngine.cs b/Super Polarity/ParticleEngine.cs deleted file mode 100644 index 51188ae..0000000 --- a/Super Polarity/ParticleEngine.cs +++ /dev/null @@ -1,86 +0,0 @@ -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; } - public Color Color; //TODO: Color list for random colors. - public int TTL; - public int TTLRandomFactor; - public int ScatterFactor; - public int ParticleCount; - public float StretchFactor; - private List particles; - private List textures; - - public ParticleEngine(List textures, Vector2 location) - { - EmitterLocation = location; - this.textures = textures; - this.particles = new List(); - random = new Random(); - Color = Color.Red; - TTL = 20; - TTLRandomFactor = 40; - StretchFactor = 1; - } - - 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 = Color; - float size = (float)random.NextDouble() * StretchFactor; - - position.X += random.Next(-ScatterFactor, ScatterFactor); - position.Y += random.Next(-ScatterFactor, ScatterFactor); - - int ttl = TTL + random.Next(TTLRandomFactor); - - 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(); - } - } -} diff --git a/Super Polarity/Player.cs b/Super Polarity/Player.cs deleted file mode 100644 index 184abdd..0000000 --- a/Super Polarity/Player.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - public class Player - { - public int Score; - public int Multiplier; - public int Lives; - - - SpriteFont DebugFont; - SuperPolarity Game; - - Texture2D LifeSprite; - - public Player(SuperPolarity game) - { - Score = 0; - Multiplier = 1; - Lives = 3; - Game = game; - DebugFont = Game.Content.Load("Fonts\\bigfont"); - LifeSprite = Game.Content.Load("Graphics\\neutral-ship"); - } - - public void AddScore(int value) - { - Score = Score + (value * Multiplier); - } - - public void AddMultiplier(int value) - { - Multiplier = Multiplier + 1; - } - - public void ResetMultiplier() - { - Multiplier = 1; - } - - public void Draw(SpriteBatch spriteBatch) - { - var UiColor = new Color(0, 0, 0, 200); - var lightColor = new Color(0, 0, 0, 128); - spriteBatch.DrawString(DebugFont, Score.ToString(), new Vector2(40, 30), UiColor); - spriteBatch.DrawString(DebugFont, "x" + Multiplier.ToString(), new Vector2(40, 50), lightColor); - - var lifePosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 140, 30); - if (Lives > 4) - { - spriteBatch.Draw(LifeSprite, lifePosition, null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); - spriteBatch.DrawString(DebugFont, "x " + Lives.ToString(), new Vector2(lifePosition.X + 8, lifePosition.Y + 5), UiColor); - } - else - { - for (var i = 0; i < Lives; i++) - { - spriteBatch.Draw(LifeSprite, new Vector2(lifePosition.X + (i * 28), lifePosition.Y), null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); - } - } - } - - public void Update() - { - - } - - public void Reset() - { - Score = 0; - Multiplier = 1; - Lives = 3; - } - } -} diff --git a/Super Polarity/Program.cs b/Super Polarity/Program.cs deleted file mode 100644 index 6c3f614..0000000 --- a/Super Polarity/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -#endregion - -namespace SuperPolarity -{ -#if WINDOWS || LINUX - /// - /// The main class. - /// - public static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - using (var superPolarity = new SuperPolarity()) - superPolarity.Run(); - } - } -#endif -} diff --git a/Super Polarity/Properties/AssemblyInfo.cs b/Super Polarity/Properties/AssemblyInfo.cs deleted file mode 100644 index 91a7e87..0000000 --- a/Super Polarity/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Super Polarity")] -[assembly: AssemblyProduct("Super Polarity")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7f0aa81c-c9ab-4b87-97eb-3b788199ed3e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Super Polarity/Renderer.cs b/Super Polarity/Renderer.cs deleted file mode 100644 index 7ca8158..0000000 --- a/Super Polarity/Renderer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Renderer - { - - static List Actors; - - static Renderer() - { - Actors = new List(); - } - - static public void CheckIn(Actor actor) - { - Actors.Add(actor); - } - - static public void CheckOut(Actor actor) - { - Actors.Remove(actor); - } - - static public void Draw(SpriteBatch spriteBatch) - { - foreach (Actor actor in Actors) - { - actor.Draw(spriteBatch); - } - } - - static public void Empty() - { - Actors.Clear(); - } - } -} diff --git a/Super Polarity/ScoreScreen.cs b/Super Polarity/ScoreScreen.cs deleted file mode 100644 index bf43275..0000000 --- a/Super Polarity/ScoreScreen.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; - -namespace SuperPolarity -{ - class ScoreScreen : Screen - { - protected SpriteFont Font; - protected NameChooserWidget nameChooser; - protected Dictionary Scores; - - public ScoreScreen(SuperPolarity newGame) : base(newGame) { } - - public override void Initialize() - { - base.Initialize(); - nameChooser = new NameChooserWidget(Game, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 4)); - InputController.RegisterEventForButton("OK", Buttons.A); - InputController.RegisterEventForKey("OK", Keys.Z); - Scores = new Dictionary(); - ReadScore(); - } - - public override void LoadContent() - { - base.LoadContent(); - Font = Game.Content.Load("Fonts\\bigfont"); - InputController.Bind("OK", HandleNext); - } - - public void HandleNext(float value) - { - if (!Active) { return; } - WriteScore(); - ScreenManager.Pop(); - } - - public void WriteScore() - { - using (StreamWriter swriter = new StreamWriter("scores.txt", true)) - { - swriter.WriteLine(nameChooser.Value() + "," + Game.Player.Score.ToString()); - } - } - - public void ReadScore() - { - try - { - using (StreamReader sreader = new StreamReader("scores.txt")) - { - string line = null; - while ((line = sreader.ReadLine()) != null) - { - string[] parts = line.Split(','); - Scores.Add(parts[0], int.Parse(parts[1])); - } - } - } - catch (FileNotFoundException) - { - } - } - - public override void CleanUp() - { - base.CleanUp(); - Font = null; - } - - public override void Draw(SpriteBatch spriteBatch) - { - base.Draw(spriteBatch); - spriteBatch.DrawString(Font, "YOUR SCORE WAS: " + Game.Player.Score.ToString(), new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2), Color.Black); - spriteBatch.DrawString(Font, "Use Left Stick or Arrows to Choose Name Press A when done", new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 40), new Color(0, 0, 0, 128)); - nameChooser.Draw(spriteBatch); - DrawScores(spriteBatch); - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - InputController.UpdateInput(false); - nameChooser.Update(gameTime); - } - - protected void DrawScores(SpriteBatch spriteBatch) - { - var sortedDict = (from entry in Scores orderby entry.Value descending select entry) - .Take(5) - .ToDictionary(pair => pair.Key, pair => pair.Value); - - var i = 0; - - foreach (KeyValuePair entry in sortedDict) { - i++; - spriteBatch.DrawString(Font, entry.Key + " " + entry.Value, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 100 + (32 * i)), new Color(0, 0, 0, 64)); - } - - } - } -} diff --git a/Super Polarity/Screen.cs b/Super Polarity/Screen.cs deleted file mode 100644 index 006b047..0000000 --- a/Super Polarity/Screen.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Screen - { - protected SuperPolarity Game; - public bool Active; - public Screen(SuperPolarity game) - { - Active = false; - Game = game; - } - - public virtual void Update(GameTime gameTime) - { - } - - public virtual void Draw(SpriteBatch spriteBatch) - { - } - - public virtual void LoadContent() - { - } - - public virtual void Initialize() - { - } - - public virtual void CleanUp() - { - } - } -} diff --git a/Super Polarity/ScreenManager.cs b/Super Polarity/ScreenManager.cs deleted file mode 100644 index b88741b..0000000 --- a/Super Polarity/ScreenManager.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - static class ScreenManager - { - static Stack Screens; - static SuperPolarity Game; - - static ScreenManager() - { - Screens = new Stack(); - } - - static public void Push(Screen screen) - { - if (Screens.Count > 0) - { - Screens.Peek().Active = false; - } - - screen.LoadContent(); - screen.Active = true; - Screens.Push(screen); - } - - static public void Pop() - { - var screen = Screens.Pop(); - screen.Active = false; - screen.CleanUp(); - Screens.Peek().Active = true; - } - - static public void Update(GameTime gameTime) - { - Screens.Peek().Update(gameTime); - } - - static public void Draw(SpriteBatch spriteBatch) - { - Screens.Peek().Draw(spriteBatch); - } - - internal static void SetGame(SuperPolarity game) - { - Game = game; - } - } -} diff --git a/Super Polarity/Super Polarity.csproj b/Super Polarity/Super Polarity.csproj deleted file mode 100644 index 24cea5c..0000000 --- a/Super Polarity/Super Polarity.csproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {2585188B-339D-44CD-9599-1A80AA30DE13} - WinExe - Properties - SuperPolarity - Super Polarity - 512 - - - x86 - true - full - false - bin\WindowsGL\Debug\ - DEBUG;TRACE;WINDOWS - prompt - 4 - - - x86 - pdbonly - true - bin\WindowsGL\Release\ - TRACE;WINDOWS - prompt - 4 - - - Icon.ico - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\OpenTK.dll - - - ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll - - - ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\Lidgren.Network.dll - - - ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\Tao.Sdl.dll - - - - - - - SDL.dll - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - \ No newline at end of file diff --git a/Super Polarity/Super Polarity.csproj.user b/Super Polarity/Super Polarity.csproj.user deleted file mode 100644 index ace9a86..0000000 --- a/Super Polarity/Super Polarity.csproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs deleted file mode 100644 index 9311d53..0000000 --- a/Super Polarity/SuperPolarity.cs +++ /dev/null @@ -1,161 +0,0 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Storage; -using Microsoft.Xna.Framework.GamerServices; -using Microsoft.Xna.Framework.Media; -using Microsoft.Xna.Framework.Audio; -using SuperPolarity; -#endregion - -namespace SuperPolarity -{ - /// - /// This is the main type for your game - /// - public class SuperPolarity : Game - { - public GraphicsDeviceManager graphics; - SpriteBatch spriteBatch; - - public static int OutlierBounds; - - public Player Player; - - Screen EntryScreen; - - protected Song TitleSong; - protected Song GameSong; - protected SoundEffect GameOverSound; - - public SuperPolarity() - : base() - { - graphics = new GraphicsDeviceManager(this); - Components.Add(new GamerServicesComponent(this)); - - graphics.PreferMultiSampling = true; - graphics.PreferredBackBufferWidth = 1280; - graphics.PreferredBackBufferHeight = 720; - graphics.ToggleFullScreen(); - - Content.RootDirectory = "Content"; - ActorFactory.SetGame(this); - ParticleEffectFactory.SetGame(this); - ActorManager.SetGame(this); - ScreenManager.SetGame(this); - - EntryScreen = (Screen)new TitleScreen(this); - } - - /// - /// Allows the game to perform any initialization it needs to before starting to run. - /// This is where it can query for any required services and load any non-graphic - /// related content. Calling base.Initialize will enumerate through any components - /// and initialize them as well. - /// - protected override void Initialize() - { - base.Initialize(); - - InputController.RegisterEventForKey("fullScreenToggle", Keys.F11); - InputController.Bind("fullScreenToggle", HandleFullScreenToggle); - - EntryScreen.Initialize(); - - OutlierBounds = 100; - } - - protected void HandleFullScreenToggle(float value) - { - graphics.ToggleFullScreen(); - graphics.ApplyChanges(); - } - - /// - /// LoadContent will be called once per game and is the place to load - /// all of your content. - /// - protected override void LoadContent() - { - - MediaPlayer.IsRepeating = true; - GameSong = Content.Load("Sound\\polaritytheme.wav"); - GameOverSound = Content.Load("Sound\\gameover"); - - // Create a new SpriteBatch, which can be used to draw textures. - spriteBatch = new SpriteBatch(GraphicsDevice); - - ScreenManager.Push(EntryScreen); - - Player = new Player(this); - } - - /// - /// UnloadContent will be called once per game and is the place to unload - /// all content. - /// - protected override void UnloadContent() - { - // TODO: Unload any non ContentManager content here - } - - /// - /// Allows the game to run logic such as updating the world, - /// checking for collisions, gathering input, and playing audio. - /// - /// Provides a snapshot of timing values. - protected override void Update(GameTime gameTime) - { - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) - Exit(); - - ScreenManager.Update(gameTime); - - Player.Update(); - - base.Update(gameTime); - } - - /// - /// This is called when the game should draw itself. - /// - /// Provides a snapshot of timing values. - protected override void Draw(GameTime gameTime) - { - GraphicsDevice.Clear(Color.White); - - spriteBatch.Begin(); - - ScreenManager.Draw(spriteBatch); - - spriteBatch.End(); - - base.Draw(gameTime); - } - - public void PlaySong(string songName) - { - // temp stuff before media manager is in - if (songName == "game") - { - MediaPlayer.Play(GameSong); - } - } - - public void GameOver() - { - var scoreScreen = new ScoreScreen(this); - scoreScreen.Initialize(); - - MediaPlayer.Stop(); - GameOverSound.Play(); - ScreenManager.Pop(); - ScreenManager.Push(scoreScreen); - } - } -} diff --git a/Super Polarity/TitleScreen.cs b/Super Polarity/TitleScreen.cs deleted file mode 100644 index a953f27..0000000 --- a/Super Polarity/TitleScreen.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class TitleScreen : Screen - { - protected Texture2D TitleImage; - - public TitleScreen(SuperPolarity newGame) : base(newGame) {} - - public override void LoadContent() - { - base.LoadContent(); - TitleImage = Game.Content.Load("Graphics\\polaritydemotitle"); - InputController.Bind("pause", HandleStart); - } - - public void HandleStart(float value) - { - if (!Active) { return; } - Game.Player.Reset(); - var gameScreen = new GameScreen(Game); - gameScreen.Initialize(); - ScreenManager.Push(gameScreen); - } - - public override void CleanUp() - { - base.CleanUp(); - TitleImage = null; - } - - public override void Draw(SpriteBatch spriteBatch) - { - base.Draw(spriteBatch); - spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White); - } - - public override void Update(GameTime gameTime) - { - base.Update(gameTime); - InputController.UpdateInput(false); - } - } -} diff --git a/Super Polarity/Widget.cs b/Super Polarity/Widget.cs deleted file mode 100644 index ea92cfd..0000000 --- a/Super Polarity/Widget.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace SuperPolarity -{ - class Widget - { - public List Children; - public Dictionary>> Listeners; - - public Vector2 Position; - public SuperPolarity Game; - - protected bool Active; - - public Widget(SuperPolarity game, Vector2 position) - { - Game = game; - Position = position; - Active = false; - Children = new List(); - Listeners = new Dictionary>>(); - } - - public void Activate() - { - Active = true; - } - - public void Deactivate() - { - Active = false; - } - - public virtual void AppendChild(Widget widget) - { - Children.Add(widget); - } - - public virtual void Bind(string eventName, Action eventListener) - { - List> newListenerList; - List> listenerList; - bool foundListeners; - - if (!Listeners.ContainsKey(eventName)) - { - newListenerList = new List>(); - Listeners.Add(eventName, newListenerList); - } - - foundListeners = Listeners.TryGetValue(eventName, out listenerList); - - listenerList.Add(eventListener); - } - - public virtual void Unbind(string eventName, Action eventListener) - { - // NOT YET IMPLEMENTED; - } - - public virtual void Dispatch(string eventName, float value) - { - List> listenerList; - bool foundListeners; - - foundListeners = Listeners.TryGetValue(eventName, out listenerList); - - if (!foundListeners) - { - return; - } - - foreach (Action method in listenerList) - { - method(value); - } - } - - public virtual void Update(GameTime gameTime) - { - } - - public virtual void Draw(SpriteBatch spriteBatch) - { - } - } -} diff --git a/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe b/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe deleted file mode 100644 index bb84a51..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe.manifest b/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe.manifest deleted file mode 100644 index 061c9ca..0000000 --- a/Super Polarity/bin/WindowsGL/Debug/GameName1.vshost.exe.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Super Polarity/bin/WindowsGL/Debug/Lidgren.Network.dll b/Super Polarity/bin/WindowsGL/Debug/Lidgren.Network.dll deleted file mode 100644 index fd45367..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/Lidgren.Network.dll and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/MonoGame.Framework.dll b/Super Polarity/bin/WindowsGL/Debug/MonoGame.Framework.dll deleted file mode 100644 index c087ac2..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/MonoGame.Framework.dll and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/OpenTK.dll b/Super Polarity/bin/WindowsGL/Debug/OpenTK.dll deleted file mode 100644 index b1cd2e9..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/OpenTK.dll and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/SDL.dll b/Super Polarity/bin/WindowsGL/Debug/SDL.dll deleted file mode 100644 index 628cdfc..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/SDL.dll and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe deleted file mode 100644 index 746c670..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.exe and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb deleted file mode 100644 index fea49a1..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.pdb and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.vshost.exe b/Super Polarity/bin/WindowsGL/Debug/Super Polarity.vshost.exe deleted file mode 100644 index bb84a51..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/Super Polarity.vshost.exe and /dev/null differ diff --git a/Super Polarity/bin/WindowsGL/Debug/Tao.Sdl.dll b/Super Polarity/bin/WindowsGL/Debug/Tao.Sdl.dll deleted file mode 100644 index d2e2d47..0000000 Binary files a/Super Polarity/bin/WindowsGL/Debug/Tao.Sdl.dll and /dev/null differ diff --git a/Super Polarity/neutral-supercruiser.xnb b/Super Polarity/neutral-supercruiser.xnb deleted file mode 100644 index 1389842..0000000 Binary files a/Super Polarity/neutral-supercruiser.xnb and /dev/null differ diff --git a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache deleted file mode 100644 index ef9920b..0000000 Binary files a/Super Polarity/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ diff --git a/Super Polarity/obj/x86/Debug/ResolveAssemblyReference.cache b/Super Polarity/obj/x86/Debug/ResolveAssemblyReference.cache deleted file mode 100644 index d619ccb..0000000 Binary files a/Super Polarity/obj/x86/Debug/ResolveAssemblyReference.cache and /dev/null differ diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt b/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt deleted file mode 100644 index cabc9d2..0000000 --- a/Super Polarity/obj/x86/Debug/Super Polarity.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,42 +0,0 @@ -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\SDL.dll -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Super Polarity.exe -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Super Polarity.pdb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Lidgren.Network.dll -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\MonoGame.Framework.dll -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\OpenTK.dll -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Tao.Sdl.dll -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\obj\x86\Debug\ResolveAssemblyReference.cache -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\obj\x86\Debug\Super Polarity.exe -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\obj\x86\Debug\Super Polarity.pdb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\main-ship.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-cruiser.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-destroyer.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-scout.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\negative-supercruiser.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\neutral-cruiser.xnb -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\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 -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-ship.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\positive-supercruiser.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\circle.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\diamond.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\star.xnb -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 -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\polaritytheme.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\bullet.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\polaritychange.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\pause-screen.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Graphics\polaritydemotitle.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\gameover.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\bomb.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\hit.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Sound\life.wav -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\bigfont.xnb -C:\Users\Miau\documents\visual studio 2010\Projects\Super Polarity\Super Polarity\bin\WindowsGL\Debug\Content\Fonts\smallfont.xnb diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.exe b/Super Polarity/obj/x86/Debug/Super Polarity.exe deleted file mode 100644 index 746c670..0000000 Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.exe and /dev/null differ diff --git a/Super Polarity/obj/x86/Debug/Super Polarity.pdb b/Super Polarity/obj/x86/Debug/Super Polarity.pdb deleted file mode 100644 index fea49a1..0000000 Binary files a/Super Polarity/obj/x86/Debug/Super Polarity.pdb and /dev/null differ diff --git a/Super Polarity/scores.txt b/Super Polarity/scores.txt deleted file mode 100644 index e69de29..0000000 diff --git a/SuperPolarity.sln b/SuperPolarity.sln new file mode 100644 index 0000000..4037050 --- /dev/null +++ b/SuperPolarity.sln @@ -0,0 +1,162 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C# Express 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperPolarity", "SuperPolarity\SuperPolarity.csproj", "{2585188B-339D-44CD-9599-1A80AA30DE13}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperPolarity Content", "SuperPolarity Content\SuperPolarity Content\SuperPolarity Content.csproj", "{8528C189-5B94-48F8-8C64-D4D6658E52F6}" +EndProject +Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "SuperPolarity ContentContent", "SuperPolarity Content\SuperPolarity ContentContent\SuperPolarity ContentContent.contentproj", "{468F8415-7D38-4718-B0B4-E18F1A427136}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Android|Any CPU = Android|Any CPU + Android|Mixed Platforms = Android|Mixed Platforms + Android|x86 = Android|x86 + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + iOS|Any CPU = iOS|Any CPU + iOS|Mixed Platforms = iOS|Mixed Platforms + iOS|x86 = iOS|x86 + Linux|Any CPU = Linux|Any CPU + Linux|Mixed Platforms = Linux|Mixed Platforms + Linux|x86 = Linux|x86 + OSX|Any CPU = OSX|Any CPU + OSX|Mixed Platforms = OSX|Mixed Platforms + OSX|x86 = OSX|x86 + PSM|Any CPU = PSM|Any CPU + PSM|Mixed Platforms = PSM|Mixed Platforms + PSM|x86 = PSM|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + Windows|Any CPU = Windows|Any CPU + Windows|Mixed Platforms = Windows|Mixed Platforms + Windows|x86 = Windows|x86 + Windows8|Any CPU = Windows8|Any CPU + Windows8|Mixed Platforms = Windows8|Mixed Platforms + Windows8|x86 = Windows8|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Android|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Any CPU.ActiveCfg = Debug|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|x86.ActiveCfg = Debug|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Debug|x86.Build.0 = Debug|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.iOS|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Linux|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.OSX|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.PSM|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Release|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows|x86.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Any CPU.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Mixed Platforms.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|Mixed Platforms.Build.0 = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|x86.ActiveCfg = Release|x86 + {2585188B-339D-44CD-9599-1A80AA30DE13}.Windows8|x86.Build.0 = Release|x86 + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Any CPU.ActiveCfg = Android|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Any CPU.Build.0 = Android|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|Mixed Platforms.Build.0 = Android|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Android|x86.ActiveCfg = Android|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Any CPU.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Any CPU.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|Mixed Platforms.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Debug|x86.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Any CPU.ActiveCfg = iOS|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Any CPU.Build.0 = iOS|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|Mixed Platforms.Build.0 = iOS|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.iOS|x86.ActiveCfg = iOS|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Any CPU.ActiveCfg = Linux|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Any CPU.Build.0 = Linux|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|Mixed Platforms.Build.0 = Linux|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Linux|x86.ActiveCfg = Linux|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Any CPU.ActiveCfg = OSX|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Any CPU.Build.0 = OSX|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|Mixed Platforms.Build.0 = OSX|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.OSX|x86.ActiveCfg = OSX|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Any CPU.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Any CPU.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|Mixed Platforms.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.PSM|x86.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Any CPU.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Any CPU.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|Mixed Platforms.Build.0 = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Release|x86.ActiveCfg = PSM|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Any CPU.ActiveCfg = Windows|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Any CPU.Build.0 = Windows|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|Mixed Platforms.Build.0 = Windows|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows|x86.ActiveCfg = Windows|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Any CPU.Build.0 = Windows8|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|Mixed Platforms.Build.0 = Windows8|Any CPU + {8528C189-5B94-48F8-8C64-D4D6658E52F6}.Windows8|x86.ActiveCfg = Windows8|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|Any CPU.ActiveCfg = Android|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Android|x86.ActiveCfg = Android|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|Any CPU.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Debug|x86.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|Any CPU.ActiveCfg = iOS|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.iOS|x86.ActiveCfg = iOS|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|Any CPU.ActiveCfg = Linux|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Linux|x86.ActiveCfg = Linux|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|Any CPU.ActiveCfg = OSX|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.OSX|x86.ActiveCfg = OSX|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|Any CPU.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.PSM|x86.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|Any CPU.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Release|x86.ActiveCfg = PSM|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|Any CPU.ActiveCfg = Windows|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows|x86.ActiveCfg = Windows|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU + {468F8415-7D38-4718-B0B4-E18F1A427136}.Windows8|x86.ActiveCfg = Windows8|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SuperPolarity.userprefs b/SuperPolarity.userprefs new file mode 100644 index 0000000..0d7562c --- /dev/null +++ b/SuperPolarity.userprefs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/SuperPolarity/ActorFactory.cs b/SuperPolarity/ActorFactory.cs new file mode 100644 index 0000000..f9c7697 --- /dev/null +++ b/SuperPolarity/ActorFactory.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content; + +namespace SuperPolarity +{ + static class ActorFactory + { + static internal SuperPolarity Game; + + static public MainShip CreateMainShip(Vector2 position) + { + MainShip mainShip = new MainShip(Game); + mainShip.Initialize(Game.Content.Load("Graphics\\main-ship"), position); + + ActorManager.CheckIn(mainShip); + + return mainShip; + } + + static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position) + { + StandardShip ship = new StandardShip(Game); + Texture2D texture; + + if (polarity == Ship.Polarity.Positive) + { + texture = Game.Content.Load("Graphics\\positive-ship"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-ship"); + } + else + { + texture = Game.Content.Load("Graphics\\neutral-ship"); + } + + ship.Initialize(texture, position); + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + + return ship; + } + + internal static void SetGame(SuperPolarity game) + { + ActorFactory.Game = game; + } + + internal static Bullet CreateBullet(Vector2 position, float angle) + { + Bullet bullet = new Bullet(Game); + + bullet.Initialize(Game.Content.Load("Graphics\\square"), position); + + bullet.Angle = angle; + + ActorManager.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("Graphics\\positive-scout"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-scout"); + } + else + { + texture = Game.Content.Load("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.2f; + ship.FleeVelocity = 6.5f; + ship.ChargeVelocity = 5.5f; + ship.Value = 3; + ship.HP = 0; + ship.AngleChangeProbability = 20; + ship.SetPolarity(polarity); + + ActorManager.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("Graphics\\positive-cruiser"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-cruiser"); + } + else + { + texture = Game.Content.Load("Graphics\\neutral-cruiser"); + } + + ship.BoxDimensions.X = 40; + ship.BoxDimensions.Y = 40; + ship.BoxDimensions.W = 40; + ship.BoxDimensions.Z = 40; + + ship.Initialize(texture, position); + ship.MagneticRadius = 1000; + ship.RepelRadius = 200; + ship.MaxVelocity = 0.5f; + ship.FleeVelocity = 5; + ship.ChargeVelocity = 1; + ship.Value = 10; + ship.HP = 29; + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + + return ship; + } + } +} diff --git a/SuperPolarity/ActorManager.cs b/SuperPolarity/ActorManager.cs new file mode 100644 index 0000000..f5587b9 --- /dev/null +++ b/SuperPolarity/ActorManager.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ActorManager + { + + static SuperPolarity Game; + static int OutlierBounds; + static IList Actors; + + static ActorManager() + { + OutlierBounds = 100; + Actors = new List(); + } + + static public void CheckIn(Actor actor) + { + Actors.Add(actor); + } + + static public void CheckOut(Actor actor) + { + actor.CleanUp(); + Actors.Remove(actor); + actor = null; + } + + static public void Update(GameTime gameTime) + { + CheckActors(); + CheckOutliers(); + foreach (Actor actor in Actors) + { + actor.Update(gameTime); + } + } + + static public void Draw(SpriteBatch spriteBatch) + { + foreach (Actor actor in Actors) + { + actor.Draw(spriteBatch); + } + } + + static void CheckActors() + { + for (var i = Actors.Count - 1; i >= 0; i--) + { + if (i >= Actors.Count) { + i = Actors.Count - 1; + } + + if (Actors.Count == 0) + { + return; + } + + Actor actor = Actors[i]; + for (var j = i - 1; j >= 0; j--) + { + Actor other = Actors[j]; + + CheckCollision(actor, other); + + if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship))) + { + CheckMagnetism((Ship)actor, (Ship)other); + } + } + } + } + + static void CheckCollision(Actor actor, Actor other) + { + var collision = Rectangle.Intersect(actor.Box, other.Box); + var inverseCollision = Rectangle.Intersect(other.Box, actor.Box); + if (!collision.IsEmpty && !actor.Dying && !other.Dying) + { + actor.Collide(other, collision); + other.Collide(actor, inverseCollision); + } + + } + + static void CheckMagnetism(Ship actor, Ship other) + { + if (actor.CurrentPolarity != Ship.Polarity.Neutral && other.CurrentPolarity != Ship.Polarity.Neutral) + { + var dy = other.Position.Y - actor.Position.Y; + var dx = other.Position.X - actor.Position.X; + var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); + var angle = (float) Math.Atan2(dy, dx); + var otherAngle = (float)Math.Atan2(-dy, -dx); + + if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius) + { + actor.Magnetize(other, (float)linearDistance, angle); + other.Magnetize(actor, (float)linearDistance, otherAngle); + } + } + } + + static void CheckOutliers() + { + for (var i = Actors.Count; i > 0; i--) + { + var actor = Actors[i-1]; + if (actor.Position.X < -OutlierBounds || actor.Position.Y < -OutlierBounds || + actor.Position.X > Game.GraphicsDevice.Viewport.Width + OutlierBounds || + actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds) + { + CheckOut(actor); + if (actor.Parent != null) + { + actor.Parent.Children.Remove(actor); + } + } + } + } + + static public void Empty() + { + foreach (Actor actor in Actors) { + actor.CleanUp(); + } + Actors.Clear(); + } + + internal static void SetGame(SuperPolarity game) + { + Game = game; + } + + public static void Bomb() + { + for (var i = Actors.Count - 1; i >= 0; i--) + { + var actor = Actors[i]; + if (actor.GetType() == typeof(StandardShip)) + { + CheckOut(actor); + Renderer.CheckOut(actor); + } + } + } + + public static int CountBaddies() + { + return Actors.Where(a => a.GetType() == typeof(StandardShip)).Count(); + } + } +} diff --git a/SuperPolarity/Actors/Actor.cs b/SuperPolarity/Actors/Actor.cs new file mode 100644 index 0000000..3bb06be --- /dev/null +++ b/SuperPolarity/Actors/Actor.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Actor + { + protected SuperPolarity game; + + public List Children; + + // Graphics / In-Game + protected Texture2D Texture; + protected Vector2 Origin; + public bool Active; + public Rectangle Box; + public Vector4 BoxDimensions; + protected Texture2D BoxTexture; + + // Physical Properties + public Vector2 Position; + protected Vector2 Velocity; + protected Vector2 Acceleration; + public float Angle; + + // Constraints / Behavior + public float MaxVelocity; + protected float AccelerationRate; + public int HP; + protected bool Immortal; + public bool Dying; + public int Value; + protected Color Color; + + public Actor Parent; + + public int Width + { + get { return Texture.Width; } + } + + public int Height + { + get { return Texture.Height; } + } + + 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) + { + Texture = texture; + Position = position; + Active = true; + + Children = new List(); + + Origin = new Vector2(Texture.Width / 2, Texture.Height / 2); + Velocity = new Vector2(0, 0); + Acceleration = new Vector2(0, 0); + + MaxVelocity = 5; + AccelerationRate = 10; + + HP = 1; + Immortal = false; + + Dying = false; + Value = 1; + + InitBox(); + BoxTexture = new Texture2D(game.GraphicsDevice, 1, 1); + BoxTexture.SetData(new Color[] { Color.White }); + + Color = Color.White; + } + + protected void InitBox() + { + 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) + { + if (Acceleration.X == 0 && Velocity.X > 0) + { + if (AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds > Velocity.X) + { + Velocity.X = 0; + Acceleration.X = 0; + } + else + { + Acceleration.X = -AccelerationRate; + } + } + + if (Acceleration.X == 0 && Velocity.X < 0) + { + if (-AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds < Velocity.X) + { + Velocity.X = 0; + Acceleration.X = 0; + } + else + { + Acceleration.X = AccelerationRate; + } + } + + if (Acceleration.Y == 0 && Velocity.Y > 0) + { + if (AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds > Velocity.Y) + { + Velocity.Y = 0; + Acceleration.Y = 0; + } + else + { + Acceleration.Y = -AccelerationRate; + } + } + + if (Acceleration.Y == 0 && Velocity.Y < 0) + { + if (-AccelerationRate * gameTime.ElapsedGameTime.TotalSeconds < Velocity.Y) + { + Velocity.Y = 0; + Acceleration.Y = 0; + } + else + { + Acceleration.Y = AccelerationRate; + } + } + } + + public virtual void Update(GameTime gameTime) + { + Move(gameTime); + ChangeAngle(); + CheckOutliers(); + UpdateBox(); + } + + protected virtual void UpdateBox() + { + Box.X = (int)(Position.X - BoxDimensions.X); + Box.Y = (int)(Position.Y - BoxDimensions.Y); + } + + public virtual void Move(GameTime gameTime) + { + AutoDeccelerate(gameTime); + + var maxVelocity = MaxVelocity; + + Velocity.X = Velocity.X + Acceleration.X * (float)gameTime.ElapsedGameTime.TotalSeconds; + Velocity.Y = Velocity.Y + Acceleration.Y * (float)gameTime.ElapsedGameTime.TotalSeconds; + + if (Velocity.X > MaxVelocity) + { + Velocity.X = MaxVelocity; + } + + if (Velocity.X < -MaxVelocity) + { + Velocity.X = -MaxVelocity; + } + + if (Velocity.Y > MaxVelocity) + { + Velocity.Y = MaxVelocity; + } + + if (Velocity.Y < -MaxVelocity) + { + Velocity.Y = -MaxVelocity; + } + + Position.X = Position.X + Velocity.X; + Position.Y = Position.Y + Velocity.Y; + } + + 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); + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + Actor child = null; + + // TODO: Check what's up with the null children. + if (Children == null) + { + return; + } + for (var i = Children.Count - 1; i >= 0; i--) + { + child = Children[i]; + child.Draw(spriteBatch); + } + + spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f); + //spriteBatch.Draw(BoxTexture, Box, new Color(255, 0, 255, 25)); + } + + void CheckOutliers() + { + for (var i = Children.Count; i > 0; i--) + { + var actor = Children[i - 1]; + if (actor.Position.X < -SuperPolarity.OutlierBounds || actor.Position.Y < -SuperPolarity.OutlierBounds || + actor.Position.X > game.GraphicsDevice.Viewport.Width + SuperPolarity.OutlierBounds || + actor.Position.Y > game.GraphicsDevice.Viewport.Height + SuperPolarity.OutlierBounds) + { + Children.Remove(actor); + } + } + } + + public virtual void Collide(Actor other, Rectangle collision) + { + } + + public void TakeDamage(int amount) + { + if (!Immortal) + { + HP = HP - amount; + if (HP < 0) + { + Die(); + } + } + } + + protected virtual void Die() + { + Dying = true; + } + + public virtual void CleanUp() + { + Texture = null; + BoxTexture = null; + Children = null; + Texture = null; + } + } +} diff --git a/SuperPolarity/Actors/Bullet.cs b/SuperPolarity/Actors/Bullet.cs new file mode 100644 index 0000000..d20289c --- /dev/null +++ b/SuperPolarity/Actors/Bullet.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Bullet : Actor + { + protected ParticleEngine particleEngine; + public int Power; + + public Bullet(SuperPolarity newGame) + : base(newGame) + { + } + + ~Bullet() + { + particleEngine = null; + } + + public override void Initialize(Texture2D texture, Vector2 position) + { + base.Initialize(texture, position); + BoxDimensions.X = 10; + BoxDimensions.Y = 10; + BoxDimensions.W = 10; + BoxDimensions.Z = 10; + MaxVelocity = 8; + InitBox(); + particleEngine = ParticleEffectFactory.CreateBullet(position); + } + + public override void Update(GameTime gameTime) + { + Velocity.X = (float)(MaxVelocity * Math.Cos(Angle)); + Velocity.Y = (float)(MaxVelocity * Math.Sin(Angle)); + + Power = 1; + + Position += Velocity; + UpdateBox(); + + particleEngine.Update(); + particleEngine.EmitterLocation = Position; + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + particleEngine.Draw(spriteBatch); + } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) { return; } + if (other.GetType().IsAssignableFrom(typeof(StandardShip))) + { + Die(); + return; + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Renderer.CheckOut(this); + Parent.Children.Remove(this); + } + + public override void CleanUp() + { + base.CleanUp(); + this.particleEngine = null; + } + } +} diff --git a/SuperPolarity/Actors/MainShip.cs b/SuperPolarity/Actors/MainShip.cs new file mode 100644 index 0000000..bf4f3bb --- /dev/null +++ b/SuperPolarity/Actors/MainShip.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Audio; + +namespace SuperPolarity +{ + class MainShip : Ship + { + + public static Color BlueColor; + public static Color RedColor; + + ParticleEngine particleEngine; + + protected bool Shooting; + protected int ShotCooldown; + + protected float CurrentImmortalTime; + protected float MaxImmortalTime; + protected bool Flashing; + + protected SoundEffect PolarityChange; + protected SoundEffect ShootSound; + protected SoundEffect Hit; + + public MainShip(SuperPolarity newGame) : base(newGame) {} + + ~MainShip() + { + particleEngine = null; + } + + public override void Initialize(Texture2D texture, Vector2 position) + { + base.Initialize(texture, position); + + MainShip.BlueColor = new Color(211, 230, 234); + MainShip.RedColor = new Color(235, 160, 185); + + PolarityChange = game.Content.Load("Sound\\polaritychange"); + ShootSound = game.Content.Load("Sound\\bullet"); + Hit = game.Content.Load("Sound\\hit"); + + InitParticleEngine(); + SetPolarity(Polarity.Positive); + + ActVelocity = 2.5f; + + ShotCooldown = 50; + MaxImmortalTime = 1500; + + BoxDimensions.X = 2; + BoxDimensions.Y = 2; + BoxDimensions.W = 2; + BoxDimensions.Z = 2; + InitBox(); + + BindInput(); + } + + void InitParticleEngine() + { + particleEngine = ParticleEffectFactory.CreatePolarCircle(Position); + } + + void BindInput() + { + InputController.Bind("moveX", HandleHorizontalMovement); + InputController.Bind("moveY", HandleVerticalMovement); + InputController.Bind("changePolarity", HandleChangePolarity); + InputController.Bind("shoot", HandleShot); + } + + protected void HandleShot(float value) + { + + Shooting = true; + Timer t = new Timer(new TimerCallback(UnlockShot)); + t.Change(ShotCooldown, Timeout.Infinite); + + if (Children.Count > 10) + { + return; + } + + var bullet = ActorFactory.CreateBullet(Position, Angle); + + Children.Add(bullet); + bullet.Parent = this; + + ShootSound.Play(); + } + + protected void UnlockShot(object state) + { + InputController.Unlock("shoot"); + Shooting = false; + } + + protected void HandleChangePolarity(float value) + { + SwitchPolarity(); + } + + public void HandleHorizontalMovement(float value) + { + if (value >= -0.5 && value <= 0.5) + { + value = 0; + } + + Velocity.X = value * MaxVelocity; + } + + public void HandleVerticalMovement(float value) + { + if (value >= -0.5 && value <= 0.5) + { + value = 0; + } + + Velocity.Y = value * MaxVelocity; + } + + public override void SwitchPolarity() + { + base.SwitchPolarity(); + SwitchParticleEngine(CurrentPolarity); + PolarityChange.Play(); + game.Player.ResetMultiplier(); + } + + public override void SetPolarity(Polarity newPolarity) + { + base.SetPolarity(newPolarity); + SwitchParticleEngine(newPolarity); + } + + protected void SwitchParticleEngine(Polarity polarity) + { + if (polarity == Polarity.Positive) + { + particleEngine.Color = MainShip.RedColor; + } + else if (polarity == Polarity.Negative) + { + particleEngine.Color = MainShip.BlueColor; + } + else + { + particleEngine.Color = Color.Gray; + } + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + particleEngine.EmitterLocation = Position; + particleEngine.Update(); + ConstrainToEdges(); + UpdateImmortality(gameTime); + } + + public void UpdateImmortality(GameTime gameTime) + { + if (Immortal) + { + CurrentImmortalTime += gameTime.ElapsedGameTime.Milliseconds; + + if (Flashing) + { + Color = new Color(255, 255, 255, 128); + } + else + { + Color = Color.White; + } + + Flashing = !Flashing; + + if (CurrentImmortalTime > MaxImmortalTime) + { + Immortal = false; + Color = Color.White; + } + } + } + + public override void Move(GameTime gameTime) + { + var VelocityLimit = MaxVelocity; + var SavedVelocity = new Vector2(Velocity.X, Velocity.Y); + + if (Shooting) + { + VelocityLimit = ActVelocity; + } + + if (SavedVelocity.X > VelocityLimit) + { + SavedVelocity.X = VelocityLimit; + } + + if (SavedVelocity.X < -VelocityLimit) + { + SavedVelocity.X = -VelocityLimit; + } + + if (SavedVelocity.Y > VelocityLimit) + { + SavedVelocity.Y = VelocityLimit; + } + + if (SavedVelocity.Y < -VelocityLimit) + { + SavedVelocity.Y = -VelocityLimit; + } + + Position.X = Position.X + SavedVelocity.X; + Position.Y = Position.Y + SavedVelocity.Y; + } + + public override void Magnetize(Ship ship, float distance, float angle) + { + } + + protected void ConstrainToEdges() + { + if (Position.X < 0) + { + Position.X = 0; + + if (Velocity.X < 0) + { + Velocity.X = 0; + } + } + if (Position.X > game.GraphicsDevice.Viewport.Width) + { + Position.X = game.GraphicsDevice.Viewport.Width; + + if (Velocity.X > 0) + { + Velocity.X = 0; + } + } + if (Position.Y < 0) + { + Position.Y = 0; + + if (Velocity.Y < 0) + { + Velocity.Y = 0; + } + } + if (Position.Y > game.GraphicsDevice.Viewport.Height) + { + Position.Y = game.GraphicsDevice.Viewport.Height; + + if (Velocity.Y < 0) + { + Velocity.Y = 0; + } + } + } + + public override void Draw(SpriteBatch spriteBatch) + { + particleEngine.Draw(spriteBatch); + base.Draw(spriteBatch); + } + + public override void Collide(Actor other, Rectangle collision) + { + if (other.GetType().IsAssignableFrom(typeof(StandardShip)) && + !Immortal) + { + Die(); + } + } + + protected override void Die() + { + game.Player.Lives = game.Player.Lives - 1; + game.Player.ResetMultiplier(); + if (game.Player.Lives < 0) + { + Dying = true; + game.GameOver(); + } + else { + Hit.Play(); + Immortal = true; + CurrentImmortalTime = 0; + } + } + + public override void CleanUp() + { + base.CleanUp(); + particleEngine = null; + InputController.Unbind("moveX", HandleHorizontalMovement); + InputController.Unbind("moveY", HandleVerticalMovement); + InputController.Unbind("changePolarity", HandleChangePolarity); + InputController.Unbind("shoot", HandleShot); + } + } +} diff --git a/SuperPolarity/Actors/Ship.cs b/SuperPolarity/Actors/Ship.cs new file mode 100644 index 0000000..229f639 --- /dev/null +++ b/SuperPolarity/Actors/Ship.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Ship : Actor + { + public enum Polarity : byte { Negative, Positive, Neutral }; + + public Polarity CurrentPolarity; + public uint MagneticRadius; + + public float FleeVelocity; + public float ActVelocity; + public float ChargeVelocity; + public int RepelRadius; + + protected bool Magnetizing; + + public Ship(SuperPolarity newGame) : base(newGame) { + MagneticRadius = 250; + RepelRadius = 100; + + HP = 2; + + FleeVelocity = 5; + ActVelocity = 1; + ChargeVelocity = 2.5f; + CurrentPolarity = Polarity.Neutral; + Magnetizing = false; + } + + public virtual void SwitchPolarity() + { + if (CurrentPolarity == Polarity.Positive) + { + CurrentPolarity = Polarity.Negative; + } + else + { + CurrentPolarity = Polarity.Positive; + } + } + + public virtual void SetPolarity(Polarity newPolarity) + { + CurrentPolarity = newPolarity; + } + + public virtual void Shoot() + { + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + Magnetizing = false; + } + + public virtual void Magnetize(Ship ship, float distance, float angle) + { + Magnetizing = true; + Polarity polarity = ship.CurrentPolarity; + + if (polarity != CurrentPolarity) + { + Attract(angle); + } + else + { + Repel(distance, angle); + } + } + + protected void Attract(float angle) + { + Velocity.X = (float) (ChargeVelocity * Math.Cos(angle)); + Velocity.Y = (float) (ChargeVelocity * Math.Sin(angle)); + } + + protected void Repel(float distance, float angle) + { + if (distance > RepelRadius) { Magnetizing = false; return; } + Velocity.X = -(float)(FleeVelocity * Math.Cos(angle)); + Velocity.Y = -(float)(FleeVelocity * Math.Sin(angle)); + } + } +} diff --git a/SuperPolarity/Actors/StandardShip.cs b/SuperPolarity/Actors/StandardShip.cs new file mode 100644 index 0000000..ef2fe7f --- /dev/null +++ b/SuperPolarity/Actors/StandardShip.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content; +using System.Security.Cryptography; + +namespace SuperPolarity +{ + class StandardShip : Ship + { + + protected bool Flashing; + protected int ChangeRate; + protected int CurrentTime; + public int AngleChangeProbability; + protected int BouncePadding; + protected float RotationFactor; + protected Random Random; + protected bool AddingAngle; + + public StandardShip(SuperPolarity newGame) : base(newGame) {} + + public override void Initialize(Texture2D texture, Vector2 position) + { + base.Initialize(texture, position); + + var cryptoResult = new byte[4]; + new RNGCryptoServiceProvider().GetBytes(cryptoResult); + + ChangeRate = 50; + AngleChangeProbability = 50; + BouncePadding = 0; + MaxVelocity = 2; + CurrentTime = 0; + RotationFactor = (float) (3 * Math.PI / 180); + Random = new Random(BitConverter.ToInt32(cryptoResult, 0)); + AddingAngle = true; + } + + public override void Magnetize(Ship ship, float distance, float angle) + { + if (ship.GetType() == typeof(MainShip)) { + base.Magnetize(ship, distance, angle); + } + } + + public override void Update(GameTime gameTime) + { + CurrentTime += gameTime.ElapsedGameTime.Milliseconds; + if (!Magnetizing) + { + AutoMove(); + BounceBack(); + } + ChangeAngle(); + Position += Velocity; + UpdateBox(); + Magnetizing = false; + + if (Flashing) + { + Color = new Color(255, 255, 255, 128); + Flashing = false; + } + else + { + Color = Color.White; + } + } + + protected void AutoMove() + { + float newAngle = Angle; + + if (CurrentTime < ChangeRate) + { + return; + } + + if (Random.Next(AngleChangeProbability) == 2) + { + AddingAngle = !AddingAngle; + } + + CurrentTime = 0; + + if (AddingAngle) + { + newAngle += (float) ( Random.NextDouble() * RotationFactor); + } + else + { + newAngle -= (float) (Random.NextDouble() * RotationFactor); + } + + Velocity.X = (float) (MaxVelocity * Math.Cos(newAngle)); + Velocity.Y = (float) (MaxVelocity * Math.Sin(newAngle)); + } + + protected void BounceBack() + { + if (Position.X + Width < -BouncePadding && Velocity.X < 0) + { + Velocity.X = -Velocity.X; + } + + if (Position.Y + Height < -BouncePadding && Velocity.Y < 0) + { + Velocity.Y = -Velocity.Y; + } + + if (Position.X > game.GraphicsDevice.Viewport.Width + BouncePadding && Velocity.X > 0) + { + Velocity.X = -Velocity.X; + } + + if (Position.Y > game.GraphicsDevice.Viewport.Height + BouncePadding && Velocity.Y > 0) + { + Velocity.Y = -Velocity.Y; + } + } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) + { + return; + } + + if (other.GetType() == typeof(MainShip)) + { + Die(); + return; + } + + if (other.GetType() == typeof(Bullet)) + { + var theBullet = (Bullet)other; + TakeDamage(theBullet.Power); + Flashing = true; + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Renderer.CheckOut(this); + game.Player.AddScore(Value); + game.Player.AddMultiplier(1); + } + } +} diff --git a/SuperPolarity/BasicGenerator.cs b/SuperPolarity/BasicGenerator.cs new file mode 100644 index 0000000..ba51742 --- /dev/null +++ b/SuperPolarity/BasicGenerator.cs @@ -0,0 +1,77 @@ +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; + CurrentTime = rate; + } + + public void Update(GameTime gameTime) + { + if (ActorManager.CountBaddies() > 50) + { + return; + } + + 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) + { + Renderer.CheckIn(ActorFactory.CreateShip(polarity, Position)); + } + + if (ShipType == Ships.Scout) + { + Renderer.CheckIn(ActorFactory.CreateScout(polarity, Position)); + } + + if (ShipType == Ships.Battlecruiser) + { + Renderer.CheckIn(ActorFactory.CreateCruiser(polarity, Position)); + } + + } + } +} diff --git a/SuperPolarity/Content/Fonts/SegoeUIMono14.xnb b/SuperPolarity/Content/Fonts/SegoeUIMono14.xnb new file mode 100644 index 0000000..51c4abd Binary files /dev/null and b/SuperPolarity/Content/Fonts/SegoeUIMono14.xnb differ diff --git a/SuperPolarity/Content/Fonts/bigfont.xnb b/SuperPolarity/Content/Fonts/bigfont.xnb new file mode 100644 index 0000000..c1d876c Binary files /dev/null and b/SuperPolarity/Content/Fonts/bigfont.xnb differ diff --git a/SuperPolarity/Content/Fonts/smallfont.xnb b/SuperPolarity/Content/Fonts/smallfont.xnb new file mode 100644 index 0000000..a87e66a Binary files /dev/null and b/SuperPolarity/Content/Fonts/smallfont.xnb differ diff --git a/SuperPolarity/Content/Graphics/circle.xnb b/SuperPolarity/Content/Graphics/circle.xnb new file mode 100644 index 0000000..3471449 Binary files /dev/null and b/SuperPolarity/Content/Graphics/circle.xnb differ diff --git a/SuperPolarity/Content/Graphics/diamond.xnb b/SuperPolarity/Content/Graphics/diamond.xnb new file mode 100644 index 0000000..8bda70c Binary files /dev/null and b/SuperPolarity/Content/Graphics/diamond.xnb differ diff --git a/SuperPolarity/Content/Graphics/main-ship.xnb b/SuperPolarity/Content/Graphics/main-ship.xnb new file mode 100644 index 0000000..7108e2f Binary files /dev/null and b/SuperPolarity/Content/Graphics/main-ship.xnb differ diff --git a/SuperPolarity/Content/Graphics/negative-cruiser.xnb b/SuperPolarity/Content/Graphics/negative-cruiser.xnb new file mode 100644 index 0000000..5c9f41d Binary files /dev/null and b/SuperPolarity/Content/Graphics/negative-cruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/negative-destroyer.xnb b/SuperPolarity/Content/Graphics/negative-destroyer.xnb new file mode 100644 index 0000000..fe13745 Binary files /dev/null and b/SuperPolarity/Content/Graphics/negative-destroyer.xnb differ diff --git a/SuperPolarity/Content/Graphics/negative-scout.xnb b/SuperPolarity/Content/Graphics/negative-scout.xnb new file mode 100644 index 0000000..a5a2e7a Binary files /dev/null and b/SuperPolarity/Content/Graphics/negative-scout.xnb differ diff --git a/SuperPolarity/Content/Graphics/negative-ship.xnb b/SuperPolarity/Content/Graphics/negative-ship.xnb new file mode 100644 index 0000000..ed41216 Binary files /dev/null and b/SuperPolarity/Content/Graphics/negative-ship.xnb differ diff --git a/SuperPolarity/Content/Graphics/negative-supercruiser.xnb b/SuperPolarity/Content/Graphics/negative-supercruiser.xnb new file mode 100644 index 0000000..b77f364 Binary files /dev/null and b/SuperPolarity/Content/Graphics/negative-supercruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/neutral-cruiser.xnb b/SuperPolarity/Content/Graphics/neutral-cruiser.xnb new file mode 100644 index 0000000..ac99113 Binary files /dev/null and b/SuperPolarity/Content/Graphics/neutral-cruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/neutral-destroyer.xnb b/SuperPolarity/Content/Graphics/neutral-destroyer.xnb new file mode 100644 index 0000000..69b5924 Binary files /dev/null and b/SuperPolarity/Content/Graphics/neutral-destroyer.xnb differ diff --git a/SuperPolarity/Content/Graphics/neutral-scout.xnb b/SuperPolarity/Content/Graphics/neutral-scout.xnb new file mode 100644 index 0000000..5e9ff59 Binary files /dev/null and b/SuperPolarity/Content/Graphics/neutral-scout.xnb differ diff --git a/SuperPolarity/Content/Graphics/neutral-ship.xnb b/SuperPolarity/Content/Graphics/neutral-ship.xnb new file mode 100644 index 0000000..04259be Binary files /dev/null and b/SuperPolarity/Content/Graphics/neutral-ship.xnb differ diff --git a/SuperPolarity/Content/Graphics/neutral-supercruiser.xnb b/SuperPolarity/Content/Graphics/neutral-supercruiser.xnb new file mode 100644 index 0000000..1389842 Binary files /dev/null and b/SuperPolarity/Content/Graphics/neutral-supercruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/pause-screen.xnb b/SuperPolarity/Content/Graphics/pause-screen.xnb new file mode 100644 index 0000000..2307009 Binary files /dev/null and b/SuperPolarity/Content/Graphics/pause-screen.xnb differ diff --git a/SuperPolarity/Content/Graphics/polaritydemotitle.xnb b/SuperPolarity/Content/Graphics/polaritydemotitle.xnb new file mode 100644 index 0000000..2fa9cf3 Binary files /dev/null and b/SuperPolarity/Content/Graphics/polaritydemotitle.xnb differ diff --git a/SuperPolarity/Content/Graphics/positive-cruiser.xnb b/SuperPolarity/Content/Graphics/positive-cruiser.xnb new file mode 100644 index 0000000..b65d2bd Binary files /dev/null and b/SuperPolarity/Content/Graphics/positive-cruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/positive-destroyer.xnb b/SuperPolarity/Content/Graphics/positive-destroyer.xnb new file mode 100644 index 0000000..d773175 Binary files /dev/null and b/SuperPolarity/Content/Graphics/positive-destroyer.xnb differ diff --git a/SuperPolarity/Content/Graphics/positive-scout.xnb b/SuperPolarity/Content/Graphics/positive-scout.xnb new file mode 100644 index 0000000..2b8f9fe Binary files /dev/null and b/SuperPolarity/Content/Graphics/positive-scout.xnb differ diff --git a/SuperPolarity/Content/Graphics/positive-ship.xnb b/SuperPolarity/Content/Graphics/positive-ship.xnb new file mode 100644 index 0000000..e4e21f1 Binary files /dev/null and b/SuperPolarity/Content/Graphics/positive-ship.xnb differ diff --git a/SuperPolarity/Content/Graphics/positive-supercruiser.xnb b/SuperPolarity/Content/Graphics/positive-supercruiser.xnb new file mode 100644 index 0000000..2ecca79 Binary files /dev/null and b/SuperPolarity/Content/Graphics/positive-supercruiser.xnb differ diff --git a/SuperPolarity/Content/Graphics/square.xnb b/SuperPolarity/Content/Graphics/square.xnb new file mode 100644 index 0000000..5a88d89 Binary files /dev/null and b/SuperPolarity/Content/Graphics/square.xnb differ diff --git a/SuperPolarity/Content/Graphics/star.xnb b/SuperPolarity/Content/Graphics/star.xnb new file mode 100644 index 0000000..763addf Binary files /dev/null and b/SuperPolarity/Content/Graphics/star.xnb differ diff --git a/SuperPolarity/Content/Sound/bomb.wav b/SuperPolarity/Content/Sound/bomb.wav new file mode 100644 index 0000000..5af439b Binary files /dev/null and b/SuperPolarity/Content/Sound/bomb.wav differ diff --git a/SuperPolarity/Content/Sound/bullet.wav b/SuperPolarity/Content/Sound/bullet.wav new file mode 100644 index 0000000..6586489 Binary files /dev/null and b/SuperPolarity/Content/Sound/bullet.wav differ diff --git a/SuperPolarity/Content/Sound/gameover.wav b/SuperPolarity/Content/Sound/gameover.wav new file mode 100644 index 0000000..cac9d23 Binary files /dev/null and b/SuperPolarity/Content/Sound/gameover.wav differ diff --git a/SuperPolarity/Content/Sound/hit.wav b/SuperPolarity/Content/Sound/hit.wav new file mode 100644 index 0000000..43433cd Binary files /dev/null and b/SuperPolarity/Content/Sound/hit.wav differ diff --git a/SuperPolarity/Content/Sound/life.wav b/SuperPolarity/Content/Sound/life.wav new file mode 100644 index 0000000..a1d0436 Binary files /dev/null and b/SuperPolarity/Content/Sound/life.wav differ diff --git a/SuperPolarity/Content/Sound/polaritychange.wav b/SuperPolarity/Content/Sound/polaritychange.wav new file mode 100644 index 0000000..25b59a4 Binary files /dev/null and b/SuperPolarity/Content/Sound/polaritychange.wav differ diff --git a/SuperPolarity/Content/Sound/polaritytheme.wav b/SuperPolarity/Content/Sound/polaritytheme.wav new file mode 100644 index 0000000..28a6bce Binary files /dev/null and b/SuperPolarity/Content/Sound/polaritytheme.wav differ diff --git a/SuperPolarity/GameScreen.cs b/SuperPolarity/GameScreen.cs new file mode 100644 index 0000000..783e3c1 --- /dev/null +++ b/SuperPolarity/GameScreen.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + class GameScreen : Screen + { + public GameScreen(SuperPolarity newGame) : base(newGame) {} + + protected List Generators; + + protected int LivesRate; + protected int CurrentLivesRate; + protected int BombRate; + protected int CurrentBombRate; + protected SoundEffect BombSound; + protected SoundEffect LifeSound; + + protected bool Flashing; + + protected bool IsPaused; + protected Texture2D PauseScreen; + + public override void Initialize() + { + Generators = new List(); + + CurrentBombRate = 1; + BombRate = 6000; + + LivesRate = 10000; + CurrentLivesRate = 1; + + InputController.RegisterEventForButton("changePolarity", Buttons.A); + InputController.RegisterEventForKey("changePolarity", Keys.Z); + + InputController.RegisterEventForButton("shoot", Buttons.X); + InputController.RegisterEventForKey("shoot", Keys.X); + + InputController.Bind("pause", HandlePause); + + PauseScreen = Game.Content.Load("Graphics\\pause-screen"); + } + + protected void HandlePause(float value) + { + Console.WriteLine("Paused"); + IsPaused = !IsPaused; + + if (IsPaused) + { + MediaPlayer.Volume = 0.05f; + } + else + { + MediaPlayer.Volume = 1; + } + } + + public override void LoadContent() + { + CreateGenerators(); + + Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X + Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); + + BombSound = Game.Content.Load("Sound\\bomb"); + LifeSound = Game.Content.Load("Sound\\life"); + + Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); + + Game.PlaySong("game"); + } + + protected void CalculateBomb() + { + if (Game.Player.Score >= BombRate * CurrentBombRate) + { + ActorManager.Bomb(); + Flashing = true; + BombSound.Play(); + CurrentBombRate = CurrentBombRate + 1; + } + } + + protected void CalculateLife() + { + if (Game.Player.Score >= LivesRate * CurrentLivesRate) + { + Game.Player.Lives = Game.Player.Lives + 1; + LifeSound.Play(); + CurrentLivesRate = CurrentLivesRate + 1; + } + } + + public override void Update(GameTime gameTime) + { + CalculateBomb(); + CalculateLife(); + InputController.UpdateInput(IsPaused); + if (IsPaused) + { + return; + } + ActorManager.Update(gameTime); + + foreach (BasicGenerator generator in Generators) + { + generator.Update(gameTime); + } + } + + public override void Draw(SpriteBatch spriteBatch) + { + Renderer.Draw(spriteBatch); + Game.Player.Draw(spriteBatch); + + if (IsPaused) + { + spriteBatch.Draw(PauseScreen, new Vector2(0, 0), Color.White); + } + + if (Flashing) + { + Game.GraphicsDevice.Clear(Color.Black); + Flashing = false; + } + } + + protected void CreateGenerators() + { + // The basic ship generators. + var gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, -50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, -50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + // After 1.5k liberate some sporadic Scouts, and add two more ship generators. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 3000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); + Generators.Add(gen); + + + // After 3k add more scouts. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Scout, 3000, 3000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Scout, 3000, 5000); + Generators.Add(gen); + + // After 5k release more ships and a cruiser. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 1500, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 1500, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); + Generators.Add(gen); + } + + public override void CleanUp() + { + base.CleanUp(); + Generators.Clear(); + InputController.Unbind("pause", HandlePause); + Renderer.Empty(); + ActorManager.Empty(); + } + } +} diff --git a/SuperPolarity/Icon.ico b/SuperPolarity/Icon.ico new file mode 100644 index 0000000..13be62a Binary files /dev/null and b/SuperPolarity/Icon.ico differ diff --git a/SuperPolarity/InputController.cs b/SuperPolarity/InputController.cs new file mode 100644 index 0000000..c92bb9c --- /dev/null +++ b/SuperPolarity/InputController.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + static class InputController + { + static Dictionary>> Listeners; + static Dictionary> RegisteredKeys; + static Dictionary> RegisteredButtons; + static List BlockedKeys; + static List BlockedButtons; + + static GamePadState InputGamePadState; + static KeyboardState InputKeyboardState; + + /* + * Registered Events. + * + * You register: name of the event (ie. attack) and a key associated with it. + * or button... Left Stick /always/ dispatches move event. + */ + + static InputController() + { + Listeners = new Dictionary>>(); + RegisteredButtons = new Dictionary>(); + RegisteredKeys = new Dictionary>(); + BlockedKeys = new List(); + BlockedButtons = new List(); + InputKeyboardState = new KeyboardState(); + InputGamePadState = new GamePadState(); + } + + public static void UpdateInput() + { + DispatchMoveEvents(); + DispatchRegisteredEvents(); + } + + public static void UpdateInput(bool highPriorityOnly) + { + Poll(); + DispatchPauseEvent(); + if (!highPriorityOnly) + { + UpdateInput(); + } + } + + public static void DispatchPauseEvent() + { + // OK THIS IS ALL KINDS OF WRONG. THIS IS A PLACEHOLDER BECAUSE DEMO! + var keyPressed = false; + if ((InputKeyboardState.IsKeyDown(Keys.Enter) || InputGamePadState.IsButtonDown(Buttons.Start))) { + keyPressed = true; + if(!BlockedButtons.Contains("pause") && !BlockedKeys.Contains("pause")) + { + BlockedButtons.Add("pause"); + BlockedKeys.Add("pause"); + Console.WriteLine("Dispatch"); + Dispatch("pause", 0); + } + } + + if (!keyPressed) + { + BlockedButtons.Remove("pause"); + BlockedKeys.Remove("pause"); + } + } + + private static void Poll() + { + InputGamePadState = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One); + InputKeyboardState = Keyboard.GetState(); + } + + public static void RegisterEventForKey(string eventName, Keys key) + { + List newKeyList; + if (!RegisteredKeys.ContainsKey(eventName)) + { + newKeyList = new List(); + RegisteredKeys.Add(eventName, newKeyList); + } + + RegisteredKeys.TryGetValue(eventName, out newKeyList); + + newKeyList.Add(key); + } + + public static void RegisterEventForButton(string eventName, Buttons button) + { + List newButtonList; + if (!RegisteredButtons.ContainsKey(eventName)) + { + newButtonList = new List(); + RegisteredButtons.Add(eventName, newButtonList); + } + + RegisteredButtons.TryGetValue(eventName, out newButtonList); + + newButtonList.Add(button); + } + + private static void DispatchRegisteredEvents() + { + var keyFired = false; + + foreach (KeyValuePair> entry in RegisteredKeys) { + keyFired = false; + foreach (Keys key in entry.Value) + { + if (InputKeyboardState.IsKeyDown(key)) + { + if (!BlockedKeys.Contains(entry.Key)) + { + BlockedKeys.Add(entry.Key); + Dispatch(entry.Key, 1); + } + keyFired = true; + break; + } + } + + if (!keyFired) + { + BlockedKeys.Remove(entry.Key); + } + } + + foreach (KeyValuePair> entry in RegisteredButtons) + { + keyFired = false; + foreach (Buttons button in entry.Value) + { + if (InputGamePadState.IsButtonDown(button)) + { + if (!BlockedButtons.Contains(entry.Key)) + { + BlockedButtons.Add(entry.Key); + Dispatch(entry.Key, 1); + } + keyFired = true; + break; + }; + } + + if (!keyFired) + { + BlockedButtons.Remove(entry.Key); + } + } + } + + private static void DispatchMoveEvents() + { + float xMovement = 0.0f; + float yMovement = 0.0f; + // Dispatch the moveX / MoveY events every frame. + + xMovement = InputGamePadState.ThumbSticks.Left.X; + yMovement = -InputGamePadState.ThumbSticks.Left.Y; + + if (InputKeyboardState.IsKeyDown(Keys.Left)) + { + xMovement = -1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Right)) + { + xMovement = 1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Up)) + { + yMovement = -1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Down)) + { + yMovement = 1.0f; + } + + Dispatch("moveX", xMovement); + Dispatch("moveY", yMovement); + } + + public static void Bind(string eventName, Action listener) + { + List> newListenerList; + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) { + newListenerList = new List>(); + Listeners.Add(eventName, newListenerList); + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Add(listener); + } + + public static void Unbind(string eventName, Action listener) + { + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) + { + return; + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Remove(listener); + } + + public static void Dispatch(string eventName, float value) + { + List> listenerList; + bool foundListeners; + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + if (!foundListeners) + { + return; + } + + for (var i = listenerList.Count - 1; i >= 0; i--) + { + listenerList[i](value); + } + } + + public static void Unlock(string eventName) + { + BlockedButtons.Remove(eventName); + BlockedKeys.Remove(eventName); + } + } +} diff --git a/SuperPolarity/LetterChooseWidget.cs b/SuperPolarity/LetterChooseWidget.cs new file mode 100644 index 0000000..e52733f --- /dev/null +++ b/SuperPolarity/LetterChooseWidget.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class LetterChooseWidget : Widget + { + int CurrentChar; + bool Locked; + int LockRate; + int CurrentTime; + + SpriteFont Font; + + public LetterChooseWidget(SuperPolarity game, Vector2 position) : base(game, position) + { + Active = false; + CurrentChar = 65; + Font = game.Content.Load("Fonts\\bigfont"); + LockRate = 300; + CurrentTime = 0; + + InputController.Bind("moveY", HandleMovement); + } + + public void HandleMovement(float value) + { + if (!Active) { return; } + + if (value > 0.8 && !Locked) { + CurrentChar = CurrentChar + 1; + + if (CurrentChar > 90) + { + CurrentChar = 32; + } + + Locked = true; + } + + if (value < -0.8 && !Locked) { + CurrentChar = CurrentChar - 1; + + if (CurrentChar < 32) + { + CurrentChar = 90; + } + + Locked = true; + } + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; + if (CurrentTime > LockRate) + { + CurrentTime = 0; + Locked = false; + } + } + + public string Value() + { + return char.ConvertFromUtf32(CurrentChar); + } + + public override void Draw(SpriteBatch spriteBatch) + { + var color = new Color(0, 0, 0, 128); + if (Active) + { + color = new Color(201, 0, 68, 255); + } + spriteBatch.DrawString(Font, Value(), Position, color); + } + } +} diff --git a/SuperPolarity/MenuItem.cs b/SuperPolarity/MenuItem.cs new file mode 100644 index 0000000..8e24c97 --- /dev/null +++ b/SuperPolarity/MenuItem.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuItem + { + } +} diff --git a/SuperPolarity/MenuWidget.cs b/SuperPolarity/MenuWidget.cs new file mode 100644 index 0000000..992ef43 --- /dev/null +++ b/SuperPolarity/MenuWidget.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuWidget + { + } +} diff --git a/SuperPolarity/NameChooserWidget.cs b/SuperPolarity/NameChooserWidget.cs new file mode 100644 index 0000000..ce7c149 --- /dev/null +++ b/SuperPolarity/NameChooserWidget.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class NameChooserWidget : Widget + { + int CurrentIndex; + bool Lock; + int LockRate; + int CurrentTime; + + public NameChooserWidget(SuperPolarity game, Vector2 position) + : base(game, position) + { + AppendChild(new LetterChooseWidget(game, new Vector2(position.X, position.Y))); + AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 32, position.Y))); + AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 64, position.Y))); + CurrentIndex = 0; + Children[CurrentIndex].Activate(); + LockRate = 300; + CurrentTime = 0; + + InputController.Bind("moveX", HandleMovement); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; + if (CurrentTime > LockRate) + { + CurrentTime = 0; + Lock = false; + } + + foreach (LetterChooseWidget widget in Children) + { + widget.Update(gameTime); + } + } + + public void HandleMovement(float value) + { + if (value > 0.8 && !Lock) + { + Children[CurrentIndex].Deactivate(); + CurrentIndex = CurrentIndex + 1; + + if (CurrentIndex > Children.Count - 1) + { + CurrentIndex = 0; + } + + Lock = true; + } + + if (value < -0.8 && !Lock) + { + Children[CurrentIndex].Deactivate(); + CurrentIndex = CurrentIndex - 1; + + if (CurrentIndex < 0) + { + CurrentIndex = Children.Count - 1; + } + + Lock = true; + } + + Children[CurrentIndex].Activate(); + } + + public string Value() + { + var name = ""; + + foreach (LetterChooseWidget letter in Children) + { + name = name + letter.Value(); + } + + return name; + } + + public override void Draw(SpriteBatch spriteBatch) + { + foreach (LetterChooseWidget widget in Children) + { + widget.Draw(spriteBatch); + } + } + } +} diff --git a/SuperPolarity/Particle.cs b/SuperPolarity/Particle.cs new file mode 100644 index 0000000..d65bac6 --- /dev/null +++ b/SuperPolarity/Particle.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Particle + { + public Texture2D Texture { get; set; } + public Vector2 Position { get; set; } + public Vector2 Velocity { get; set; } + public float Angle { get; set; } + public float AngularVelocity { get; set; } + public Color Color { get; set; } + public float Size { get; set; } + public int TTL { get; set; } + + public Particle(Texture2D texture, Vector2 position, Vector2 velocity, + float angle, float angularVelocity, Color color, float size, int ttl) + { + Texture = texture; + Position = position; + Velocity = velocity; + Angle = angle; + AngularVelocity = angularVelocity; + Color = color; + Size = size; + TTL = ttl; + } + + public void Update() + { + TTL--; + Position += Velocity; + Angle += AngularVelocity; + } + + public void Draw(SpriteBatch spriteBatch) + { + Rectangle sourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height); + Vector2 origin = new Vector2(Texture.Width / 2, Texture.Height / 2); + + spriteBatch.Draw(Texture, Position, sourceRectangle, Color, + Angle, origin, Size, SpriteEffects.None, 0f); + } + + } +} diff --git a/SuperPolarity/ParticleEffectFactory.cs b/SuperPolarity/ParticleEffectFactory.cs new file mode 100644 index 0000000..0cd9ed3 --- /dev/null +++ b/SuperPolarity/ParticleEffectFactory.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ParticleEffectFactory + { + static Game Game; + static Random random; + + static ParticleEffectFactory() + { + random = new Random(); + } + + public static ParticleEngine CreatePolarCircle(Vector2 location) + { + List texturesList = new List(); + + //texturesList.Add(Game.Content.Load("Graphics\\circle")); + texturesList.Add(Game.Content.Load("Graphics\\diamond")); + texturesList.Add(Game.Content.Load("Graphics\\square")); + + ParticleEngine particleEngine = new ParticleEngine(texturesList, location); + + particleEngine.Color = new Color(239, 203, 204); + particleEngine.TTL = 10; + particleEngine.TTLRandomFactor = 5; + particleEngine.ScatterFactor = 40; + particleEngine.ParticleCount = 50; + particleEngine.StretchFactor = 2.8f; + + + return particleEngine; + } + + public static ParticleEngine CreateBullet(Vector2 location) + { + List texturesList = new List(); + + texturesList.Add(Game.Content.Load("Graphics\\circle")); + //texturesList.Add(Game.Content.Load("Graphics\\diamond")); + texturesList.Add(Game.Content.Load("Graphics\\square")); + + ParticleEngine particleEngine = new ParticleEngine(texturesList, location); + + particleEngine.Color = Color.Gray; + particleEngine.TTL = 5; + particleEngine.TTLRandomFactor = 5; + particleEngine.ScatterFactor = 5; + particleEngine.ParticleCount = 10; + particleEngine.StretchFactor = 1; + + return particleEngine; + } + + internal static void SetGame(Game game) + { + ParticleEffectFactory.Game = game; + } + } +} diff --git a/SuperPolarity/ParticleEngine.cs b/SuperPolarity/ParticleEngine.cs new file mode 100644 index 0000000..51188ae --- /dev/null +++ b/SuperPolarity/ParticleEngine.cs @@ -0,0 +1,86 @@ +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; } + public Color Color; //TODO: Color list for random colors. + public int TTL; + public int TTLRandomFactor; + public int ScatterFactor; + public int ParticleCount; + public float StretchFactor; + private List particles; + private List textures; + + public ParticleEngine(List textures, Vector2 location) + { + EmitterLocation = location; + this.textures = textures; + this.particles = new List(); + random = new Random(); + Color = Color.Red; + TTL = 20; + TTLRandomFactor = 40; + StretchFactor = 1; + } + + 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 = Color; + float size = (float)random.NextDouble() * StretchFactor; + + position.X += random.Next(-ScatterFactor, ScatterFactor); + position.Y += random.Next(-ScatterFactor, ScatterFactor); + + int ttl = TTL + random.Next(TTLRandomFactor); + + 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(); + } + } +} diff --git a/SuperPolarity/Player.cs b/SuperPolarity/Player.cs new file mode 100644 index 0000000..184abdd --- /dev/null +++ b/SuperPolarity/Player.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + public class Player + { + public int Score; + public int Multiplier; + public int Lives; + + + SpriteFont DebugFont; + SuperPolarity Game; + + Texture2D LifeSprite; + + public Player(SuperPolarity game) + { + Score = 0; + Multiplier = 1; + Lives = 3; + Game = game; + DebugFont = Game.Content.Load("Fonts\\bigfont"); + LifeSprite = Game.Content.Load("Graphics\\neutral-ship"); + } + + public void AddScore(int value) + { + Score = Score + (value * Multiplier); + } + + public void AddMultiplier(int value) + { + Multiplier = Multiplier + 1; + } + + public void ResetMultiplier() + { + Multiplier = 1; + } + + public void Draw(SpriteBatch spriteBatch) + { + var UiColor = new Color(0, 0, 0, 200); + var lightColor = new Color(0, 0, 0, 128); + spriteBatch.DrawString(DebugFont, Score.ToString(), new Vector2(40, 30), UiColor); + spriteBatch.DrawString(DebugFont, "x" + Multiplier.ToString(), new Vector2(40, 50), lightColor); + + var lifePosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 140, 30); + if (Lives > 4) + { + spriteBatch.Draw(LifeSprite, lifePosition, null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); + spriteBatch.DrawString(DebugFont, "x " + Lives.ToString(), new Vector2(lifePosition.X + 8, lifePosition.Y + 5), UiColor); + } + else + { + for (var i = 0; i < Lives; i++) + { + spriteBatch.Draw(LifeSprite, new Vector2(lifePosition.X + (i * 28), lifePosition.Y), null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); + } + } + } + + public void Update() + { + + } + + public void Reset() + { + Score = 0; + Multiplier = 1; + Lives = 3; + } + } +} diff --git a/SuperPolarity/Program.cs b/SuperPolarity/Program.cs new file mode 100644 index 0000000..6c3f614 --- /dev/null +++ b/SuperPolarity/Program.cs @@ -0,0 +1,26 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +#endregion + +namespace SuperPolarity +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var superPolarity = new SuperPolarity()) + superPolarity.Run(); + } + } +#endif +} diff --git a/SuperPolarity/Properties/AssemblyInfo.cs b/SuperPolarity/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bd24ce8 --- /dev/null +++ b/SuperPolarity/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SuperPolarity")] +[assembly: AssemblyProduct("SuperPolarity")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7f0aa81c-c9ab-4b87-97eb-3b788199ed3e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SuperPolarity/Renderer.cs b/SuperPolarity/Renderer.cs new file mode 100644 index 0000000..7ca8158 --- /dev/null +++ b/SuperPolarity/Renderer.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Renderer + { + + static List Actors; + + static Renderer() + { + Actors = new List(); + } + + static public void CheckIn(Actor actor) + { + Actors.Add(actor); + } + + static public void CheckOut(Actor actor) + { + Actors.Remove(actor); + } + + static public void Draw(SpriteBatch spriteBatch) + { + foreach (Actor actor in Actors) + { + actor.Draw(spriteBatch); + } + } + + static public void Empty() + { + Actors.Clear(); + } + } +} diff --git a/SuperPolarity/ScoreScreen.cs b/SuperPolarity/ScoreScreen.cs new file mode 100644 index 0000000..bf43275 --- /dev/null +++ b/SuperPolarity/ScoreScreen.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + class ScoreScreen : Screen + { + protected SpriteFont Font; + protected NameChooserWidget nameChooser; + protected Dictionary Scores; + + public ScoreScreen(SuperPolarity newGame) : base(newGame) { } + + public override void Initialize() + { + base.Initialize(); + nameChooser = new NameChooserWidget(Game, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 4)); + InputController.RegisterEventForButton("OK", Buttons.A); + InputController.RegisterEventForKey("OK", Keys.Z); + Scores = new Dictionary(); + ReadScore(); + } + + public override void LoadContent() + { + base.LoadContent(); + Font = Game.Content.Load("Fonts\\bigfont"); + InputController.Bind("OK", HandleNext); + } + + public void HandleNext(float value) + { + if (!Active) { return; } + WriteScore(); + ScreenManager.Pop(); + } + + public void WriteScore() + { + using (StreamWriter swriter = new StreamWriter("scores.txt", true)) + { + swriter.WriteLine(nameChooser.Value() + "," + Game.Player.Score.ToString()); + } + } + + public void ReadScore() + { + try + { + using (StreamReader sreader = new StreamReader("scores.txt")) + { + string line = null; + while ((line = sreader.ReadLine()) != null) + { + string[] parts = line.Split(','); + Scores.Add(parts[0], int.Parse(parts[1])); + } + } + } + catch (FileNotFoundException) + { + } + } + + public override void CleanUp() + { + base.CleanUp(); + Font = null; + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + spriteBatch.DrawString(Font, "YOUR SCORE WAS: " + Game.Player.Score.ToString(), new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2), Color.Black); + spriteBatch.DrawString(Font, "Use Left Stick or Arrows to Choose Name Press A when done", new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 40), new Color(0, 0, 0, 128)); + nameChooser.Draw(spriteBatch); + DrawScores(spriteBatch); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + InputController.UpdateInput(false); + nameChooser.Update(gameTime); + } + + protected void DrawScores(SpriteBatch spriteBatch) + { + var sortedDict = (from entry in Scores orderby entry.Value descending select entry) + .Take(5) + .ToDictionary(pair => pair.Key, pair => pair.Value); + + var i = 0; + + foreach (KeyValuePair entry in sortedDict) { + i++; + spriteBatch.DrawString(Font, entry.Key + " " + entry.Value, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 100 + (32 * i)), new Color(0, 0, 0, 64)); + } + + } + } +} diff --git a/SuperPolarity/Screen.cs b/SuperPolarity/Screen.cs new file mode 100644 index 0000000..006b047 --- /dev/null +++ b/SuperPolarity/Screen.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Screen + { + protected SuperPolarity Game; + public bool Active; + public Screen(SuperPolarity game) + { + Active = false; + Game = game; + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + } + + public virtual void LoadContent() + { + } + + public virtual void Initialize() + { + } + + public virtual void CleanUp() + { + } + } +} diff --git a/SuperPolarity/ScreenManager.cs b/SuperPolarity/ScreenManager.cs new file mode 100644 index 0000000..b88741b --- /dev/null +++ b/SuperPolarity/ScreenManager.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ScreenManager + { + static Stack Screens; + static SuperPolarity Game; + + static ScreenManager() + { + Screens = new Stack(); + } + + static public void Push(Screen screen) + { + if (Screens.Count > 0) + { + Screens.Peek().Active = false; + } + + screen.LoadContent(); + screen.Active = true; + Screens.Push(screen); + } + + static public void Pop() + { + var screen = Screens.Pop(); + screen.Active = false; + screen.CleanUp(); + Screens.Peek().Active = true; + } + + static public void Update(GameTime gameTime) + { + Screens.Peek().Update(gameTime); + } + + static public void Draw(SpriteBatch spriteBatch) + { + Screens.Peek().Draw(spriteBatch); + } + + internal static void SetGame(SuperPolarity game) + { + Game = game; + } + } +} diff --git a/SuperPolarity/SuperPolarity.cs b/SuperPolarity/SuperPolarity.cs new file mode 100644 index 0000000..9311d53 --- /dev/null +++ b/SuperPolarity/SuperPolarity.cs @@ -0,0 +1,161 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Storage; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Audio; +using SuperPolarity; +#endregion + +namespace SuperPolarity +{ + /// + /// This is the main type for your game + /// + public class SuperPolarity : Game + { + public GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + public static int OutlierBounds; + + public Player Player; + + Screen EntryScreen; + + protected Song TitleSong; + protected Song GameSong; + protected SoundEffect GameOverSound; + + public SuperPolarity() + : base() + { + graphics = new GraphicsDeviceManager(this); + Components.Add(new GamerServicesComponent(this)); + + graphics.PreferMultiSampling = true; + graphics.PreferredBackBufferWidth = 1280; + graphics.PreferredBackBufferHeight = 720; + graphics.ToggleFullScreen(); + + Content.RootDirectory = "Content"; + ActorFactory.SetGame(this); + ParticleEffectFactory.SetGame(this); + ActorManager.SetGame(this); + ScreenManager.SetGame(this); + + EntryScreen = (Screen)new TitleScreen(this); + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + base.Initialize(); + + InputController.RegisterEventForKey("fullScreenToggle", Keys.F11); + InputController.Bind("fullScreenToggle", HandleFullScreenToggle); + + EntryScreen.Initialize(); + + OutlierBounds = 100; + } + + protected void HandleFullScreenToggle(float value) + { + graphics.ToggleFullScreen(); + graphics.ApplyChanges(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + + MediaPlayer.IsRepeating = true; + GameSong = Content.Load("Sound\\polaritytheme.wav"); + GameOverSound = Content.Load("Sound\\gameover"); + + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + ScreenManager.Push(EntryScreen); + + Player = new Player(this); + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + ScreenManager.Update(gameTime); + + Player.Update(); + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.White); + + spriteBatch.Begin(); + + ScreenManager.Draw(spriteBatch); + + spriteBatch.End(); + + base.Draw(gameTime); + } + + public void PlaySong(string songName) + { + // temp stuff before media manager is in + if (songName == "game") + { + MediaPlayer.Play(GameSong); + } + } + + public void GameOver() + { + var scoreScreen = new ScoreScreen(this); + scoreScreen.Initialize(); + + MediaPlayer.Stop(); + GameOverSound.Play(); + ScreenManager.Pop(); + ScreenManager.Push(scoreScreen); + } + } +} diff --git a/SuperPolarity/SuperPolarity.csproj b/SuperPolarity/SuperPolarity.csproj new file mode 100644 index 0000000..76124b7 --- /dev/null +++ b/SuperPolarity/SuperPolarity.csproj @@ -0,0 +1,196 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {2585188B-339D-44CD-9599-1A80AA30DE13} + WinExe + Properties + SuperPolarity + SuperPolarity + 512 + + + x86 + true + full + false + bin\WindowsGL\Debug\ + DEBUG;TRACE;WINDOWS + prompt + 4 + + + x86 + pdbonly + true + bin\WindowsGL\Release\ + TRACE;WINDOWS + prompt + 4 + + + Icon.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\OpenTK.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\Lidgren.Network.dll + + + ..\..\..\..\..\..\..\Program Files (x86)\MSBuild\..\MonoGame\v3.0\Assemblies\WindowsGL\Tao.Sdl.dll + + + + + + + SDL.dll + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + \ No newline at end of file diff --git a/SuperPolarity/TitleScreen.cs b/SuperPolarity/TitleScreen.cs new file mode 100644 index 0000000..a953f27 --- /dev/null +++ b/SuperPolarity/TitleScreen.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class TitleScreen : Screen + { + protected Texture2D TitleImage; + + public TitleScreen(SuperPolarity newGame) : base(newGame) {} + + public override void LoadContent() + { + base.LoadContent(); + TitleImage = Game.Content.Load("Graphics\\polaritydemotitle"); + InputController.Bind("pause", HandleStart); + } + + public void HandleStart(float value) + { + if (!Active) { return; } + Game.Player.Reset(); + var gameScreen = new GameScreen(Game); + gameScreen.Initialize(); + ScreenManager.Push(gameScreen); + } + + public override void CleanUp() + { + base.CleanUp(); + TitleImage = null; + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + InputController.UpdateInput(false); + } + } +} diff --git a/SuperPolarity/Widget.cs b/SuperPolarity/Widget.cs new file mode 100644 index 0000000..ea92cfd --- /dev/null +++ b/SuperPolarity/Widget.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Widget + { + public List Children; + public Dictionary>> Listeners; + + public Vector2 Position; + public SuperPolarity Game; + + protected bool Active; + + public Widget(SuperPolarity game, Vector2 position) + { + Game = game; + Position = position; + Active = false; + Children = new List(); + Listeners = new Dictionary>>(); + } + + public void Activate() + { + Active = true; + } + + public void Deactivate() + { + Active = false; + } + + public virtual void AppendChild(Widget widget) + { + Children.Add(widget); + } + + public virtual void Bind(string eventName, Action eventListener) + { + List> newListenerList; + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) + { + newListenerList = new List>(); + Listeners.Add(eventName, newListenerList); + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Add(eventListener); + } + + public virtual void Unbind(string eventName, Action eventListener) + { + // NOT YET IMPLEMENTED; + } + + public virtual void Dispatch(string eventName, float value) + { + List> listenerList; + bool foundListeners; + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + if (!foundListeners) + { + return; + } + + foreach (Action method in listenerList) + { + method(value); + } + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + } + } +} diff --git a/SuperPolarity/neutral-supercruiser.xnb b/SuperPolarity/neutral-supercruiser.xnb new file mode 100644 index 0000000..1389842 Binary files /dev/null and b/SuperPolarity/neutral-supercruiser.xnb differ diff --git a/SuperPolarity/scores.txt b/SuperPolarity/scores.txt new file mode 100644 index 0000000..e69de29 diff --git a/SuperPolarityContent/SuperPolarityContent/SuperPolarityContent.csproj b/SuperPolarityContent/SuperPolarityContent/SuperPolarityContent.csproj new file mode 100644 index 0000000..9075af4 --- /dev/null +++ b/SuperPolarityContent/SuperPolarityContent/SuperPolarityContent.csproj @@ -0,0 +1,65 @@ + + + + + {8528C189-5B94-48F8-8C64-D4D6658E52F6} + {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Windows + x86 + Library + Properties + ContentBuilder + IgnoreMe + v4.0 + Client + v4.0 + bin\$(Configuration) + Windows + HiDef + 70f11b5f-d758-4efc-943f-95989437d224 + Library + x86 + false + + + Windows + + + Windows8 + + + Android + + + iOS + + + OSX + + + Linux + + + PSM + + + + + + + {468F8415-7D38-4718-B0B4-E18F1A427136} + SuperPolarity ContentContent %28Content%29 + Content + + + + + + diff --git a/SuperPolarityContent/SuperPolarityContentContent/Fonts/SegoeUIMono14.spritefont b/SuperPolarityContent/SuperPolarityContentContent/Fonts/SegoeUIMono14.spritefont new file mode 100644 index 0000000..6c68f5d --- /dev/null +++ b/SuperPolarityContent/SuperPolarityContentContent/Fonts/SegoeUIMono14.spritefont @@ -0,0 +1,60 @@ + + + + + + + Segoe UI Mono + + + 14 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/SuperPolarityContent/SuperPolarityContentContent/Fonts/bigfont.png b/SuperPolarityContent/SuperPolarityContentContent/Fonts/bigfont.png new file mode 100644 index 0000000..67307dd Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Fonts/bigfont.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Fonts/smallfont.png b/SuperPolarityContent/SuperPolarityContentContent/Fonts/smallfont.png new file mode 100644 index 0000000..51a2c14 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Fonts/smallfont.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/circle.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/circle.png new file mode 100644 index 0000000..ede9996 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/circle.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/diamond.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/diamond.png new file mode 100644 index 0000000..f06a523 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/diamond.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/main-ship.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/main-ship.png new file mode 100644 index 0000000..168ce43 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/main-ship.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-cruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-cruiser.png new file mode 100644 index 0000000..0461e90 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-cruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-destroyer.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-destroyer.png new file mode 100644 index 0000000..25244f2 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-destroyer.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-scout.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-scout.png new file mode 100644 index 0000000..fdc372b Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-scout.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-ship.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-ship.png new file mode 100644 index 0000000..1407d5d Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-ship.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-supercruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-supercruiser.png new file mode 100644 index 0000000..344ef93 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/negative-supercruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-cruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-cruiser.png new file mode 100644 index 0000000..3f5be69 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-cruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-destroyer.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-destroyer.png new file mode 100644 index 0000000..458ec8e Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-destroyer.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-scout.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-scout.png new file mode 100644 index 0000000..e7a1364 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-scout.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-ship.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-ship.png new file mode 100644 index 0000000..6b0a767 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-ship.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-supercruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-supercruiser.png new file mode 100644 index 0000000..183b71c Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/neutral-supercruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/pause-screen.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/pause-screen.png new file mode 100644 index 0000000..0d6db73 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/pause-screen.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/polaritydemotitle.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/polaritydemotitle.png new file mode 100644 index 0000000..10a9b92 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/polaritydemotitle.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-cruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-cruiser.png new file mode 100644 index 0000000..62da8bc Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-cruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-destroyer.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-destroyer.png new file mode 100644 index 0000000..735d473 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-destroyer.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-scout.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-scout.png new file mode 100644 index 0000000..1970625 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-scout.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-ship.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-ship.png new file mode 100644 index 0000000..9d07a8c Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-ship.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-supercruiser.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-supercruiser.png new file mode 100644 index 0000000..6b2a77b Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/positive-supercruiser.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/square.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/square.png new file mode 100644 index 0000000..960c50a Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/square.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Graphics/star.png b/SuperPolarityContent/SuperPolarityContentContent/Graphics/star.png new file mode 100644 index 0000000..4f207f4 Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Graphics/star.png differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/Sound/polaritytheme.wav b/SuperPolarityContent/SuperPolarityContentContent/Sound/polaritytheme.wav new file mode 100644 index 0000000..28a6bce Binary files /dev/null and b/SuperPolarityContent/SuperPolarityContentContent/Sound/polaritytheme.wav differ diff --git a/SuperPolarityContent/SuperPolarityContentContent/SuperPolarityContentContent.contentproj b/SuperPolarityContent/SuperPolarityContentContent/SuperPolarityContentContent.contentproj new file mode 100644 index 0000000..12417a2 --- /dev/null +++ b/SuperPolarityContent/SuperPolarityContentContent/SuperPolarityContentContent.contentproj @@ -0,0 +1,192 @@ + + + + {468F8415-7D38-4718-B0B4-E18F1A427136} + {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Windows + x86 + Library + Properties + Super_Polarity_ContentContentContent + v4.0 + v4.0 + Windows + bin\$(MonoGamePlatform)\$(Configuration) + Content + x86 + + + Windows + + + Windows8 + + + Android + + + iOS + + + OSX + + + Linux + + + PSM + + + + + + + + + + $(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGameContentProcessors.dll + + + + + main-ship + TextureProcessor + + + negative-cruiser + TextureProcessor + + + negative-destroyer + TextureProcessor + + + negative-scout + TextureProcessor + + + negative-supercruiser + TextureProcessor + + + neutral-cruiser + TextureProcessor + + + neutral-destroyer + TextureProcessor + + + neutral-scout + TextureProcessor + + + neutral-ship + TextureProcessor + + + neutral-supercruiser + TextureProcessor + + + positive-cruiser + TextureProcessor + + + positive-destroyer + TextureProcessor + + + positive-scout + TextureProcessor + + + positive-ship + TextureProcessor + + + positive-supercruiser + TextureProcessor + + + + + pause-screen + TextureImporter + TextureProcessor + + + + + circle + TextureImporter + TextureProcessor + + + diamond + TextureImporter + TextureProcessor + + + star + TextureImporter + TextureProcessor + + + + + negative-ship + TextureImporter + TextureProcessor + + + + + square + TextureImporter + TextureProcessor + + + + + SegoeUIMono14 + FontDescriptionImporter + FontDescriptionProcessor + + + + + polaritytheme + WavImporter + SongProcessor + + + + + polaritydemotitle + TextureImporter + TextureProcessor + + + + + bigfont + TextureImporter + FontTextureProcessor + + + smallfont + TextureImporter + FontTextureProcessor + + + + + \ No newline at end of file diff --git a/SuperPolarityMac/ActorFactory.cs b/SuperPolarityMac/ActorFactory.cs new file mode 100644 index 0000000..f9c7697 --- /dev/null +++ b/SuperPolarityMac/ActorFactory.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Content; + +namespace SuperPolarity +{ + static class ActorFactory + { + static internal SuperPolarity Game; + + static public MainShip CreateMainShip(Vector2 position) + { + MainShip mainShip = new MainShip(Game); + mainShip.Initialize(Game.Content.Load("Graphics\\main-ship"), position); + + ActorManager.CheckIn(mainShip); + + return mainShip; + } + + static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position) + { + StandardShip ship = new StandardShip(Game); + Texture2D texture; + + if (polarity == Ship.Polarity.Positive) + { + texture = Game.Content.Load("Graphics\\positive-ship"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-ship"); + } + else + { + texture = Game.Content.Load("Graphics\\neutral-ship"); + } + + ship.Initialize(texture, position); + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + + return ship; + } + + internal static void SetGame(SuperPolarity game) + { + ActorFactory.Game = game; + } + + internal static Bullet CreateBullet(Vector2 position, float angle) + { + Bullet bullet = new Bullet(Game); + + bullet.Initialize(Game.Content.Load("Graphics\\square"), position); + + bullet.Angle = angle; + + ActorManager.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("Graphics\\positive-scout"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-scout"); + } + else + { + texture = Game.Content.Load("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.2f; + ship.FleeVelocity = 6.5f; + ship.ChargeVelocity = 5.5f; + ship.Value = 3; + ship.HP = 0; + ship.AngleChangeProbability = 20; + ship.SetPolarity(polarity); + + ActorManager.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("Graphics\\positive-cruiser"); + } + else if (polarity == Ship.Polarity.Negative) + { + texture = Game.Content.Load("Graphics\\negative-cruiser"); + } + else + { + texture = Game.Content.Load("Graphics\\neutral-cruiser"); + } + + ship.BoxDimensions.X = 40; + ship.BoxDimensions.Y = 40; + ship.BoxDimensions.W = 40; + ship.BoxDimensions.Z = 40; + + ship.Initialize(texture, position); + ship.MagneticRadius = 1000; + ship.RepelRadius = 200; + ship.MaxVelocity = 0.5f; + ship.FleeVelocity = 5; + ship.ChargeVelocity = 1; + ship.Value = 10; + ship.HP = 29; + ship.SetPolarity(polarity); + + ActorManager.CheckIn(ship); + + return ship; + } + } +} diff --git a/SuperPolarityMac/ActorManager.cs b/SuperPolarityMac/ActorManager.cs new file mode 100644 index 0000000..f5587b9 --- /dev/null +++ b/SuperPolarityMac/ActorManager.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ActorManager + { + + static SuperPolarity Game; + static int OutlierBounds; + static IList Actors; + + static ActorManager() + { + OutlierBounds = 100; + Actors = new List(); + } + + static public void CheckIn(Actor actor) + { + Actors.Add(actor); + } + + static public void CheckOut(Actor actor) + { + actor.CleanUp(); + Actors.Remove(actor); + actor = null; + } + + static public void Update(GameTime gameTime) + { + CheckActors(); + CheckOutliers(); + foreach (Actor actor in Actors) + { + actor.Update(gameTime); + } + } + + static public void Draw(SpriteBatch spriteBatch) + { + foreach (Actor actor in Actors) + { + actor.Draw(spriteBatch); + } + } + + static void CheckActors() + { + for (var i = Actors.Count - 1; i >= 0; i--) + { + if (i >= Actors.Count) { + i = Actors.Count - 1; + } + + if (Actors.Count == 0) + { + return; + } + + Actor actor = Actors[i]; + for (var j = i - 1; j >= 0; j--) + { + Actor other = Actors[j]; + + CheckCollision(actor, other); + + if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship))) + { + CheckMagnetism((Ship)actor, (Ship)other); + } + } + } + } + + static void CheckCollision(Actor actor, Actor other) + { + var collision = Rectangle.Intersect(actor.Box, other.Box); + var inverseCollision = Rectangle.Intersect(other.Box, actor.Box); + if (!collision.IsEmpty && !actor.Dying && !other.Dying) + { + actor.Collide(other, collision); + other.Collide(actor, inverseCollision); + } + + } + + static void CheckMagnetism(Ship actor, Ship other) + { + if (actor.CurrentPolarity != Ship.Polarity.Neutral && other.CurrentPolarity != Ship.Polarity.Neutral) + { + var dy = other.Position.Y - actor.Position.Y; + var dx = other.Position.X - actor.Position.X; + var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); + var angle = (float) Math.Atan2(dy, dx); + var otherAngle = (float)Math.Atan2(-dy, -dx); + + if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius) + { + actor.Magnetize(other, (float)linearDistance, angle); + other.Magnetize(actor, (float)linearDistance, otherAngle); + } + } + } + + static void CheckOutliers() + { + for (var i = Actors.Count; i > 0; i--) + { + var actor = Actors[i-1]; + if (actor.Position.X < -OutlierBounds || actor.Position.Y < -OutlierBounds || + actor.Position.X > Game.GraphicsDevice.Viewport.Width + OutlierBounds || + actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds) + { + CheckOut(actor); + if (actor.Parent != null) + { + actor.Parent.Children.Remove(actor); + } + } + } + } + + static public void Empty() + { + foreach (Actor actor in Actors) { + actor.CleanUp(); + } + Actors.Clear(); + } + + internal static void SetGame(SuperPolarity game) + { + Game = game; + } + + public static void Bomb() + { + for (var i = Actors.Count - 1; i >= 0; i--) + { + var actor = Actors[i]; + if (actor.GetType() == typeof(StandardShip)) + { + CheckOut(actor); + Renderer.CheckOut(actor); + } + } + } + + public static int CountBaddies() + { + return Actors.Where(a => a.GetType() == typeof(StandardShip)).Count(); + } + } +} diff --git a/SuperPolarityMac/BasicGenerator.cs b/SuperPolarityMac/BasicGenerator.cs new file mode 100644 index 0000000..ba51742 --- /dev/null +++ b/SuperPolarityMac/BasicGenerator.cs @@ -0,0 +1,77 @@ +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; + CurrentTime = rate; + } + + public void Update(GameTime gameTime) + { + if (ActorManager.CountBaddies() > 50) + { + return; + } + + 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) + { + Renderer.CheckIn(ActorFactory.CreateShip(polarity, Position)); + } + + if (ShipType == Ships.Scout) + { + Renderer.CheckIn(ActorFactory.CreateScout(polarity, Position)); + } + + if (ShipType == Ships.Battlecruiser) + { + Renderer.CheckIn(ActorFactory.CreateCruiser(polarity, Position)); + } + + } + } +} diff --git a/SuperPolarityMac/Content/logo.png b/SuperPolarityMac/Content/logo.png deleted file mode 100644 index 701c1b5..0000000 Binary files a/SuperPolarityMac/Content/logo.png and /dev/null differ diff --git a/SuperPolarityMac/Game1.cs b/SuperPolarityMac/Game1.cs deleted file mode 100644 index c0756a1..0000000 --- a/SuperPolarityMac/Game1.cs +++ /dev/null @@ -1,110 +0,0 @@ -#region File Description -//----------------------------------------------------------------------------- -// SuperPolarityMacGame.cs -// -// Microsoft XNA Community Game Platform -// Copyright (C) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------------- -#endregion - -#region Using Statements -using System; - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Input.Touch; -using Microsoft.Xna.Framework.Storage; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Media; - -#endregion - -namespace SuperPolarityMac -{ - /// - /// Default Project Template - /// - public class Game1 : Game - { - - #region Fields - GraphicsDeviceManager graphics; - SpriteBatch spriteBatch; - Texture2D logoTexture; - #endregion - - #region Initialization - - public Game1() - { - - graphics = new GraphicsDeviceManager(this); - - Content.RootDirectory = "Content"; - - graphics.IsFullScreen = false; - } - - /// - /// Overridden from the base Game.Initialize. Once the GraphicsDevice is setup, - /// we'll use the viewport to initialize some values. - /// - protected override void Initialize() - { - base.Initialize(); - } - - - /// - /// Load your graphics content. - /// - protected override void LoadContent() - { - // Create a new SpriteBatch, which can be use to draw textures. - spriteBatch = new SpriteBatch(graphics.GraphicsDevice); - - // TODO: use this.Content to load your game content here eg. - logoTexture = Content.Load("logo"); - } - - #endregion - - #region Update and Draw - - /// - /// Allows the game to run logic such as updating the world, - /// checking for collisions, gathering input, and playing audio. - /// - /// Provides a snapshot of timing values. - protected override void Update(GameTime gameTime) - { - // TODO: Add your update logic here - - base.Update(gameTime); - } - - /// - /// This is called when the game should draw itself. - /// - /// Provides a snapshot of timing values. - protected override void Draw(GameTime gameTime) - { - // Clear the backbuffer - graphics.GraphicsDevice.Clear(Color.CornflowerBlue); - - spriteBatch.Begin(); - - // draw the logo - spriteBatch.Draw(logoTexture, new Vector2 (130, 200), Color.White); - - spriteBatch.End(); - - //TODO: Add your drawing code here - base.Draw(gameTime); - } - - #endregion - } -} diff --git a/SuperPolarityMac/GameScreen.cs b/SuperPolarityMac/GameScreen.cs new file mode 100644 index 0000000..783e3c1 --- /dev/null +++ b/SuperPolarityMac/GameScreen.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + class GameScreen : Screen + { + public GameScreen(SuperPolarity newGame) : base(newGame) {} + + protected List Generators; + + protected int LivesRate; + protected int CurrentLivesRate; + protected int BombRate; + protected int CurrentBombRate; + protected SoundEffect BombSound; + protected SoundEffect LifeSound; + + protected bool Flashing; + + protected bool IsPaused; + protected Texture2D PauseScreen; + + public override void Initialize() + { + Generators = new List(); + + CurrentBombRate = 1; + BombRate = 6000; + + LivesRate = 10000; + CurrentLivesRate = 1; + + InputController.RegisterEventForButton("changePolarity", Buttons.A); + InputController.RegisterEventForKey("changePolarity", Keys.Z); + + InputController.RegisterEventForButton("shoot", Buttons.X); + InputController.RegisterEventForKey("shoot", Keys.X); + + InputController.Bind("pause", HandlePause); + + PauseScreen = Game.Content.Load("Graphics\\pause-screen"); + } + + protected void HandlePause(float value) + { + Console.WriteLine("Paused"); + IsPaused = !IsPaused; + + if (IsPaused) + { + MediaPlayer.Volume = 0.05f; + } + else + { + MediaPlayer.Volume = 1; + } + } + + public override void LoadContent() + { + CreateGenerators(); + + Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X + Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); + + BombSound = Game.Content.Load("Sound\\bomb"); + LifeSound = Game.Content.Load("Sound\\life"); + + Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); + + Game.PlaySong("game"); + } + + protected void CalculateBomb() + { + if (Game.Player.Score >= BombRate * CurrentBombRate) + { + ActorManager.Bomb(); + Flashing = true; + BombSound.Play(); + CurrentBombRate = CurrentBombRate + 1; + } + } + + protected void CalculateLife() + { + if (Game.Player.Score >= LivesRate * CurrentLivesRate) + { + Game.Player.Lives = Game.Player.Lives + 1; + LifeSound.Play(); + CurrentLivesRate = CurrentLivesRate + 1; + } + } + + public override void Update(GameTime gameTime) + { + CalculateBomb(); + CalculateLife(); + InputController.UpdateInput(IsPaused); + if (IsPaused) + { + return; + } + ActorManager.Update(gameTime); + + foreach (BasicGenerator generator in Generators) + { + generator.Update(gameTime); + } + } + + public override void Draw(SpriteBatch spriteBatch) + { + Renderer.Draw(spriteBatch); + Game.Player.Draw(spriteBatch); + + if (IsPaused) + { + spriteBatch.Draw(PauseScreen, new Vector2(0, 0), Color.White); + } + + if (Flashing) + { + Game.GraphicsDevice.Clear(Color.Black); + Flashing = false; + } + } + + protected void CreateGenerators() + { + // The basic ship generators. + var gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, -50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, -50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 0); + Generators.Add(gen); + + // After 1.5k liberate some sporadic Scouts, and add two more ship generators. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 3000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 3000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Scout, 6000, 1500); + Generators.Add(gen); + + + // After 3k add more scouts. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Scout, 3000, 3000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Scout, 3000, 5000); + Generators.Add(gen); + + // After 5k release more ships and a cruiser. + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, -50), BasicGenerator.Ships.Ship, 1500, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height + 50), BasicGenerator.Ships.Ship, 1500, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(-50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); + Generators.Add(gen); + + gen = new BasicGenerator(); + gen.Initialize(Game, new Vector2(Game.GraphicsDevice.Viewport.Width + 50, Game.GraphicsDevice.Viewport.Height / 2), BasicGenerator.Ships.Battlecruiser, 10000, 5000); + Generators.Add(gen); + } + + public override void CleanUp() + { + base.CleanUp(); + Generators.Clear(); + InputController.Unbind("pause", HandlePause); + Renderer.Empty(); + ActorManager.Empty(); + } + } +} diff --git a/SuperPolarityMac/Icon.ico b/SuperPolarityMac/Icon.ico new file mode 100644 index 0000000..13be62a Binary files /dev/null and b/SuperPolarityMac/Icon.ico differ diff --git a/SuperPolarityMac/Info.plist b/SuperPolarityMac/Info.plist deleted file mode 100644 index 07a58c3..0000000 --- a/SuperPolarityMac/Info.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - CFBundleIdentifier - com.yourcompany.MonoGame.Samples.Draw2D.MacOS - CFBundleName - MonoGame.Samples.Draw2D.MacOS - CFBundleVersion - 1 - LSMinimumSystemVersion - 10.6 - NSPrincipalClass - NSApplication - - - diff --git a/SuperPolarityMac/InputController.cs b/SuperPolarityMac/InputController.cs new file mode 100644 index 0000000..c92bb9c --- /dev/null +++ b/SuperPolarityMac/InputController.cs @@ -0,0 +1,248 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + static class InputController + { + static Dictionary>> Listeners; + static Dictionary> RegisteredKeys; + static Dictionary> RegisteredButtons; + static List BlockedKeys; + static List BlockedButtons; + + static GamePadState InputGamePadState; + static KeyboardState InputKeyboardState; + + /* + * Registered Events. + * + * You register: name of the event (ie. attack) and a key associated with it. + * or button... Left Stick /always/ dispatches move event. + */ + + static InputController() + { + Listeners = new Dictionary>>(); + RegisteredButtons = new Dictionary>(); + RegisteredKeys = new Dictionary>(); + BlockedKeys = new List(); + BlockedButtons = new List(); + InputKeyboardState = new KeyboardState(); + InputGamePadState = new GamePadState(); + } + + public static void UpdateInput() + { + DispatchMoveEvents(); + DispatchRegisteredEvents(); + } + + public static void UpdateInput(bool highPriorityOnly) + { + Poll(); + DispatchPauseEvent(); + if (!highPriorityOnly) + { + UpdateInput(); + } + } + + public static void DispatchPauseEvent() + { + // OK THIS IS ALL KINDS OF WRONG. THIS IS A PLACEHOLDER BECAUSE DEMO! + var keyPressed = false; + if ((InputKeyboardState.IsKeyDown(Keys.Enter) || InputGamePadState.IsButtonDown(Buttons.Start))) { + keyPressed = true; + if(!BlockedButtons.Contains("pause") && !BlockedKeys.Contains("pause")) + { + BlockedButtons.Add("pause"); + BlockedKeys.Add("pause"); + Console.WriteLine("Dispatch"); + Dispatch("pause", 0); + } + } + + if (!keyPressed) + { + BlockedButtons.Remove("pause"); + BlockedKeys.Remove("pause"); + } + } + + private static void Poll() + { + InputGamePadState = GamePad.GetState(Microsoft.Xna.Framework.PlayerIndex.One); + InputKeyboardState = Keyboard.GetState(); + } + + public static void RegisterEventForKey(string eventName, Keys key) + { + List newKeyList; + if (!RegisteredKeys.ContainsKey(eventName)) + { + newKeyList = new List(); + RegisteredKeys.Add(eventName, newKeyList); + } + + RegisteredKeys.TryGetValue(eventName, out newKeyList); + + newKeyList.Add(key); + } + + public static void RegisterEventForButton(string eventName, Buttons button) + { + List newButtonList; + if (!RegisteredButtons.ContainsKey(eventName)) + { + newButtonList = new List(); + RegisteredButtons.Add(eventName, newButtonList); + } + + RegisteredButtons.TryGetValue(eventName, out newButtonList); + + newButtonList.Add(button); + } + + private static void DispatchRegisteredEvents() + { + var keyFired = false; + + foreach (KeyValuePair> entry in RegisteredKeys) { + keyFired = false; + foreach (Keys key in entry.Value) + { + if (InputKeyboardState.IsKeyDown(key)) + { + if (!BlockedKeys.Contains(entry.Key)) + { + BlockedKeys.Add(entry.Key); + Dispatch(entry.Key, 1); + } + keyFired = true; + break; + } + } + + if (!keyFired) + { + BlockedKeys.Remove(entry.Key); + } + } + + foreach (KeyValuePair> entry in RegisteredButtons) + { + keyFired = false; + foreach (Buttons button in entry.Value) + { + if (InputGamePadState.IsButtonDown(button)) + { + if (!BlockedButtons.Contains(entry.Key)) + { + BlockedButtons.Add(entry.Key); + Dispatch(entry.Key, 1); + } + keyFired = true; + break; + }; + } + + if (!keyFired) + { + BlockedButtons.Remove(entry.Key); + } + } + } + + private static void DispatchMoveEvents() + { + float xMovement = 0.0f; + float yMovement = 0.0f; + // Dispatch the moveX / MoveY events every frame. + + xMovement = InputGamePadState.ThumbSticks.Left.X; + yMovement = -InputGamePadState.ThumbSticks.Left.Y; + + if (InputKeyboardState.IsKeyDown(Keys.Left)) + { + xMovement = -1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Right)) + { + xMovement = 1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Up)) + { + yMovement = -1.0f; + } + + if (InputKeyboardState.IsKeyDown(Keys.Down)) + { + yMovement = 1.0f; + } + + Dispatch("moveX", xMovement); + Dispatch("moveY", yMovement); + } + + public static void Bind(string eventName, Action listener) + { + List> newListenerList; + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) { + newListenerList = new List>(); + Listeners.Add(eventName, newListenerList); + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Add(listener); + } + + public static void Unbind(string eventName, Action listener) + { + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) + { + return; + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Remove(listener); + } + + public static void Dispatch(string eventName, float value) + { + List> listenerList; + bool foundListeners; + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + if (!foundListeners) + { + return; + } + + for (var i = listenerList.Count - 1; i >= 0; i--) + { + listenerList[i](value); + } + } + + public static void Unlock(string eventName) + { + BlockedButtons.Remove(eventName); + BlockedKeys.Remove(eventName); + } + } +} diff --git a/SuperPolarityMac/LetterChooseWidget.cs b/SuperPolarityMac/LetterChooseWidget.cs new file mode 100644 index 0000000..e52733f --- /dev/null +++ b/SuperPolarityMac/LetterChooseWidget.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class LetterChooseWidget : Widget + { + int CurrentChar; + bool Locked; + int LockRate; + int CurrentTime; + + SpriteFont Font; + + public LetterChooseWidget(SuperPolarity game, Vector2 position) : base(game, position) + { + Active = false; + CurrentChar = 65; + Font = game.Content.Load("Fonts\\bigfont"); + LockRate = 300; + CurrentTime = 0; + + InputController.Bind("moveY", HandleMovement); + } + + public void HandleMovement(float value) + { + if (!Active) { return; } + + if (value > 0.8 && !Locked) { + CurrentChar = CurrentChar + 1; + + if (CurrentChar > 90) + { + CurrentChar = 32; + } + + Locked = true; + } + + if (value < -0.8 && !Locked) { + CurrentChar = CurrentChar - 1; + + if (CurrentChar < 32) + { + CurrentChar = 90; + } + + Locked = true; + } + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; + if (CurrentTime > LockRate) + { + CurrentTime = 0; + Locked = false; + } + } + + public string Value() + { + return char.ConvertFromUtf32(CurrentChar); + } + + public override void Draw(SpriteBatch spriteBatch) + { + var color = new Color(0, 0, 0, 128); + if (Active) + { + color = new Color(201, 0, 68, 255); + } + spriteBatch.DrawString(Font, Value(), Position, color); + } + } +} diff --git a/SuperPolarityMac/Main.cs b/SuperPolarityMac/Main.cs deleted file mode 100644 index f21bf0b..0000000 --- a/SuperPolarityMac/Main.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using MonoMac.AppKit; -using MonoMac.Foundation; - -namespace SuperPolarityMac -{ - static class Program - { - /// - /// The main entry point for the application. - /// - static void Main (string[] args) - { - NSApplication.Init (); - - using (var p = new NSAutoreleasePool ()) { - NSApplication.SharedApplication.Delegate = new AppDelegate (); - NSApplication.Main (args); - } - - - } - } - - class AppDelegate : NSApplicationDelegate - { - Game1 game; - - public override void FinishedLaunching (MonoMac.Foundation.NSObject notification) - { - game = new Game1 (); - game.Run (); - } - - public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender) - { - return true; - } - } -} - - diff --git a/SuperPolarityMac/MenuItem.cs b/SuperPolarityMac/MenuItem.cs new file mode 100644 index 0000000..8e24c97 --- /dev/null +++ b/SuperPolarityMac/MenuItem.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuItem + { + } +} diff --git a/SuperPolarityMac/MenuWidget.cs b/SuperPolarityMac/MenuWidget.cs new file mode 100644 index 0000000..992ef43 --- /dev/null +++ b/SuperPolarityMac/MenuWidget.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SuperPolarity +{ + class MenuWidget + { + } +} diff --git a/SuperPolarityMac/NameChooserWidget.cs b/SuperPolarityMac/NameChooserWidget.cs new file mode 100644 index 0000000..ce7c149 --- /dev/null +++ b/SuperPolarityMac/NameChooserWidget.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class NameChooserWidget : Widget + { + int CurrentIndex; + bool Lock; + int LockRate; + int CurrentTime; + + public NameChooserWidget(SuperPolarity game, Vector2 position) + : base(game, position) + { + AppendChild(new LetterChooseWidget(game, new Vector2(position.X, position.Y))); + AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 32, position.Y))); + AppendChild(new LetterChooseWidget(game, new Vector2(position.X + 64, position.Y))); + CurrentIndex = 0; + Children[CurrentIndex].Activate(); + LockRate = 300; + CurrentTime = 0; + + InputController.Bind("moveX", HandleMovement); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds; + if (CurrentTime > LockRate) + { + CurrentTime = 0; + Lock = false; + } + + foreach (LetterChooseWidget widget in Children) + { + widget.Update(gameTime); + } + } + + public void HandleMovement(float value) + { + if (value > 0.8 && !Lock) + { + Children[CurrentIndex].Deactivate(); + CurrentIndex = CurrentIndex + 1; + + if (CurrentIndex > Children.Count - 1) + { + CurrentIndex = 0; + } + + Lock = true; + } + + if (value < -0.8 && !Lock) + { + Children[CurrentIndex].Deactivate(); + CurrentIndex = CurrentIndex - 1; + + if (CurrentIndex < 0) + { + CurrentIndex = Children.Count - 1; + } + + Lock = true; + } + + Children[CurrentIndex].Activate(); + } + + public string Value() + { + var name = ""; + + foreach (LetterChooseWidget letter in Children) + { + name = name + letter.Value(); + } + + return name; + } + + public override void Draw(SpriteBatch spriteBatch) + { + foreach (LetterChooseWidget widget in Children) + { + widget.Draw(spriteBatch); + } + } + } +} diff --git a/SuperPolarityMac/Particle.cs b/SuperPolarityMac/Particle.cs new file mode 100644 index 0000000..d65bac6 --- /dev/null +++ b/SuperPolarityMac/Particle.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Particle + { + public Texture2D Texture { get; set; } + public Vector2 Position { get; set; } + public Vector2 Velocity { get; set; } + public float Angle { get; set; } + public float AngularVelocity { get; set; } + public Color Color { get; set; } + public float Size { get; set; } + public int TTL { get; set; } + + public Particle(Texture2D texture, Vector2 position, Vector2 velocity, + float angle, float angularVelocity, Color color, float size, int ttl) + { + Texture = texture; + Position = position; + Velocity = velocity; + Angle = angle; + AngularVelocity = angularVelocity; + Color = color; + Size = size; + TTL = ttl; + } + + public void Update() + { + TTL--; + Position += Velocity; + Angle += AngularVelocity; + } + + public void Draw(SpriteBatch spriteBatch) + { + Rectangle sourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height); + Vector2 origin = new Vector2(Texture.Width / 2, Texture.Height / 2); + + spriteBatch.Draw(Texture, Position, sourceRectangle, Color, + Angle, origin, Size, SpriteEffects.None, 0f); + } + + } +} diff --git a/SuperPolarityMac/ParticleEffectFactory.cs b/SuperPolarityMac/ParticleEffectFactory.cs new file mode 100644 index 0000000..0cd9ed3 --- /dev/null +++ b/SuperPolarityMac/ParticleEffectFactory.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ParticleEffectFactory + { + static Game Game; + static Random random; + + static ParticleEffectFactory() + { + random = new Random(); + } + + public static ParticleEngine CreatePolarCircle(Vector2 location) + { + List texturesList = new List(); + + //texturesList.Add(Game.Content.Load("Graphics\\circle")); + texturesList.Add(Game.Content.Load("Graphics\\diamond")); + texturesList.Add(Game.Content.Load("Graphics\\square")); + + ParticleEngine particleEngine = new ParticleEngine(texturesList, location); + + particleEngine.Color = new Color(239, 203, 204); + particleEngine.TTL = 10; + particleEngine.TTLRandomFactor = 5; + particleEngine.ScatterFactor = 40; + particleEngine.ParticleCount = 50; + particleEngine.StretchFactor = 2.8f; + + + return particleEngine; + } + + public static ParticleEngine CreateBullet(Vector2 location) + { + List texturesList = new List(); + + texturesList.Add(Game.Content.Load("Graphics\\circle")); + //texturesList.Add(Game.Content.Load("Graphics\\diamond")); + texturesList.Add(Game.Content.Load("Graphics\\square")); + + ParticleEngine particleEngine = new ParticleEngine(texturesList, location); + + particleEngine.Color = Color.Gray; + particleEngine.TTL = 5; + particleEngine.TTLRandomFactor = 5; + particleEngine.ScatterFactor = 5; + particleEngine.ParticleCount = 10; + particleEngine.StretchFactor = 1; + + return particleEngine; + } + + internal static void SetGame(Game game) + { + ParticleEffectFactory.Game = game; + } + } +} diff --git a/SuperPolarityMac/ParticleEngine.cs b/SuperPolarityMac/ParticleEngine.cs new file mode 100644 index 0000000..51188ae --- /dev/null +++ b/SuperPolarityMac/ParticleEngine.cs @@ -0,0 +1,86 @@ +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; } + public Color Color; //TODO: Color list for random colors. + public int TTL; + public int TTLRandomFactor; + public int ScatterFactor; + public int ParticleCount; + public float StretchFactor; + private List particles; + private List textures; + + public ParticleEngine(List textures, Vector2 location) + { + EmitterLocation = location; + this.textures = textures; + this.particles = new List(); + random = new Random(); + Color = Color.Red; + TTL = 20; + TTLRandomFactor = 40; + StretchFactor = 1; + } + + 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 = Color; + float size = (float)random.NextDouble() * StretchFactor; + + position.X += random.Next(-ScatterFactor, ScatterFactor); + position.Y += random.Next(-ScatterFactor, ScatterFactor); + + int ttl = TTL + random.Next(TTLRandomFactor); + + 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(); + } + } +} diff --git a/SuperPolarityMac/Player.cs b/SuperPolarityMac/Player.cs new file mode 100644 index 0000000..184abdd --- /dev/null +++ b/SuperPolarityMac/Player.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + public class Player + { + public int Score; + public int Multiplier; + public int Lives; + + + SpriteFont DebugFont; + SuperPolarity Game; + + Texture2D LifeSprite; + + public Player(SuperPolarity game) + { + Score = 0; + Multiplier = 1; + Lives = 3; + Game = game; + DebugFont = Game.Content.Load("Fonts\\bigfont"); + LifeSprite = Game.Content.Load("Graphics\\neutral-ship"); + } + + public void AddScore(int value) + { + Score = Score + (value * Multiplier); + } + + public void AddMultiplier(int value) + { + Multiplier = Multiplier + 1; + } + + public void ResetMultiplier() + { + Multiplier = 1; + } + + public void Draw(SpriteBatch spriteBatch) + { + var UiColor = new Color(0, 0, 0, 200); + var lightColor = new Color(0, 0, 0, 128); + spriteBatch.DrawString(DebugFont, Score.ToString(), new Vector2(40, 30), UiColor); + spriteBatch.DrawString(DebugFont, "x" + Multiplier.ToString(), new Vector2(40, 50), lightColor); + + var lifePosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 140, 30); + if (Lives > 4) + { + spriteBatch.Draw(LifeSprite, lifePosition, null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); + spriteBatch.DrawString(DebugFont, "x " + Lives.ToString(), new Vector2(lifePosition.X + 8, lifePosition.Y + 5), UiColor); + } + else + { + for (var i = 0; i < Lives; i++) + { + spriteBatch.Draw(LifeSprite, new Vector2(lifePosition.X + (i * 28), lifePosition.Y), null, UiColor, (float)(Math.PI / 2), Vector2.Zero, 0.5f, SpriteEffects.None, 0f); + } + } + } + + public void Update() + { + + } + + public void Reset() + { + Score = 0; + Multiplier = 1; + Lives = 3; + } + } +} diff --git a/SuperPolarityMac/Program.cs b/SuperPolarityMac/Program.cs new file mode 100644 index 0000000..6c3f614 --- /dev/null +++ b/SuperPolarityMac/Program.cs @@ -0,0 +1,26 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +#endregion + +namespace SuperPolarity +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var superPolarity = new SuperPolarity()) + superPolarity.Run(); + } + } +#endif +} diff --git a/SuperPolarityMac/Properties/AssemblyInfo.cs b/SuperPolarityMac/Properties/AssemblyInfo.cs deleted file mode 100644 index d61ed27..0000000 --- a/SuperPolarityMac/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("SuperPolarityMac")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("benbeltran")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.0")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/SuperPolarityMac/Renderer.cs b/SuperPolarityMac/Renderer.cs new file mode 100644 index 0000000..7ca8158 --- /dev/null +++ b/SuperPolarityMac/Renderer.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Renderer + { + + static List Actors; + + static Renderer() + { + Actors = new List(); + } + + static public void CheckIn(Actor actor) + { + Actors.Add(actor); + } + + static public void CheckOut(Actor actor) + { + Actors.Remove(actor); + } + + static public void Draw(SpriteBatch spriteBatch) + { + foreach (Actor actor in Actors) + { + actor.Draw(spriteBatch); + } + } + + static public void Empty() + { + Actors.Clear(); + } + } +} diff --git a/SuperPolarityMac/ScoreScreen.cs b/SuperPolarityMac/ScoreScreen.cs new file mode 100644 index 0000000..bf43275 --- /dev/null +++ b/SuperPolarityMac/ScoreScreen.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace SuperPolarity +{ + class ScoreScreen : Screen + { + protected SpriteFont Font; + protected NameChooserWidget nameChooser; + protected Dictionary Scores; + + public ScoreScreen(SuperPolarity newGame) : base(newGame) { } + + public override void Initialize() + { + base.Initialize(); + nameChooser = new NameChooserWidget(Game, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 4)); + InputController.RegisterEventForButton("OK", Buttons.A); + InputController.RegisterEventForKey("OK", Keys.Z); + Scores = new Dictionary(); + ReadScore(); + } + + public override void LoadContent() + { + base.LoadContent(); + Font = Game.Content.Load("Fonts\\bigfont"); + InputController.Bind("OK", HandleNext); + } + + public void HandleNext(float value) + { + if (!Active) { return; } + WriteScore(); + ScreenManager.Pop(); + } + + public void WriteScore() + { + using (StreamWriter swriter = new StreamWriter("scores.txt", true)) + { + swriter.WriteLine(nameChooser.Value() + "," + Game.Player.Score.ToString()); + } + } + + public void ReadScore() + { + try + { + using (StreamReader sreader = new StreamReader("scores.txt")) + { + string line = null; + while ((line = sreader.ReadLine()) != null) + { + string[] parts = line.Split(','); + Scores.Add(parts[0], int.Parse(parts[1])); + } + } + } + catch (FileNotFoundException) + { + } + } + + public override void CleanUp() + { + base.CleanUp(); + Font = null; + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + spriteBatch.DrawString(Font, "YOUR SCORE WAS: " + Game.Player.Score.ToString(), new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2), Color.Black); + spriteBatch.DrawString(Font, "Use Left Stick or Arrows to Choose Name Press A when done", new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 40), new Color(0, 0, 0, 128)); + nameChooser.Draw(spriteBatch); + DrawScores(spriteBatch); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + InputController.UpdateInput(false); + nameChooser.Update(gameTime); + } + + protected void DrawScores(SpriteBatch spriteBatch) + { + var sortedDict = (from entry in Scores orderby entry.Value descending select entry) + .Take(5) + .ToDictionary(pair => pair.Key, pair => pair.Value); + + var i = 0; + + foreach (KeyValuePair entry in sortedDict) { + i++; + spriteBatch.DrawString(Font, entry.Key + " " + entry.Value, new Vector2(40, Game.GraphicsDevice.Viewport.Height / 2 + 100 + (32 * i)), new Color(0, 0, 0, 64)); + } + + } + } +} diff --git a/SuperPolarityMac/Screen.cs b/SuperPolarityMac/Screen.cs new file mode 100644 index 0000000..006b047 --- /dev/null +++ b/SuperPolarityMac/Screen.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Screen + { + protected SuperPolarity Game; + public bool Active; + public Screen(SuperPolarity game) + { + Active = false; + Game = game; + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + } + + public virtual void LoadContent() + { + } + + public virtual void Initialize() + { + } + + public virtual void CleanUp() + { + } + } +} diff --git a/SuperPolarityMac/ScreenManager.cs b/SuperPolarityMac/ScreenManager.cs new file mode 100644 index 0000000..b88741b --- /dev/null +++ b/SuperPolarityMac/ScreenManager.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + static class ScreenManager + { + static Stack Screens; + static SuperPolarity Game; + + static ScreenManager() + { + Screens = new Stack(); + } + + static public void Push(Screen screen) + { + if (Screens.Count > 0) + { + Screens.Peek().Active = false; + } + + screen.LoadContent(); + screen.Active = true; + Screens.Push(screen); + } + + static public void Pop() + { + var screen = Screens.Pop(); + screen.Active = false; + screen.CleanUp(); + Screens.Peek().Active = true; + } + + static public void Update(GameTime gameTime) + { + Screens.Peek().Update(gameTime); + } + + static public void Draw(SpriteBatch spriteBatch) + { + Screens.Peek().Draw(spriteBatch); + } + + internal static void SetGame(SuperPolarity game) + { + Game = game; + } + } +} diff --git a/SuperPolarityMac/SuperPolarity.cs b/SuperPolarityMac/SuperPolarity.cs new file mode 100644 index 0000000..9311d53 --- /dev/null +++ b/SuperPolarityMac/SuperPolarity.cs @@ -0,0 +1,161 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Storage; +using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Audio; +using SuperPolarity; +#endregion + +namespace SuperPolarity +{ + /// + /// This is the main type for your game + /// + public class SuperPolarity : Game + { + public GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + public static int OutlierBounds; + + public Player Player; + + Screen EntryScreen; + + protected Song TitleSong; + protected Song GameSong; + protected SoundEffect GameOverSound; + + public SuperPolarity() + : base() + { + graphics = new GraphicsDeviceManager(this); + Components.Add(new GamerServicesComponent(this)); + + graphics.PreferMultiSampling = true; + graphics.PreferredBackBufferWidth = 1280; + graphics.PreferredBackBufferHeight = 720; + graphics.ToggleFullScreen(); + + Content.RootDirectory = "Content"; + ActorFactory.SetGame(this); + ParticleEffectFactory.SetGame(this); + ActorManager.SetGame(this); + ScreenManager.SetGame(this); + + EntryScreen = (Screen)new TitleScreen(this); + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + base.Initialize(); + + InputController.RegisterEventForKey("fullScreenToggle", Keys.F11); + InputController.Bind("fullScreenToggle", HandleFullScreenToggle); + + EntryScreen.Initialize(); + + OutlierBounds = 100; + } + + protected void HandleFullScreenToggle(float value) + { + graphics.ToggleFullScreen(); + graphics.ApplyChanges(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + + MediaPlayer.IsRepeating = true; + GameSong = Content.Load("Sound\\polaritytheme.wav"); + GameOverSound = Content.Load("Sound\\gameover"); + + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + ScreenManager.Push(EntryScreen); + + Player = new Player(this); + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// all content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + ScreenManager.Update(gameTime); + + Player.Update(); + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.White); + + spriteBatch.Begin(); + + ScreenManager.Draw(spriteBatch); + + spriteBatch.End(); + + base.Draw(gameTime); + } + + public void PlaySong(string songName) + { + // temp stuff before media manager is in + if (songName == "game") + { + MediaPlayer.Play(GameSong); + } + } + + public void GameOver() + { + var scoreScreen = new ScoreScreen(this); + scoreScreen.Initialize(); + + MediaPlayer.Stop(); + GameOverSound.Play(); + ScreenManager.Pop(); + ScreenManager.Push(scoreScreen); + } + } +} diff --git a/SuperPolarityMac/TitleScreen.cs b/SuperPolarityMac/TitleScreen.cs new file mode 100644 index 0000000..a953f27 --- /dev/null +++ b/SuperPolarityMac/TitleScreen.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class TitleScreen : Screen + { + protected Texture2D TitleImage; + + public TitleScreen(SuperPolarity newGame) : base(newGame) {} + + public override void LoadContent() + { + base.LoadContent(); + TitleImage = Game.Content.Load("Graphics\\polaritydemotitle"); + InputController.Bind("pause", HandleStart); + } + + public void HandleStart(float value) + { + if (!Active) { return; } + Game.Player.Reset(); + var gameScreen = new GameScreen(Game); + gameScreen.Initialize(); + ScreenManager.Push(gameScreen); + } + + public override void CleanUp() + { + base.CleanUp(); + TitleImage = null; + } + + public override void Draw(SpriteBatch spriteBatch) + { + base.Draw(spriteBatch); + spriteBatch.Draw(TitleImage, new Vector2(0, 0), Color.White); + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + InputController.UpdateInput(false); + } + } +} diff --git a/SuperPolarityMac/Widget.cs b/SuperPolarityMac/Widget.cs new file mode 100644 index 0000000..ea92cfd --- /dev/null +++ b/SuperPolarityMac/Widget.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Widget + { + public List Children; + public Dictionary>> Listeners; + + public Vector2 Position; + public SuperPolarity Game; + + protected bool Active; + + public Widget(SuperPolarity game, Vector2 position) + { + Game = game; + Position = position; + Active = false; + Children = new List(); + Listeners = new Dictionary>>(); + } + + public void Activate() + { + Active = true; + } + + public void Deactivate() + { + Active = false; + } + + public virtual void AppendChild(Widget widget) + { + Children.Add(widget); + } + + public virtual void Bind(string eventName, Action eventListener) + { + List> newListenerList; + List> listenerList; + bool foundListeners; + + if (!Listeners.ContainsKey(eventName)) + { + newListenerList = new List>(); + Listeners.Add(eventName, newListenerList); + } + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + listenerList.Add(eventListener); + } + + public virtual void Unbind(string eventName, Action eventListener) + { + // NOT YET IMPLEMENTED; + } + + public virtual void Dispatch(string eventName, float value) + { + List> listenerList; + bool foundListeners; + + foundListeners = Listeners.TryGetValue(eventName, out listenerList); + + if (!foundListeners) + { + return; + } + + foreach (Action method in listenerList) + { + method(value); + } + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + } + } +} diff --git a/SuperPolarityMac/neutral-supercruiser.xnb b/SuperPolarityMac/neutral-supercruiser.xnb new file mode 100644 index 0000000..1389842 Binary files /dev/null and b/SuperPolarityMac/neutral-supercruiser.xnb differ -- cgit