Changeset 1398 for 2010/30/jojumuho/sYstEmErroR/Peli.cs
- Timestamp:
- 2010-07-29 11:31:35 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/30/jojumuho/sYstEmErroR/Peli.cs
r1380 r1398 13 13 double nopeus = 600; 14 14 double hyppyVoima = 10000; 15 Image pelaajanKuva = LoadImage("hahmo 2"); 16 17 15 18 16 19 17 20 protected override void Begin() 18 { 21 { 19 22 LuoPelaaja(); 20 23 LuoKentta(); … … 39 42 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 40 43 41 44 42 45 43 46 … … 55 58 PhysicsObject LuoPelaaja() 56 59 { 57 pelaaja1 = new PlatformCharacter( 80, 80);60 pelaaja1 = new PlatformCharacter(150, 150); 58 61 pelaaja1.Shape = Shapes.Rectangle; 59 62 pelaaja1.Mass = 4.0; 60 63 Add(pelaaja1); 61 64 pelaaja1.X = -200; 62 pelaaja1.Y = - 400;65 pelaaja1.Y = -800; 63 66 pelaaja1.Color = Color.Lime; 64 67 pelaaja1.CanRotate = false; 68 65 69 PlasmaCannon plasmaTykki = new PlasmaCannon(180, 100); 66 70 pelaaja1.Weapon = plasmaTykki; 67 71 plasmaTykki.PlasmaParticleCollision = PlasmaPalloOsuu; 72 plasmaTykki.TimeBetweenUse = new TimeSpan(300); 73 74 75 LaserGun laserPyssy = new LaserGun(190, 80); 76 pelaaja1.Weapon = laserPyssy; 77 laserPyssy.LaserCollision = LaserSadeOsuu; 78 laserPyssy.TimeBetweenUse = new TimeSpan(100); 79 68 80 pelaaja1.Restitution = 0.1; 81 pelaaja1.Image = pelaajanKuva; 82 83 Image pelaajaOikealle = pelaajanKuva; 84 Image pelaajaVasemmalle = Image.Mirror(pelaajaOikealle); 85 86 87 pelaaja1.LeftIdleAnimation = new Animation(pelaajaVasemmalle); 88 pelaaja1.RightIdleAnimation = new Animation(pelaajaOikealle); 89 90 pelaaja1.LeftWalkingAnimation = new Animation(pelaajaVasemmalle); 91 pelaaja1.RightWalkingAnimation = new Animation(pelaajaOikealle); 92 69 93 70 94 return pelaaja1; … … 79 103 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 80 104 81 Keyboard.Listen(Key.K, ButtonState.Pressed, tahtain, "tähtäys alas", pelaaja1); 82 Keyboard.Listen(Key.L, ButtonState.Pressed, Ammu, "ampu tulee", pelaaja1); 105 Keyboard.Listen(Key.J, ButtonState.Pressed, tahtain, "tähtäys alas", pelaaja1); 106 Keyboard.Listen(Key.L, ButtonState.Pressed, tahtain, "tähtäys ylös", pelaaja1); 107 Keyboard.Listen(Key.K, ButtonState.Down, Ammu, "ampu tulee", pelaaja1); 108 Keyboard.Listen(Key.U, ButtonState.Pressed, vaihto, "aseen vaihto", pelaaja1); 109 Keyboard.Listen(Key.O, ButtonState.Pressed, vaihto, "aseen vaihto", pelaaja1); 110 83 111 } 84 112 … … 97 125 } 98 126 127 void vaihto(PlatformCharacter pelaaja) 128 { 129 130 } 131 132 133 134 99 135 void Ammu(PlatformCharacter pelaaja) 100 136 { … … 103 139 { 104 140 ammus.Tag = pelaaja; 105 ammus.Size = new Vector(30, 30); 141 ammus.Size = new Vector(30, 30); 142 //ammus.MaximumLifetime = new TimeSpan(20000); 106 143 } 144 145 107 146 108 147 } … … 111 150 { 112 151 if (ammus.Tag != kohde && kohde.Tag.ToString() != "palikka") 113 { 152 114 153 kohde.Destroy(); 115 }116 154 } 117 155 118 119 120 121 122 156 void LaserSadeOsuu(PhysicsObject ammus, PhysicsObject kohde) 157 { 158 if (ammus.Tag != kohde && kohde.Tag.ToString() != "palikka") 159 160 kohde.Destroy(); 161 } 162 123 163 }
Note: See TracChangeset
for help on using the changeset viewer.