Changeset 1369 for 2010/30/jojumuho/sYstEmErroR/Peli.cs
- Timestamp:
- 2010-07-28 14:02:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/30/jojumuho/sYstEmErroR/Peli.cs
r1353 r1369 10 10 const int ruudunKorkeus = 60; 11 11 Image palikanKuva = LoadImage("Palikka"); 12 PhysicsObject pelaaja1; 12 PlatformCharacter pelaaja1; 13 double nopeus = 600; 14 double hyppyVoima = 8000; 13 15 14 16 … … 19 21 LuoPelaaja(); 20 22 23 Gravity = new Vector(0, -800); 21 24 25 LisaaNappaimet(); 22 26 23 27 Camera.ZoomToLevel(); … … 34 38 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 35 39 40 41 42 36 43 } 37 44 PhysicsObject LuoPalikka() … … 45 52 PhysicsObject LuoPelaaja() 46 53 { 47 pelaaja1 = new P hysicsObject(80, 40);48 pelaaja1.Shape = Shapes. Circle;49 pelaaja1.Mass = 15.0;54 pelaaja1 = new PlatformCharacter(80, 80); 55 pelaaja1.Shape = Shapes.Rectangle; 56 pelaaja1.Mass = 4.0; 50 57 Add(pelaaja1); 51 58 pelaaja1.Color = Color.Lime; … … 53 60 pelaaja1.Y = -100; 54 61 pelaaja1.CanRotate = false; 62 PlasmaCannon plasmaTykki = new PlasmaCannon(180, 100); 63 pelaaja1.Weapon = plasmaTykki; 64 plasmaTykki.PlasmaParticleCollision = PlasmaPalloOsuu; 65 55 66 56 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0));57 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0));58 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000));59 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000));60 67 return pelaaja1; 61 68 } 62 69 63 void Li ikutaPelaajaa(Vector vektori)70 void LisaaNappaimet() 64 71 { 65 pelaaja1.Push(vektori); 72 73 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä"); 74 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 75 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 76 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 77 78 Keyboard.Listen(Key.K, ButtonState.Pressed, tahtain, "tähtäys alas", pelaaja1); 79 Keyboard.Listen(Key.L, ButtonState.Pressed, Ammu, "ampu tulee", pelaaja1); 66 80 } 67 81 82 void liikuta(PlatformCharacter pelaaja, double nopeus) 83 { 84 pelaaja.Walk(nopeus); 85 } 68 86 87 void hyppaa(PlatformCharacter pelaaja, double voima) 88 { 89 pelaaja.Jump(voima); 90 } 91 void tahtain(PlatformCharacter pelaaja) 92 { 69 93 94 } 95 96 void Ammu(PlatformCharacter pelaaja) 97 { 98 pelaaja.Weapon.Shoot(); 99 100 101 } 102 103 void PlasmaPalloOsuu(PhysicsObject ammus, PhysicsObject kohde) 104 { 105 106 } 107 108 109 110 111 112 70 113 }
Note: See TracChangeset
for help on using the changeset viewer.