Changeset 898 for 2010/24/timisahe/Ympyroita
- Timestamp:
- 2010-06-16 11:31:13 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/timisahe/Ympyroita/Peli.cs
r890 r898 6 6 public class Peli : PhysicsGame 7 7 { 8 PlatformCharacter pelaaja1;9 10 const double nopeus = 200;11 const double hyppyVoima = 4000;12 8 13 9 protected override void Begin() 14 10 { 15 11 12 Gravity = new Vector(0.0, -8.0); 13 for (int i = 0; i < 500; i++) 14 { 15 PiirraYmpyra(); 16 } 16 17 18 Level.CreateBorders(0.5, false); 19 Level.BackgroundColor = Color.SkyBlue; 17 20 18 Gravity = new Vector(0, -1000); 19 20 PiirraYmpyra(); 21 PiirraYmpyra(); 22 PiirraYmpyra(); 23 PiirraYmpyra(); 24 PiirraYmpyra(); 25 PiirraYmpyra(); 26 PiirraYmpyra(); 27 PiirraYmpyra(); 28 PiirraYmpyra(); 29 PiirraYmpyra(); 30 PiirraYmpyra(); 31 PiirraYmpyra(); 32 PiirraYmpyra(); 33 PiirraYmpyra(); 34 PiirraYmpyra(); 35 PiirraYmpyra(); 36 PiirraYmpyra(); 37 PiirraYmpyra(); 38 PiirraYmpyra(); 39 PiirraYmpyra(); 40 PiirraYmpyra(); 41 PiirraYmpyra(); 42 PiirraYmpyra(); 43 PiirraYmpyra(); 44 PiirraYmpyra(); 45 PiirraYmpyra(); 46 PiirraYmpyra(); 47 PiirraYmpyra(); 48 PiirraYmpyra(); 49 PiirraYmpyra(); 50 PiirraYmpyra(); 51 52 lisaaPelaajat(); 53 54 Level.CreateBorders(1.0, false); 55 Level.BackgroundColor = Color.Orange; 56 57 21 LisaaNappaimet(); 58 22 } 59 23 60 24 void PiirraYmpyra() 61 25 { 62 PhysicsObject pallo = new PhysicsObject( 10.0,10.0, Shapes.Triangle);26 PhysicsObject pallo = new PhysicsObject(20.0,20.0, Shapes.Circle); 63 27 pallo.X = RandomGen.NextInt( -300,300 ); 64 28 pallo.Y = RandomGen.NextInt(-300, 300); … … 68 32 Vector impulssi = new Vector(900.0, 0.0); 69 33 pallo.Hit(impulssi); 70 pallo.Restitution = 1.0;34 pallo.Restitution = 0.5; 71 35 72 36 } … … 79 43 uhri.Y =y; 80 44 Add(uhri); 81 82 83 }84 void lisaaPelaajat()85 {86 pelaaja1 = new PlatformCharacter(40, 60);87 pelaaja1.Mass = 1.0;88 pelaaja1.Image = LoadImage("Bulla");89 pelaaja1.X = 0;90 pelaaja1.Y = Level.Bottom + 120;91 92 93 94 Add(pelaaja1);95 45 } 96 46 47 void LisaaNappaimet() 48 { 49 Keyboard.Listen(Key.Left, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(-1000,0)); 50 Keyboard.Listen(Key.Right, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(1000, 0)); 51 Keyboard.Listen(Key.Down, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(0, -1000)); 52 Keyboard.Listen(Key.Up, ButtonState.Pressed, VaihdaPainovoimaa, null, new Vector(0, 1000)); 53 } 97 54 98 99 100 101 102 103 104 55 void VaihdaPainovoimaa(Vector suunta) 56 { 57 Gravity = suunta; 58 } 105 59 106 60
Note: See TracChangeset
for help on using the changeset viewer.