- Timestamp:
- 2012-06-14 15:15:36 (11 years ago)
- Location:
- 2012/24/ToniV
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/ToniV/Try to survive/Try to survive/Try to survive/Try to survive.csproj
r2998 r3041 62 62 </PropertyGroup> 63 63 <ItemGroup> 64 <Reference Include="Jypeli4"> 64 <Reference Include="Jypeli"> 65 <HintPath>..\..\..\Jypeli.dll</HintPath> 65 66 </Reference> 66 67 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> -
2012/24/ToniV/Try to survive/Try to survive/Try to survive/Try_to_survive.cs
r2998 r3041 7 7 using Jypeli.Widgets; 8 8 9 class Zombi : PhysicsObject 10 { 11 public int Elamat = 2; 12 13 public Zombi(double leveys, double korkeus) 14 : base(leveys, korkeus) 15 { 16 } 17 } 18 19 9 20 public class Try_to_survive : PhysicsGame 10 21 { … … 12 23 Image Zombikuva = LoadImage("Zombi"); 13 24 14 PhysicsObject ukko; 25 public PhysicsObject ukko; 26 int healt = 5; 15 27 16 Vector[] pisteet = { new Vector(600, 470), new Vector(600, -470), new Vector(-600, 470), new Vector(-600, -470) }; 28 bool saakoampua = true; 29 30 Vector[] pisteet = { new Vector(600, 470), new Vector(600, -470), new Vector(0, 470), new Vector(-600,-450) }; 31 Vector suunta = Vector.Zero; 17 32 18 33 public override void Begin() 19 34 { 20 35 ukko = new PhysicsObject(40.0, 40.0); 21 22 36 ukko.Image = ukkokuva; 37 ukko.Mass = 1; 23 38 Add(ukko); 24 39 25 40 luoajastin(); 26 41 luoohjain(); 27 rajahda(); 42 43 luoseina(400, 190, 24, 400); 44 luoseina(400, -280, 24, 250); 45 luoseina(-400, -10, 200, 700); 46 luoseina(-100, -0, 40, 700); 47 luoseina(220, 2, 350, 24); 48 luoseina(215, -167, 350, 24); 28 49 29 50 51 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 52 ControllerOne.Listen(Button.Start, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 30 53 54 Level.Width = 1250; 55 Level.Height = 1000; 56 PhysicsObject alareuna = Level.CreateBottomBorder(); 57 PhysicsObject yläreuna = Level.CreateTopBorder(); 58 PhysicsObject vasenreuna = Level.CreateLeftBorder(); 59 PhysicsObject oikeareuna = Level.CreateRightBorder(); 31 60 32 PhysicsObject seinä = new PhysicsObject(24, 400); 33 seinä.Color = Color.Black; 34 seinä.X = (400); 35 seinä.Y = (190); 36 Add(seinä); 61 alareuna.Tag = "reuna"; 62 yläreuna.Tag = "reuna"; 63 vasenreuna.Tag = "reuna"; 64 oikeareuna.Tag = "reuna"; 65 66 } 37 67 38 39 PhysicsObject seinä2 = new PhysicsObject(24, 250); 40 seinä2.Color = Color.Black; 41 seinä2.X = (400); 42 seinä2.Y = (-280); 43 Add(seinä2); 44 45 PhysicsObject seinä3 = new PhysicsObject(200, 700); 46 seinä3.Color = Color.Black; 47 seinä3.X = (-400); 48 seinä3.Y = (-10); 49 Add(seinä3); 50 51 PhysicsObject seinä4 = new PhysicsObject(40, 700); 52 seinä4.Color = Color.Black; 53 seinä4.X = (-100); 54 seinä4.Y = (-0); 55 Add(seinä4); 56 57 58 PhysicsObject seinä5 = new PhysicsObject(350, 24); 59 seinä5.Color = Color.Black; 60 seinä5.X = (220); 61 seinä5.Y = (2); 62 Add(seinä5); 63 64 PhysicsObject seinä6 = new PhysicsObject(350, 24); 65 seinä6.Color = Color.Black; 66 seinä6.X = (215); 67 seinä6.Y = (-167); 68 Add(seinä6); 69 70 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 71 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 68 void luoZombi() 69 { 70 FollowerBrain seuraajanaivot = new FollowerBrain(ukko); 71 Zombi Zombi2 = new Zombi(40, 40); 72 Zombi2.Position = pisteet[RandomGen.NextInt(0, 4)]; 73 Zombi2.Image = Zombikuva; 74 Zombi2.Brain = seuraajanaivot; 75 Zombi2.Tag = "Zombi"; 76 seuraajanaivot.Speed = 100; 77 seuraajanaivot.TargetFollowDistance = 60000; 78 seuraajanaivot.FollowAlways = true; 79 seuraajanaivot.TargetCloseDistance = 0; 80 Add(Zombi2); 81 AddCollisionHandler(Zombi2, ukko, pelaajaanosui); 72 82 73 83 … … 75 85 } 76 86 77 78 void luoZombi() 87 void luoseina(double X, double Y, double leveys, double korkeus) 79 88 { 80 FollowerBrain seuraajanaivot = new FollowerBrain(); 81 PhysicsObject Zombi = new PhysicsObject(40, 40); 82 Zombi.Position = pisteet[RandomGen.NextInt(0, 4)]; 83 Zombi.Image = Zombikuva; 84 Zombi.Brain = seuraajanaivot; 85 seuraajanaivot.Speed = 300; 86 seuraajanaivot.TargetFollowDistance = 600000; 87 seuraajanaivot.FollowAlways = true; 88 seuraajanaivot.TargetCloseDistance = 0; 89 90 Add(Zombi); 91 89 PhysicsObject seinä = PhysicsObject.CreateStaticObject(leveys, korkeus); 90 seinä.Color = Color.Black; 91 seinä.X = (X); 92 seinä.Y = (Y); 93 seinä.Tag = "seina"; 94 Add(seinä); 92 95 } 93 96 … … 96 99 97 100 Timer ajastin = new Timer(); 98 ajastin.Interval = 0. 7;101 ajastin.Interval = 0.1; 99 102 ajastin.Timeout += luoZombi; 100 ajastin.Start( );103 ajastin.Start(200); 101 104 102 105 … … 106 109 { 107 110 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, liikutapelaajaa, "liiku"); 111 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, tahtaa, "tähtää"); 112 ControllerOne.Listen(Button.RightTrigger, ButtonState.Down, ammu, "ammu"); 108 113 } 109 114 110 115 void liikutapelaajaa(AnalogState tikku) 111 116 { 112 ukko.Move(tikku.StateVector * 170); 117 ukko.Move(tikku.StateVector * 150); 118 } 119 120 void tahtaa(AnalogState tikku) 121 { 122 suunta = tikku.StateVector; 123 } 124 125 void ammu() 126 { 127 if (saakoampua == false) return; 128 PhysicsObject panos = new PhysicsObject(5, 5); 129 panos.Shape = Shape.Circle; 130 panos.Color = Color.Black; 131 panos.Hit(suunta * 1100); 132 panos.Position = ukko.Position; 133 AddCollisionHandler(panos, "Zombi", Zombikuoli); 134 AddCollisionHandler(panos, "seina", TuhoaAmmus); 135 AddCollisionHandler(panos, "reuna", TuhoaAmmus); 136 Add(panos); 137 138 saakoampua = false; 139 Timer.SingleShot(0.25, saaampua); 140 } 141 142 void saaampua() 143 { 144 saakoampua = true; 145 } 146 void TuhoaAmmus(PhysicsObject panos, PhysicsObject kohde) 147 { 148 panos.Destroy(); 149 } 150 151 void pelaajaanosui(PhysicsObject pelaaja, PhysicsObject zombi) 152 { 153 healt--; 154 if (healt == 0) 155 { 156 ukko.Destroy(); 157 rajahda(); 158 } 159 } 160 161 void Zombikuoli(PhysicsObject panos, PhysicsObject kohde) 162 { 163 panos.Destroy(); 164 Zombi Zombi2 = kohde as Zombi; 165 166 if (Zombi2 == null) return; 167 168 Zombi2.Elamat--; 169 if (Zombi2.Elamat == 0) 170 { 171 Zombi2.Destroy(); 172 173 } 113 174 } 114 175 115 176 void rajahda() 116 177 { 117 Explosion rajahdys = new Explosion( 40);178 Explosion rajahdys = new Explosion(50); 118 179 rajahdys.Position = ukko.Position; 119 rajahdys.Speed = 500.0;120 rajahdys.Force = 10000 ;180 rajahdys.Speed = 100.0; 181 rajahdys.Force = 1000000; 121 182 rajahdys.ShockwaveColor = Color.Red; 122 Add( rajahdys ); 123 183 Add(rajahdys); 124 184 } 125 185 186 void kierräeste() 187 { 188 189 } 126 190 } -
2012/24/ToniV/Try to survive/Try to survive/Try to survive/obj/x86/Debug/Try to survive.csproj.FileListAbsolute.txt
r2998 r3041 3 3 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Try to survive.exe 4 4 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Try to survive.pdb 5 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Jypeli4.dll6 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Jypeli4.xml7 5 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\obj\x86\Debug\Try to survive.exe 8 6 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\obj\x86\Debug\Try to survive.pdb 9 7 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Content\ukko.xnb 10 8 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Content\Zombi.xnb 9 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Jypeli.dll 10 C:\MyTemp\ToniV\Try to survive\Try to survive\Try to survive\bin\x86\Debug\Jypeli.xml
Note: See TracChangeset
for help on using the changeset viewer.