- Timestamp:
- 2012-06-13 10:55:17 (11 years ago)
- Location:
- 2012/24/JaakkoL/Crisis Fire
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1/Peli.cs
r2955 r2979 20 20 { 21 21 public int HP; 22 public int S aatavatPisteet;22 public int ScoreValue; 23 23 24 24 public Enemy(double height, double width) … … 43 43 Enemy LargeEnemy; 44 44 Enemy Boss; 45 PhysicsObject BorderTop; 46 PhysicsObject BorderBottom; 47 PhysicsObject BorderLeft; 45 PhysicsObject Border; 48 46 IntMeter PowerGauge; 49 47 IntMeter ScoreGauge; … … 59 57 void Field() 60 58 { 59 TileMap LevelSpawns = TileMap.FromLevelAsset("FieldFromTilemap"); 61 60 Level.BackgroundColor = Color.Gray; 62 Camera.ZoomToLevel(); 63 64 BorderTop = new PhysicsObject(20000.0, 150.0, Shape.Rectangle); 65 BorderTop.Y = Screen.Top - 150.0; 66 BorderTop.X = 0.0; 67 BorderTop.Mass = 99999999999999999999999999999.0; 68 BorderTop.Restitution = 0.0; 69 BorderTop.Color = Color.Black; 70 BorderTop.IgnoresGravity = true; 71 Add(BorderTop); 72 73 BorderBottom = new PhysicsObject(20000.0, 150.0, Shape.Rectangle); 74 BorderBottom.Y = Screen.Bottom + 150.0; 75 BorderBottom.X = 0.0; 76 BorderBottom.Mass = 9999999999999999999999999999999.0; 77 BorderBottom.Restitution = 0.0; 78 BorderBottom.Color = Color.Black; 79 BorderBottom.IgnoresGravity = true; 80 Add(BorderBottom); 81 82 BorderLeft = new PhysicsObject(100.0, 800.0, Shape.Rectangle); 83 BorderLeft.Y = 0; 84 BorderLeft.X = Screen.Left + 90.0; 85 BorderLeft.Mass = 9999999999999999999999999999999.0; 86 BorderLeft.Restitution = 0.0; 87 BorderLeft.Color = Color.Black; 88 BorderLeft.IgnoresGravity = true; 89 Add(BorderLeft); 90 91 Player = new Player(10.0, 10.0); 61 62 LevelSpawns.SetTileMethod('-', CreateBorder); 63 LevelSpawns.SetTileMethod('/', CreateThreshold); 64 LevelSpawns.SetTileMethod('|', CreateKillBorder); 65 LevelSpawns.SetTileMethod('P', SpawnPlayer); 66 LevelSpawns.SetTileMethod('S', SpawnSmallEnemy); 67 LevelSpawns.SetTileMethod('M', SpawnEnemy); 68 LevelSpawns.SetTileMethod('L', SpawnLargeEnemy); 69 LevelSpawns.SetTileMethod('B', SpawnBoss); 70 71 Camera.ZoomTo(); 72 73 Gravity = new Vector(-200.0, 0.0); 74 // Assigns the spawn methods to the game's tilemap and adds constant gravity (which only affects enemies) 75 } 76 77 void SpawnPlayer(Vector PPosition, double height, double width) 78 { 79 height = 10.0; 80 width = 10.0; 81 Player = new Player(height, width); 92 82 double massP1 = 10.0; 93 83 Player.Mass = massP1; 84 Player.Position = PPosition; 94 85 Player.Shape = Shape.Circle; 95 86 Player.Color = Color.Red; 96 Player.X = -400.0;97 Player.Y = 0.0;98 87 Player.IgnoresGravity = true; 88 Player.Tag = "P1"; 99 89 Add(Player); 100 101 Gravity = new Vector(-200.0, 0.0); 102 // Creates the level's borders and player. 103 // Note that you have 0 lives, the game is over if you are hit. But that's kind of a score attack SHMUP's idea. 104 } 105 106 void EnemySpawns() 90 // Creates the player's ship 91 } 92 93 void CreateBorder(Vector BorPosition, double height, double width) 94 { 95 PhysicsObject Border = PhysicsObject.CreateStaticObject(height, width); 96 Border.Position = BorPosition; 97 Border.Shape = Shape.Rectangle; 98 Border.Color = Color.Black; 99 Border.Restitution = 0.0; 100 Border.Mass = 999999999999999.0; 101 Add(Border); 102 // Creates the level's borders 103 } 104 105 void CreateKillBorder(Vector KBPosition, double height, double width) 106 { 107 PhysicsObject KillBorder = PhysicsObject.CreateStaticObject(height, width); 108 KillBorder.Position = KBPosition; 109 KillBorder.Shape = Shape.Rectangle; 110 KillBorder.Color = Color.Red; 111 KillBorder.IgnoresCollisionResponse = true; 112 AddCollisionHandler(Player, KillBorderCollision); 113 Add(KillBorder); 114 // Adds a border that the player cannot cross without dying; this is to prevent moving out of the camera bounds 115 } 116 117 void KillBorderCollision(PhysicsObject Player, PhysicsObject KillBorder) 118 { 119 Remove(Player); 120 MessageDisplay.Add("The force field vaporized you."); 121 Label GameOver = new Label(300.0, 100.0, "Game Over"); 122 GameOver.TextColor = Color.White; 123 GameOver.BorderColor = Color.Red; 124 GameOver.Color = Color.Black; 125 Add(GameOver); 126 Timer.SingleShot(5.0, Exit); 127 } 128 129 void CreateThreshold(Vector THPosition, double height, double width) 130 { 131 PhysicsObject Threshold = PhysicsObject.CreateStaticObject(height, width); 132 Threshold.Position = THPosition; 133 Threshold.Shape = Shape.Rectangle; 134 Threshold.Color = Color.DarkOrange; 135 Threshold.IgnoresCollisionResponse = true; 136 AddCollisionHandler<PhysicsObject,Enemy>(Threshold, EnemyReachesThreshold); 137 Add(Threshold); 138 } 139 140 void EnemyReachesThreshold(PhysicsObject Threshold, Enemy Target) 141 { 142 if (Target.Tag == "Enemy") 143 { 144 ScoreGauge.Value = ScoreGauge.Value - Target.ScoreValue / 2; 145 Remove(Target); 146 } 147 } 148 149 150 void SpawnSmallEnemy(Vector SEPosition, double height, double width) 107 151 { 108 152 … … 142 186 Primary.Y = y; 143 187 Primary.IgnoresGravity = true; 188 AddCollisionHandler(Primary, PrimaryDamagesEnemy); 144 189 Add(Primary); 145 190 Primary.Hit(PrimaryImpulse); 191 } 192 193 void PrimaryDamagesEnemy(PhysicsObject Primary, PhysicsObject Target) 194 { 195 if (Target.Tag == "Enemy") 196 { 197 198 } 146 199 } 147 200 … … 161 214 Secondary.Y = Y; 162 215 Secondary.IgnoresGravity = true; 216 AddCollisionHandler(Secondary, SecondaryDamagesEnemy); 163 217 Add(Secondary); 164 218 Secondary.Hit(SecondaryImpulse); 219 } 220 221 void SecondaryDamagesEnemy(PhysicsObject Secondary, PhysicsObject Target) 222 { 223 if (Target.Tag == "Enemy") 224 { 225 226 } 165 227 } 166 228 -
2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1/obj/x86/Debug/ContentPipeline-{7ACFD14C-C6F7-4882-A22A-55EBD417A6D1}.xml
r2908 r2979 2 2 <XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 3 3 <Asset Type="Pipeline:BuildItemCollection"> 4 <BuildSuccessful> true</BuildSuccessful>4 <BuildSuccessful>false</BuildSuccessful> 5 5 <Settings> 6 6 <ContentProjectGUID>{7ACFD14C-C6F7-4882-A22A-55EBD417A6D1}</ContentProjectGUID> … … 16 16 <Assemblies> 17 17 <Assembly> 18 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key> 19 <Value>2011-09-01T17:22:30+03:00</Value> 20 </Assembly> 21 <Assembly> 22 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</Key> 23 <Value>2011-09-01T17:22:30+03:00</Value> 24 </Assembly> 25 <Assembly> 26 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</Key> 27 <Value>2011-09-01T17:22:30+03:00</Value> 28 </Assembly> 29 <Assembly> 30 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</Key> 31 <Value>2011-09-01T17:22:30+03:00</Value> 32 </Assembly> 33 <Assembly> 34 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</Key> 35 <Value>2011-09-01T17:22:30+03:00</Value> 36 </Assembly> 37 <Assembly> 38 <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</Key> 39 <Value>2011-09-01T17:22:30+03:00</Value> 40 </Assembly> 41 <Assembly> 18 42 <Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key> 19 43 <Value>2012-03-16T14:34:47.0906126+02:00</Value> -
2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1Content/Crisis Fire Content.contentproj
r2908 r2979 42 42 </Reference> 43 43 </ItemGroup> 44 <ItemGroup> 45 <Compile Include="FieldFromTilemap.txt"> 46 <Name>FieldFromTilemap</Name> 47 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 48 <Processor>TextureProcessor</Processor> 49 </Compile> 50 </ItemGroup> 44 51 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 45 52 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.