- Timestamp:
- 2012-07-05 14:23:33 (11 years ago)
- Location:
- 2012/27/JuhoK
- Files:
-
- 3 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/JuhoK/Impossible/Impossible/Impossible/Impossible.cs
r3587 r3590 11 11 double moveSpeed = 1600; 12 12 bool allowMove = false; 13 int kenttaNro = 1; 13 bool nextLevel = true; 14 int kenttaNro = 0; 15 int kenttaMax = 1; 14 16 15 17 PlatformCharacter cube; … … 23 25 Vector currPos; 24 26 Vector prevPos; 27 28 ExplosionSystem es; 25 29 26 30 public override void Begin() … … 49 53 allowMove = false; 50 54 createExplosion(cube.Position); 55 MediaPlayer.Stop(); 51 56 cube.Destroy(); 52 57 } … … 62 67 { 63 68 ClearAll(); 64 Level.Background.Image = LoadImage("background"); 65 LuoKentta(kenttaNro); 66 Level.Background.FitToLevel(); 67 68 Keyboard.Listen(Key.Space, ButtonState.Down, jump, null); 69 Keyboard.Listen(Key.Enter, ButtonState.Pressed, startGame, null); 70 71 Gravity = new Vector(0, -7500); 72 73 Camera.Follow(pelaajanHaamu); 74 Camera.StayInLevel = true; 75 //Camera.ZoomToLevel(); 76 Camera.ZoomFactor = 0.3; 69 70 es = new ExplosionSystem(LoadImage("explosion"), 100); 71 Add(es); 72 73 if (nextLevel == true) { kenttaNro++; nextLevel = false; } 74 if (kenttaNro <= kenttaMax) 75 { 76 Level.Background.Image = LoadImage("background"); 77 LuoKentta(kenttaNro); 78 Level.Background.FitToLevel(); 79 80 Keyboard.Listen(Key.Space, ButtonState.Down, jump, null); 81 Keyboard.Listen(Key.Enter, ButtonState.Pressed, startGame, null); 82 83 Gravity = new Vector(0, -7500); 84 85 Camera.Follow(pelaajanHaamu); 86 Camera.StayInLevel = true; 87 //Camera.ZoomToLevel(); 88 Camera.ZoomFactor = 0.3; 89 MediaPlayer.Play("track"+kenttaNro); 90 } 91 else { gameOver(); } 77 92 78 93 } … … 120 135 Piikki.Position = paikka; 121 136 Piikki.Image = piikinKuva; 122 Piikki.Shape = Shape. Triangle;137 Piikki.Shape = Shape.FromImage(piikinKuva); 123 138 Piikki.Color = Color.Pink; 139 Piikki.Tag = "piikki"; 124 140 Add(Piikki); 125 141 } … … 135 151 Add(cube); 136 152 allowMove = true; 153 AddCollisionHandler(cube, cubeCollision); 137 154 138 155 pelaajanHaamu = new GameObject(leveys, korkeus); … … 148 165 palikka.Shape = Shape.Rectangle; 149 166 palikka.Color = Color.Gray; 167 palikka.Tag = "maali"; 150 168 Add(palikka); 151 169 } … … 164 182 165 183 void createExplosion(Vector position) 166 { 167 Explosion explosion = new Explosion(100); 168 explosion.Position = position; 169 explosion.Size = new Vector(50, 50); 170 explosion.Speed = 1; 171 Add(explosion); 184 { 185 es.AddEffect(position, 100); 186 } 187 188 void cubeCollision(PhysicsObject tormaaja, PhysicsObject kohde) 189 { 190 if (kohde.Tag.ToString() == "piikki") 191 { 192 createExplosion(cube.Position); 193 MediaPlayer.Stop(); 194 cube.Destroy(); 195 allowMove = false; 196 } 197 else if (kohde.Tag.ToString() == "maali") 198 { 199 MessageDisplay.Add("Next level reached!"); 200 nextLevel = true; 201 startGame(); 202 } 203 } 204 205 void gameOver() 206 { 207 Level.BackgroundColor = Color.Pink; 208 MessageDisplay.Add("OutOfMemoryExeption; GAME ABORTED!"); 172 209 } 173 210 } -
2012/27/JuhoK/Impossible/Impossible/Impossible/Impossible.csproj.Debug.cachefile
r3587 r3590 5 5 Content\viiva.xnb 6 6 Content\background.xnb 7 Content\explosion.xnb 8 Content\track1.xnb 9 Content\exp.xnb 10 Content\track1.wma 7 11 Content\piikki.png -
2012/27/JuhoK/Impossible/Impossible/ImpossibleContent/ImpossibleContent.contentproj
r3587 r3590 87 87 </Compile> 88 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="explosion.png"> 91 <Name>explosion</Name> 92 <Importer>TextureImporter</Importer> 93 <Processor>TextureProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 97 <Compile Include="track1.mp3"> 98 <Name>track1</Name> 99 <Importer>Mp3Importer</Importer> 100 <Processor>SongProcessor</Processor> 101 </Compile> 102 </ItemGroup> 89 103 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 90 104 <!-- 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.