Changeset 8142 for 2016/30/JoonasL
- Timestamp:
- 2016-07-27 11:32:05 (6 years ago)
- Location:
- 2016/30/JoonasL/Arrow
- Files:
-
- 6 added
- 2 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/30/JoonasL/Arrow/Arrow/Arrow/Arrow.cs
r8122 r8142 9 9 public class Arrow : PhysicsGame 10 10 { 11 private PhysicsObject player, first, second, third, fourth; 12 private ExplosionSystem explosionSystem = new ExplosionSystem (LoadImage ("particle"), 1000); 13 private bool down = true, dead = false; 11 private PhysicsObject player; 12 13 private PhysicsObject[] percents = new PhysicsObject[4]; 14 15 private ExplosionSystem noteEffect = new ExplosionSystem(LoadImage("note"), 250); 16 private ExplosionSystem coinEffect = new ExplosionSystem(LoadImage("coin"), 250); 17 18 private double labelLeft; 19 20 private bool down = true, dead = true; 14 21 private float MOVEMENT_SPEED = 0, multiplier = 1000; 15 22 private List<Vector> points = new List<Vector>(); 16 23 private Image redPercent, greenPercent; 17 24 25 private float yearsLeft = 100; 26 private Label labelYearsLeft; 27 18 28 public override void Begin() 19 29 { 30 labelLeft = Screen.Left * 0.965; 31 MultiSelectWindow multiSelectWindow = new MultiSelectWindow("Arrow", "Alota peli", "Lopeta peli"); 32 multiSelectWindow.AddItemHandler(0, Start); 33 multiSelectWindow.AddItemHandler(1, Exit); 20 34 Window.Fullscreen = true; 35 SmoothTextures = false; 36 Add(multiSelectWindow); 37 SetListeners(); 38 } 39 40 private void Start () 41 { 42 dead = false; 21 43 redPercent = LoadImage("percent"); 22 44 greenPercent = LoadImage("percent_1"); 23 Level.Background.Color = Color.Black; 24 SetListeners(); 25 26 first = new PhysicsObject(100, 100); 27 28 first.Image = greenOrRed(); 29 first.Tag = "Percent"; 30 second = new PhysicsObject(100, 100); 31 second.Image = greenOrRed(); 32 second.Tag = "Percent"; 33 third = new PhysicsObject(100, 100); 34 third.Image = greenOrRed(); 35 third.Tag = "Percent"; 36 fourth = new PhysicsObject(100, 100); 37 fourth.Image = greenOrRed(); 38 fourth.Tag = "Percent"; 39 40 Add(first); 41 Add(second); 42 Add(third); 43 Add(fourth); 44 Add(explosionSystem); 45 46 RandomPercentPosition(first, 0); 47 RandomPercentPosition(second, 1); 48 RandomPercentPosition(third, 2); 49 RandomPercentPosition(fourth, 3); 45 Level.Background.Color = Color.White; 46 47 Add(noteEffect); 48 Add(coinEffect); 49 50 CreatePercent(0); 51 CreatePercent(1); 52 CreatePercent(2); 53 CreatePercent(3); 54 55 labelYearsLeft = new Label(yearsLeft + " years left"); 56 labelYearsLeft.X = -880; 57 labelYearsLeft.Y = 500; 58 Add(labelYearsLeft); 50 59 51 60 player = new PhysicsObject(50, 50, Shape.Triangle); 61 player.Color = Color.Black; 52 62 player.Angle = Angle.FromDegrees(225); 53 63 player.Restitution = 10; … … 112 122 113 123 if (!dead) 114 { 124 { 115 125 MOVEMENT_SPEED = multiplier * (float)time.SinceLastUpdate.TotalSeconds; 116 126 multiplier += (float) time.SinceLastUpdate.TotalMilliseconds / 60; … … 119 129 { 120 130 player.Y -= MOVEMENT_SPEED; 131 yearsLeft -= 0.1f; 121 132 } 122 133 else 123 134 { 124 135 player.Y += MOVEMENT_SPEED; 125 } 126 127 first.X -= MOVEMENT_SPEED; 128 second.X -= MOVEMENT_SPEED; 129 third.X -= MOVEMENT_SPEED; 130 fourth.X -= MOVEMENT_SPEED; 131 132 if (first.X < Level.Left * 2) { RandomPercentPosition(first, 0); } 133 134 if (second.X < Level.Left * 2) { RandomPercentPosition(second, 1); } 135 136 if (third.X < Level.Left * 2) { RandomPercentPosition(third, 2); } 137 138 if (fourth.X < Level.Left * 2) { RandomPercentPosition(fourth, 3); } 136 yearsLeft -= 0.01f; 137 } 138 139 labelYearsLeft.Text = (int) yearsLeft + " vuotta jäljellä enemmin maailman konkurssia"; 140 141 labelYearsLeft.Left = labelLeft; 142 143 for (int i = 0; i < 4; i++) 144 { 145 percents[i].X -= MOVEMENT_SPEED; 146 if (percents[i].X < Screen.Left * 1.2) { RandomPercentPosition(percents[i], i); } 147 } 139 148 140 149 for (int i = 0; i < points.Count; i++) { points[i] -= new Vector(MOVEMENT_SPEED, 0); } 141 142 143 150 } 144 151 } … … 181 188 } 182 189 183 private void Die (PhysicsObject a, PhysicsObject b) 184 { 185 player.Destroy(); 186 dead = true; 187 explosionSystem.AddEffect(player.Position, 1000); 190 private void Die (PhysicsObject a, PhysicsObject percent) 191 { 192 if (percent.Image.Equals(greenPercent)) 193 { 194 yearsLeft += 1; 195 } 196 else 197 { 198 player.Destroy(); 199 dead = true; 200 noteEffect.AddEffect(player.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 150); 201 coinEffect.AddEffect(player.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 150); 202 } 188 203 } 189 204 … … 205 220 down = true; 206 221 } 222 223 private PhysicsObject CreatePercent (int index) 224 { 225 PhysicsObject physicsObject = new PhysicsObject(100, 100); 226 physicsObject.Image = greenOrRed(); 227 physicsObject.Tag = "Percent"; 228 percents[index] = physicsObject; 229 RandomPercentPosition(physicsObject, index); 230 Add(physicsObject); 231 return physicsObject; 232 } 207 233 } -
2016/30/JoonasL/Arrow/Arrow/Arrow/Arrow.csproj.Debug.cachefile
r8122 r8142 1 Content\particle.xnb2 1 Content\percent.xnb 3 2 Content\percent_1.xnb 3 Content\ruutuja.xnb 4 Content\note.xnb 5 Content\coin.xnb -
2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/Arrow.csproj.FileListAbsolute.txt
r8122 r8142 7 7 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\obj\x86\Debug\Arrow.exe 8 8 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\obj\x86\Debug\Arrow.pdb 9 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle.xnb10 9 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent.xnb 11 10 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent_1.xnb 11 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\ruutuja.xnb 12 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\note.xnb 13 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\coin.xnb -
2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/ContentPipeline-{2DF1C49F-6BF7-4BA9-9FE6-D0E53C97361E}.xml
r8122 r8142 2 2 <XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 3 3 <Asset Type="Pipeline:BuildItemCollection"> 4 <Item>5 <Source>particle.png</Source>6 <Name>particle</Name>7 <Importer>TextureImporter</Importer>8 <Processor>TextureProcessor</Processor>9 <Options>None</Options>10 <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle.xnb</Output>11 <Time>2016-07-26T14:20:09.2824241+03:00</Time>12 </Item>13 4 <Item> 14 5 <Source>percent.png</Source> … … 28 19 <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent_1.xnb</Output> 29 20 <Time>2016-07-26T14:52:12.5064241+03:00</Time> 21 </Item> 22 <Item> 23 <Source>ruutuja.jpg</Source> 24 <Name>ruutuja</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\ruutuja.xnb</Output> 29 <Time>2016-07-27T10:13:12.2122876+03:00</Time> 30 </Item> 31 <Item> 32 <Source>note.jpg</Source> 33 <Name>note</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\note.xnb</Output> 38 <Time>2016-07-27T10:29:57.9114414+03:00</Time> 39 </Item> 40 <Item> 41 <Source>coin.png</Source> 42 <Name>coin</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\coin.xnb</Output> 47 <Time>2016-07-27T10:30:39.3061092+03:00</Time> 30 48 </Item> 31 49 <BuildSuccessful>true</BuildSuccessful> -
2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/cachefile-{2DF1C49F-6BF7-4BA9-9FE6-D0E53C97361E}-targetpath.txt
r8122 r8142 1 Content\particle.xnb2 1 Content\percent.xnb 3 2 Content\percent_1.xnb 3 Content\ruutuja.xnb 4 Content\note.xnb 5 Content\coin.xnb -
2016/30/JoonasL/Arrow/Arrow/ArrowContent/ArrowContent.contentproj
r8122 r8142 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="particle.png">49 <Name>particle</Name>50 <Importer>TextureImporter</Importer>51 <Processor>TextureProcessor</Processor>52 </Compile>53 </ItemGroup>54 <ItemGroup>55 48 <Compile Include="percent.png"> 56 49 <Name>percent</Name> … … 66 59 </Compile> 67 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="ruutuja.jpg"> 63 <Name>ruutuja</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="note.jpg"> 70 <Name>note</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="coin.png"> 77 <Name>coin</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 68 82 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 69 83 <!-- 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.