- Timestamp:
- 2015-06-25 11:29:24 (8 years ago)
- Location:
- 2014/30/MitjaK/Attack to Agora/Attack to Agora
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora.sln
r6139 r6334 4 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Attack to Agora", "Attack to Agora\Attack to Agora\Attack to Agora.csproj", "{DDF55303-D454-45BC-81E0-ED7879E29D5C}" 5 5 EndProject 6 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "Attack to AgoraContent", "Attack to Agora\Attack to AgoraContent\Attack to AgoraContent.contentproj", "{2930AD0E-5824-4386-8008-3C0C45D1DA86}" 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Attack to AgoraContent", "Attack to Agora\Attack to AgoraContent\Attack to AgoraContent.contentproj", "{2930AD0E-5824-4386-8008-3C0C45D1DA86}" 7 EndProject 8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jypeli", "Muokattu Jypeli\Jypeli.csproj", "{74DD1DDD-283D-45D7-A79D-3DCB120708A6}" 7 9 EndProject 8 10 Global 9 11 GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 12 Debug|x86 = Debug|x86 13 DebugVisualize|x86 = DebugVisualize|x86 11 14 Release|x86 = Release|x86 12 15 EndGlobalSection … … 14 17 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.Debug|x86.ActiveCfg = Debug|x86 15 18 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.Debug|x86.Build.0 = Debug|x86 19 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.DebugVisualize|x86.ActiveCfg = Debug|x86 20 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.DebugVisualize|x86.Build.0 = Debug|x86 16 21 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.Release|x86.ActiveCfg = Release|x86 17 22 {DDF55303-D454-45BC-81E0-ED7879E29D5C}.Release|x86.Build.0 = Release|x86 18 23 {2930AD0E-5824-4386-8008-3C0C45D1DA86}.Debug|x86.ActiveCfg = Debug|x86 24 {2930AD0E-5824-4386-8008-3C0C45D1DA86}.DebugVisualize|x86.ActiveCfg = Debug|x86 19 25 {2930AD0E-5824-4386-8008-3C0C45D1DA86}.Release|x86.ActiveCfg = Release|x86 26 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.ActiveCfg = Debug|x86 27 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.Build.0 = Debug|x86 28 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.ActiveCfg = DebugVisualize|x86 29 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.Build.0 = DebugVisualize|x86 30 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.ActiveCfg = Release|x86 31 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.Build.0 = Release|x86 20 32 EndGlobalSection 21 33 GlobalSection(SolutionProperties) = preSolution -
2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora.csproj
r6313 r6334 62 62 </PropertyGroup> 63 63 <ItemGroup> 64 <Reference Include="Jypeli">65 </Reference>66 64 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> 67 65 <Private>False</Private> … … 118 116 <Compile Include="Attack_to_Agora.cs" /> 119 117 <Compile Include="Properties\AssemblyInfo.cs" /> 118 <Compile Include="Elava.cs" /> 120 119 </ItemGroup> 121 120 <ItemGroup> … … 151 150 </ItemGroup> 152 151 <ItemGroup> 152 <ProjectReference Include="..\..\Muokattu Jypeli\Jypeli.csproj"> 153 <Project>{74DD1DDD-283D-45D7-A79D-3DCB120708A6}</Project> 154 <Name>Jypeli</Name> 155 </ProjectReference> 153 156 <ProjectReference Include="..\Attack to AgoraContent\Attack to AgoraContent.contentproj"> 154 157 <Project>{2930AD0E-5824-4386-8008-3C0C45D1DA86}</Project> -
2014/30/MitjaK/Attack to Agora/Attack to Agora/Attack to Agora/Attack to Agora/Attack_to_Agora.cs
r6333 r6334 24 24 Image cCaseF = LoadImage("caseavausruutu"); 25 25 26 PlatformCharacter taistelija; 26 Elava taistelija; 27 AssaultRifle taistelijanAse; 28 const double ASEEN_DMG = 25.0; 29 const double WEAPON_INACCURACY = 20.0; 30 bool walkBackwards = false; 27 31 28 32 int kenttaNro = 1; … … 40 44 taustamusiikki_1.Play(); 41 45 } 46 47 protected override void Update(Time time) 48 { 49 if (!walkBackwards) 50 { 51 if (taistelija.Velocity.X < 0) 52 taistelijanAse.Angle = Angle.FromDegrees(180.0); 53 if (taistelija.Velocity.X > 0) 54 taistelijanAse.Angle = Angle.FromDegrees(0.0); 55 } 56 base.Update(time); 57 } 58 59 /// <summary> 60 /// Pimennetään ruutua pikku hiljaa. 61 /// Oletusnopeus 0.01. 62 /// </summary> 63 public void PimennaRuutua(double nopeus) 64 { 65 Timer ajastin = new Timer(); 66 ajastin.Interval = 0.1; 67 ajastin.Timeout += delegate 68 { 69 Level.AmbientLight -= nopeus; 70 if (Level.AmbientLight <= 0.0) 71 { 72 ajastin.Stop(); 73 ajastin.Reset(); 74 } 75 }; 76 ajastin.Start(); 77 } 78 /// <summary> 79 /// Kirkastetaan ruutua pikku hiljaa. 80 /// </summary> 81 public void KirkastaRuutua(double nopeus, double tavoite) 82 { 83 Timer ajastin = new Timer(); 84 ajastin.Interval = 0.1; 85 ajastin.Timeout += delegate 86 { 87 //if (Level.AmbientLight > 0.1) return; 88 Level.AmbientLight += nopeus; 89 if (Level.AmbientLight > tavoite) 90 { 91 ajastin.Stop(); 92 ajastin.Reset(); 93 } 94 }; 95 ajastin.Start(); 96 } 97 98 /// <summary> 99 /// Piirretään valojuovia. 100 /// </summary> 101 /// <param name="position">Valojuovan tämänhetkinen sijainti.</param> 102 /// <param name="color">Valojuovan väri.</param> 103 /// <param name="lifetimeInSeconds">Kauanko valojuova pysyy kentällä.</param> 104 void DrawTracers(Vector position, Color color, double lifetimeInSeconds, double brightnessFactor) 105 { 106 color.AlphaComponent = (byte)(32 * brightnessFactor); // 64 toimii 107 GameObject tracer = new GameObject(2, 2); 108 tracer.Shape = Shape.Circle; 109 tracer.Color = color; 110 tracer.Position = position; 111 tracer.MaximumLifetime = TimeSpan.FromSeconds(lifetimeInSeconds); 112 Add(tracer); 113 } 114 /// <summary> 115 /// Piirretään valojuovia. 116 /// </summary> 117 /// <param name="tracingObject">Olio, josta valojuovat tulevat.</param> 118 /// <param name="color">Valojuovan väri.</param> 119 /// <param name="lifetimeInSeconds">Kauanko valojuova pysyy kentällä.</param> 120 /// <param name="brightnessFactor">Valojuovan kirkkaus.</param> 121 void DrawTracers(PhysicsObject tracingObject, Color color, double lifetimeInSeconds, double brightnessFactor) 122 { 123 color.AlphaComponent = (byte)(32 * brightnessFactor); // 64 toimii 124 GameObject tracer = new GameObject(90, 2); 125 tracer.Shape = Shape.Circle; 126 tracer.Color = color; 127 tracer.Position = tracingObject.Position; 128 tracer.Angle = tracingObject.Angle; 129 tracer.MaximumLifetime = TimeSpan.FromSeconds(lifetimeInSeconds); 130 Add(tracer); 131 } 132 42 133 43 134 void Liikuta(PlatformCharacter pelaaja, double suunta) … … 67 158 { 68 159 SmoothTextures = false; 69 IsFullScreen = true;160 // IsFullScreen = true; 70 161 Gravity = new Vector(0, -2500); 71 162 // Synkataan taustakuvan ja colortilemapin pikselit … … 96 187 vasenreuna.X -= 75; 97 188 vasenreuna.Tag = "vasenreuna"; 98 //PhysicsObject oikeareuna = Level.CreateRightBorder(); 99 //oikeareuna.X += 75; 100 //oikeareuna.Tag = "oikeareuna"; 189 PhysicsObject oikeareuna = Level.CreateRightBorder(); 190 oikeareuna.Tag = "oikeareuna"; 101 191 102 192 Varjo(); … … 106 196 { 107 197 108 taistelija = new PlatformCharacter(75, 75);198 taistelija = new Elava(75, 75, 100.0); 109 199 taistelija.Shape = Shape.Rectangle; 110 200 taistelija.Animation = new Animation(chuckinkavely); … … 118 208 Camera.Follow(taistelija); 119 209 Camera.StayInLevel = true; 210 211 taistelijanAse = new AssaultRifle(20, 10); 212 taistelijanAse.FireRate = 20; 213 taistelijanAse.InfiniteAmmo = true; 214 taistelijanAse.Power.Value = 750; 215 taistelijanAse.Power.DefaultValue = 750; 216 taistelija.Add(taistelijanAse); 120 217 } 121 218 … … 263 360 Keyboard.Listen(Key.Space, ButtonState.Pressed, LiikutaYlos, null, taistelija); 264 361 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 362 Keyboard.Listen(Key.Enter, ButtonState.Down, Ammu, null); 363 Keyboard.Listen(Key.LeftShift, ButtonState.Pressed, delegate { walkBackwards = true; }, null); 364 Keyboard.Listen(Key.LeftShift, ButtonState.Released, delegate { walkBackwards = false; }, null); 265 365 266 366 #if DEBUG … … 269 369 } 270 370 371 void Ammu() 372 { 373 if (taistelijanAse == null) 374 return; 375 376 PhysicsObject ammus = taistelijanAse.Shoot(); 377 378 if (ammus == null) 379 return; 380 ammus.Size *= 0.2; 381 382 ammus.Hit(new Vector(0.0, RandomGen.NextDouble(-WEAPON_INACCURACY, WEAPON_INACCURACY))); 383 ammus.IsUpdated = true; 384 ammus.NeedsUpdateCall = true; 385 ammus.CanRotate = false; 386 ammus.Updated += delegate(PhysicsObject a) 387 { 388 DrawTracers(a, Color.Yellow, 0.2, 2.0); 389 }; 390 391 AddCollisionHandler(ammus, "vihollinen", AmmusOsuuViholliseen); 392 ammus.Collided += delegate { ammus.Destroy(); }; 393 } 394 395 void AmmusOsuuViholliseen(PhysicsObject ammus, PhysicsObject kohde) 396 { 397 Elava vihu = kohde as Elava; 398 399 if (vihu == null) return; 400 401 vihu.Damagea(ASEEN_DMG); 402 } 403 271 404 void VoititPelin() 272 405 {
Note: See TracChangeset
for help on using the changeset viewer.