Changeset 2792
- Timestamp:
- 2012-06-05 11:32:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/YAG2DSS.cs
r2788 r2792 15 15 GameObject Kursori; 16 16 17 List<PhysicsObject> Pelaaja = new List<PhysicsObject>(); 18 17 19 public override void Begin() 18 20 { … … 25 27 Add(Kursori); 26 28 #endregion 27 29 LuoKentta(); 30 AsetaNappaimet(); 28 31 //PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 29 32 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ShowExit, "Lopeta peli"); 30 33 } 31 34 35 void LuoKentta() 36 { 37 PhysicsObject vasenReuna = Level.CreateLeftBorder(); 38 //vasenReuna.IsVisible = false; 39 PhysicsObject oikeaReuna = Level.CreateRightBorder(); 40 //oikeaReuna.IsVisible = false; 41 PhysicsObject ylaReuna = Level.CreateTopBorder(); 42 //ylaReuna.IsVisible = false; 43 PhysicsObject alaReuna = Level.CreateBottomBorder(); 44 //alaReuna.IsVisible = false; 45 46 Level.BackgroundColor = Color.Black; 47 48 LuoPelaaja(300); 49 LuoPelaaja(-300); 50 } 51 52 void LuoPelaaja(double x) 53 { 54 PhysicsObject pelaaja = new PhysicsObject(20, 20); 55 56 pelaaja.X = x; 57 pelaaja.Y = -250; 58 pelaaja.Restitution = 0.5; 59 pelaaja.AngularDamping = 0.1; 60 pelaaja.Shape = Shape.Triangle; 61 62 Pelaaja.Add(pelaaja); 63 Add(Pelaaja[Pelaaja.Count - 1]); 64 } 65 66 void AsetaNappaimet() 67 { 68 Keyboard.Listen(Key.Up, ButtonState.Down, Kiihdyta, null, Pelaaja[0]); 69 Keyboard.Listen(Key.Down, ButtonState.Down, Hidasta, null, Pelaaja[0]); 70 } 71 72 void Kiihdyta(PhysicsObject pelaaja) 73 { 74 Vector z = Vector.FromLengthAndAngle(5.0, pelaaja.Angle); 75 pelaaja.Hit(z); 76 } 77 78 void Hidasta(PhysicsObject pelaaja) 79 { 80 if (pelaaja.Velocity.X > 0.0) 81 pelaaja.Velocity = new Vector(pelaaja.Velocity.X - 5.0, pelaaja.Velocity.Y); 82 83 if (pelaaja.Velocity.Y > 0.0) 84 pelaaja.Velocity = new Vector(pelaaja.Velocity.X, pelaaja.Velocity.Y - 5.0); 85 86 if (pelaaja.Velocity.X < 0.0) 87 pelaaja.Velocity = new Vector(0.0, pelaaja.Velocity.Y); 88 89 if (pelaaja.Velocity.Y < 0.0) 90 pelaaja.Velocity = new Vector(pelaaja.Velocity.X, 0.0); 91 } 32 92 #region XNA / ALTK-Based Code 33 93 … … 67 127 //ALTK.Cursor.PosX = Convert.ToInt32((ALTKConstants.WindowWidth / 2) + Kursori.Position.X); 68 128 //ALTK.Cursor.PosY = ALTK.Cursor 69 129 70 130 //MessageDisplay.Clear(); 71 131 //MessageDisplay.Add(Convert.ToString(ALTK.Cursor.SecPosX + "; " + ALTK.Cursor.SecPosY));
Note: See TracChangeset
for help on using the changeset viewer.