- Timestamp:
- 2012-06-15 10:57:28 (11 years ago)
- Location:
- 2012/24/AnnaS/Hiiripeli/Hiiripeli
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/AnnaS/Hiiripeli/Hiiripeli/Hiiripeli/Hiiripeli.cs
r3038 r3078 33 33 Vector lentokonepaikka; 34 34 35 IntMeter juustoLaskuri = new IntMeter(0); 36 Label juustot = new Label(); 37 35 38 public override void Begin() 36 39 { 37 Gravity = new Vector(0, -1000);38 40 pelaajanvasenKuva = Image.Mirror(pelaajanKuva); 39 41 kissaKuva = Image.Mirror(kissaKuva); 40 42 AloitaPeli(); 43 } 44 45 void AloitaPeli() 46 { 47 juustoLaskuri.Value = 0; 48 ClearAll(); 41 49 luoKentta(); 42 50 lisaaNappaimet(); 51 52 juustot = new Label(); 53 juustot.BindTo(juustoLaskuri); 54 Add(juustot); 43 55 44 56 Camera.Follow(pelaaja1); … … 47 59 } 48 60 61 49 62 void luoKentta() 50 63 { 64 Gravity = new Vector(0, -1000); 51 65 TileMap kentta = TileMap.FromFile("kentta1.txt"); 52 66 kentta.SetTileMethod('#', lisaaPilvi); … … 69 83 lisaaLintuajastin(); 70 84 lisaaUfojastin(); 85 86 71 87 } 72 88 … … 130 146 pelaaja1.LeftWalkingAnimation = pelaajanvasenKuva; 131 147 pelaaja1.RightWalkingAnimation = pelaajanKuva; 132 } 148 //AddCollisionHandler(pelaaja1, "vaarallinen", pelaajaanOsuu); 149 } 150 151 void pelaajaanOsuu(PhysicsObject pelaaja, PhysicsObject kohde) 152 { 153 AloitaPeli(); 154 } 155 156 157 133 158 void lisaaRuoho(Vector paikka, double leveys, double korkeus) 134 159 { … … 156 181 Kissa.Position = paikka; 157 182 Kissa.Image = kissaKuva; 183 Kissa.Tag = "vaarallinen"; 158 184 Add(Kissa); 159 Kissa.Velocity = new Vector(- 200, 0);185 Kissa.Velocity = new Vector(-100, 0); 160 186 AddCollisionHandler(Kissa, "este", kissakaantyy); 161 187 } … … 176 202 Kissa.X = Level.Right; 177 203 Kissa.Y = RandomGen.NextDouble(Level.Bottom, Level.Bottom + 1000); 204 Kissa.Tag = "vaarallinen"; 178 205 Add(Kissa); 179 206 Kissa.IgnoresCollisionResponse = true; … … 187 214 Add(Maali); 188 215 Maali.IgnoresCollisionResponse = true; 189 190 } 216 AddCollisionHandler(pelaaja1, Maali, loppu); 217 } 218 219 void loppu(PhysicsObject pelaaja, PhysicsObject loppu) 220 { 221 MessageDisplay.Add("Loppu"); 222 } 223 191 224 192 225 … … 216 249 { 217 250 Timer ufoajastin = new Timer(); 218 ufoajastin.Interval = 2;251 ufoajastin.Interval = 15; 219 252 ufoajastin.Timeout += delegate 220 253 { … … 265 298 Lintu.IgnoresGravity = true; 266 299 Lintu.Velocity = new Vector(-100, 0); 300 Lintu.Tag = "vaarallinen"; 267 301 Add(Lintu); 268 302 } … … 275 309 Lintu.X = Level.Left; 276 310 Lintu.Y = RandomGen.NextDouble(Level.Bottom, Level.Bottom + 1000); 311 Lintu.Tag = "vaarallinen"; 277 312 Add(Lintu); 278 313 Lintu.IgnoresCollisionResponse = true; 279 314 Lintu.IgnoresGravity = true; 280 Lintu.Velocity = new Vector(100, 0); 315 Lintu.Velocity = new Vector(100, 0);Lintu.Tag = "vaarallinen"; 281 316 Add(Lintu); 282 317 } … … 285 320 PhysicsObject Ufo = new PhysicsObject(leveys * 3, korkeus * 2); 286 321 Ufo.IgnoresGravity = true; 287 Ufo.Hit(new Vector(10, 10));322 Ufo.Hit(new Vector(10,30)); 288 323 Ufo.Image = ufoKuva; 289 Ufo.X = (200); 290 //Ufo.Y = (200); 291 Ufo.Bottom = Level.Bottom + 300; 324 Ufo.X = (60); 325 Ufo.Y = (800); 292 326 Add(Ufo); 327 Ufo.Tag = "vaarallinen"; 293 328 Ufo.IgnoresCollisionResponse = true; 294 329 295 330 RandomMoverBrain satunnaisAivot = new RandomMoverBrain(); 296 satunnaisAivot.ChangeMovementSeconds = 3;297 satunnaisAivot.Speed = 1500;331 satunnaisAivot.ChangeMovementSeconds = 6; 332 satunnaisAivot.Speed = 2500; 298 333 satunnaisAivot.Active = true; 299 334 Ufo.Brain = satunnaisAivot; … … 335 370 { 336 371 maaliAani.Play(); 337 MessageDisplay.Add("Keräsit juuston!"); 372 juustoLaskuri.Value++; 373 //MessageDisplay.Add("Keräsit juuston!"); 338 374 kohde.Destroy(); 339 375 -
2012/24/AnnaS/Hiiripeli/Hiiripeli/Hiiripeli/kentta1.txt
r3038 r3078 1 2 3 4 5 6 7 8 9 1 10 11 12 13 14 15 16 17 18 o 19 *** 20 T T 2 21 3 M 4 5 T T 6 7 O 8 22 O o 23 24 T ** o 25 26 ** T 27 o 28 T 9 29 T 10 30 11 T T12 13 o14 T T T15 16 o17 T T TT18 19 T20 T T21 T22 o o 23 VT31 T ** T ** 32 T 33 *** * o 34 T T 35 T 36 ** 37 T T 38 39 * 40 T T 41 42 T 43 *** T 24 44 25 45 P ## 26 46 47 27 48 **** V 28 ### * 49 ### * 50 51 ## I***KI 52 IK*****I # ###### 53 ###### 54 ** ## *** 55 ## ## 56 V * ** 57 ## ## ## ## ** 58 ### 29 59 30 ## ## I ***K I 31 IK * I # ###### 32 ###### 33 ** ## ## 34 ## ## 35 * * 36 ## V ## ## ## 37 38 ## * * 39 ## ## ## ### V 40 # 41 IK I * * 42 ###### ## ## ## 43 44 ** ** U * * 60 ## ## ### ## 61 # ## 62 ## * * # 63 ## ## ## ### 64 IK****I * * V 65 ###### ## ## ## *** 66 ### 67 ** ** U * * 45 68 ## ## ## ## ## 46 o 47 ** LN I *****K I 48 RRRRRRRRRRRRRRRRRRRRRRR 49 69 70 ** LN I M *****K I 71 RRRRRRRRRRRRRRRRRRRRRRRRRR -
2012/24/AnnaS/Hiiripeli/Hiiripeli/HiiripeliContent/HiiripeliContent.contentproj
r3072 r3078 154 154 </Compile> 155 155 </ItemGroup> 156 <ItemGroup> 157 <Compile Include="Voittokuva.png"> 158 <Name>Voittokuva</Name> 159 <Importer>TextureImporter</Importer> 160 <Processor>TextureProcessor</Processor> 161 </Compile> 162 </ItemGroup> 156 163 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 157 164 <!-- 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.