Changeset 5999 for 2015/24/LeeviK
- Timestamp:
- 2015-06-10 13:53:17 (8 years ago)
- Location:
- 2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience.csproj.Debug.cachefile
r5981 r5999 8 8 Content\maaBLYAT.xnb 9 9 Content\CheekiBreeki.xnb 10 Content\LUUTA.xnb 10 11 Content\UzickoKolo.wma -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/AS_Bandit_Experience.cs
r5981 r5999 12 12 GameObject banditKadet; 13 13 Ase banditAse; 14 Vector aseenOsumaKohde; 15 bool piirraTracer = false; 14 16 bool ladataankoAsetta = false; 15 17 PhysicsObject Vodka; … … 45 47 46 48 banditAse = new Ase(HAHMOJEN_LEVEYS, HAHMOJEN_KORKEUS, 30, int.MaxValue, 3.0); //koko, lipaskoko, reserviluodit, latausnopeus 49 banditAse.Damage = 26; 50 banditAse.Spread = Angle.FromDegrees(5); 47 51 banditAse.FireRate = 11.6; //metriä sekunnissa 48 52 banditAse.Power.Value = 720; //ensimmäisen luodin lähtönopeus 49 53 banditAse.Power.DefaultValue = 720; //muiden luotien lähtönopeus 54 banditAse.MaxRange = 150 * HAHMOJEN_LEVEYS; 50 55 //SoundEffect AKSaani = LoadSoundEffect("CheekiBreeki"); 51 56 //banditAse.AttackSound = AKSaani; //väliaikainen … … 66 71 AddCollisionHandler(bandit, Vodka, ViinaRalli); 67 72 //Camera.Follow(bandit); 73 74 Timer ajastin = new Timer(); 75 ajastin.Interval = 4.0; 76 ajastin.Timeout += SpawnLoner; 77 ajastin.Start(); 68 78 69 79 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); … … 87 97 } 88 98 99 protected override void Paint(Canvas canvas) 100 { 101 if (piirraTracer) 102 { 103 canvas.BrushColor = Color.Orange; 104 canvas.DrawLine(banditAse.AbsolutePosition + Vector.FromLengthAndAngle(55, banditAse.AbsoluteAngle), aseenOsumaKohde); 105 piirraTracer = false; 106 } 107 base.Paint(canvas); 108 } 109 89 110 void LiikutaBandit(Vector vektori, PhysicsObject bandit) 90 111 { … … 94 115 } 95 116 96 void AmmuAseella(As saultRifle ase)117 void AmmuAseella(Ase ase) 97 118 { 98 119 if (ladataankoAsetta) return; 99 120 100 121 PhysicsObject ammus = ase.Shoot(); 101 102 if (ammus != null) 103 { 104 ammus.Size *= 10.2; 122 if (ammus == null) return; 123 ammus.Destroy(); 124 125 //if (ammus != null) 126 //{ 127 // ammus.Size = new Vector(3.5, 1); 128 // AddCollisionHandler(ammus, AmmusOsuu); 129 //} 130 131 Angle tamankertainenHajoama = RandomGen.NextAngle(-ase.Spread, ase.Spread); 132 133 PhysicsObject osumanKohde = ShootHitscan(ase, bandit, tamankertainenHajoama); 134 if (osumanKohde != null) 135 { 136 AmmusOsuu(osumanKohde); 137 aseenOsumaKohde = osumanKohde.AbsolutePosition; 138 piirraTracer = true; 139 } 140 else 141 { 142 aseenOsumaKohde = ase.Position + Vector.FromLengthAndAngle(ase.MaxRange, ase.AbsoluteAngle + tamankertainenHajoama); 143 piirraTracer = true; 144 } 145 } 146 147 /// <summary> 148 /// Ammutaan aseen suuntaan raycast aseen kantaman päähän. 149 /// Palauttaa asetta lähimmän PhysicsObjektin, johon säde osuu. 150 /// </summary> 151 /// <param name="a"></param> 152 /// <returns></returns> 153 PhysicsObject ShootHitscan(Ase a, GameObject owner, Angle poikkeama) 154 { 155 Vector farTarget = Vector.FromLengthAndAngle(a.MaxRange, a.AbsoluteAngle + poikkeama); 156 157 List<GameObject> potTargets = GetObjects(x => x is PhysicsObject && x != owner); 158 159 double closestDistance = double.MaxValue; 160 int closestIndex = -1; 161 162 for (int i = 0; i < potTargets.Count; i++) 163 { 164 if (potTargets[i].IsBlocking(a.AbsolutePosition, farTarget)) 165 { 166 double currentDistance = Vector.Distance(a.AbsolutePosition, potTargets[i].Position); 167 168 if (currentDistance < closestDistance) 169 { 170 closestDistance = currentDistance; 171 closestIndex = i; 172 } 173 } 174 } 175 176 if (closestIndex != -1) 177 return (PhysicsObject)potTargets[closestIndex]; 178 return null; 179 } 180 181 void AmmusOsuu(PhysicsObject kohde) 182 { 183 Loner k = kohde as Loner; 184 if (k != null) 185 { 186 k.Damagea(banditAse.Damage); 105 187 } 106 188 } … … 133 215 Add(loner); 134 216 return loner; 217 135 218 } 136 219 void LuoVodka() … … 150 233 banditAse.Destroy(); 151 234 banditKadet.Destroy(); 235 LuoMrDeath(); 152 236 153 237 … … 155 239 } 156 240 241 void LuoMrDeath() 242 { 243 ClearAll(); 244 GameObject DEATH = new GameObject(LoadImage("death")); 245 Add(DEATH); 246 Level.Background.Color = Color.Black; 247 Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { 248 ClearAll(); 249 Begin(); 250 }, null); 251 } 252 253 void SpawnLoner() 254 { 255 //ANUS BREAKS 4 DAMAGE 256 } 157 257 } -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/Ase.cs
r5982 r5999 14 14 15 15 public double ReloadTime { get; set; } 16 17 public double Damage { get; set; } 18 19 public double MaxRange { get; set; } 20 21 public Angle Spread { get; set; } 16 22 17 23 public Ase(double width, double height, int magazineSize, int maxAmmoInReserve, double reloadTime) -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/Loner.cs
r5982 r5999 7 7 public class Loner : PhysicsObject 8 8 { 9 DoubleMeter Health { get;set; }9 public DoubleMeter Health { get; private set; } 10 10 11 11 //FollowerBrain AttackBrain { get; set; } … … 17 17 this.Health.LowerLimit += Kuoli; 18 18 this.Health.LowerLimit += this.Destroy; 19 this.Mass = 100; 19 20 20 21 //this.AttackBrain = new FollowerBrain(target); 21 22 //this.Brain = AttackBrain; 23 } 24 25 public void Damagea(double amount) 26 { 27 this.Health.Value -= amount; 22 28 } 23 29 -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/obj/x86/Debug/AS Bandit Experience.csproj.FileListAbsolute.txt
r5981 r5999 17 17 C:\MyTemp\LeeviK\AS Bandit Experience\AS Bandit Experience\AS Bandit Experience\bin\x86\Debug\Content\maaBLYAT.xnb 18 18 C:\MyTemp\LeeviK\AS Bandit Experience\AS Bandit Experience\AS Bandit Experience\bin\x86\Debug\Content\CheekiBreeki.xnb 19 C:\MyTemp\LeeviK\AS Bandit Experience\AS Bandit Experience\AS Bandit Experience\bin\x86\Debug\Content\LUUTA.xnb -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/obj/x86/Debug/ContentPipeline-{CF2287A8-9A13-468B-8E64-AE02CEDFA772}.xml
r5981 r5999 84 84 <Time>2015-06-10T11:17:45.3125965+03:00</Time> 85 85 </Item> 86 <Item> 87 <Source>LUUTA.png</Source> 88 <Name>LUUTA</Name> 89 <Importer>TextureImporter</Importer> 90 <Processor>TextureProcessor</Processor> 91 <Options>None</Options> 92 <Output>C:\MyTemp\LeeviK\AS Bandit Experience\AS Bandit Experience\AS Bandit Experience\bin\x86\Debug\Content\LUUTA.xnb</Output> 93 <Time>2015-06-10T12:20:02.4763653+03:00</Time> 94 </Item> 86 95 <BuildSuccessful>true</BuildSuccessful> 87 96 <Settings> -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit Experience/obj/x86/Debug/cachefile-{CF2287A8-9A13-468B-8E64-AE02CEDFA772}-targetpath.txt
r5981 r5999 9 9 Content\maaBLYAT.xnb 10 10 Content\CheekiBreeki.xnb 11 Content\LUUTA.xnb -
2015/24/LeeviK/AS Bandit Experience/AS Bandit Experience/AS Bandit ExperienceContent/AS Bandit ExperienceContent.contentproj
r5981 r5999 106 106 </Compile> 107 107 </ItemGroup> 108 <ItemGroup> 109 <Compile Include="LUUTA.png"> 110 <Name>LUUTA</Name> 111 <Importer>TextureImporter</Importer> 112 <Processor>TextureProcessor</Processor> 113 </Compile> 114 </ItemGroup> 108 115 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 109 116 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.