Changeset 8596
- Timestamp:
- 2017-06-13 14:49:30 (6 years ago)
- Location:
- 2017/24/SamuelN
- Files:
-
- 53 added
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/24/SamuelN/Bottleflip/Bottleflip/Bottleflip/Bottleflip.cs
r8533 r8596 9 9 public class Bottleflip : PhysicsGame 10 10 { 11 PhysicsObject pullo; 12 PhysicsObject alareuna; 13 PhysicsObject ylareuna; 14 int y; 15 11 16 public override void Begin() 12 17 { 13 AloitaPeli(); 18 19 MediaPlayer.Play("IttyBitty"); 20 IsFullScreen = true; 21 IsMouseVisible = true; 22 MultiSelectWindow alkuValikko = new MultiSelectWindow("Bottle Flip Sim 2.0", "Start", "Buy Bottles", "Exit"); 23 alkuValikko.Image = LoadImage("pullo"); 24 alkuValikko.IsVisible = false; 25 alkuValikko.AddItemHandler(0, AloitaPeli); 26 alkuValikko.AddItemHandler(1, OpenShop); 27 alkuValikko.AddItemHandler(2, Exit); 28 Add(alkuValikko); 29 30 } 31 void OpenShop() 32 { 33 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Exit"); 34 35 Widget ruutu1 = new Widget(120.0, 360.0); 36 ruutu1.X = Screen.LeftSafe + 200; 37 ruutu1.Y = Screen.TopSafe - 200; 38 ruutu1.Image = LoadImage("pullo"); 39 Add(ruutu1); 40 41 Widget ruutu2 = new Widget(120.0, 360.0); 42 ruutu2.X = Screen.LeftSafe + 450; 43 ruutu2.Y = Screen.TopSafe - 200; 44 ruutu2.Image = LoadImage("pullo2"); 45 Add(ruutu2); 46 47 Widget ruutu3 = new Widget(200.0, 300.0); 48 ruutu3.X = Screen.LeftSafe + 700; 49 ruutu3.Y = Screen.TopSafe - 200; 50 //ruutu3.Image = LoadImage("pullo3"); 51 Add(ruutu3); 14 52 } 15 53 void AloitaPeli() 16 54 { 55 ClearAll(); 56 LuoPistelaskuri(); 57 LuoLevel(); 58 MediaPlayer.Play("PinballSpring"); 59 MediaPlayer.IsRepeating = true; 60 } 61 void LuoLevel() 62 { 17 63 Color vari = RandomGen.NextColor(); 18 64 Color vari2 = RandomGen.NextColor(); 19 ClearAll();20 65 Gravity = new Vector(0, -800); 21 //IsFullScreen = true; 22 IsMouseVisible = true; 66 23 67 Level.Background.Color = vari2; 24 68 25 PhysicsObjectpullo = new PhysicsObject(40, 120);69 pullo = new PhysicsObject(40, 120); 26 70 Camera.ZoomFactor = 1; 27 71 pullo.Image = LoadImage("pullo"); 72 pullo.Y = 0; 28 73 pullo.Shape = Shape.FromImage(LoadImage("pullo")); 74 AddCollisionHandler(pullo, "alareuna", d); 29 75 Add(pullo); 30 76 77 /*PhysicsObject pullonpohja = new PhysicsObject(20, 10); 78 pullonpohja.X = pullo.X; 79 pullonpohja.Y = pullo.Bottom + 10; 80 Add(pullonpohja); 31 81 32 PhysicsObject alareuna = PhysicsObject.CreateStaticObject(2000, 200); 33 alareuna.Y = -500; 82 AxleJoint aj = new AxleJoint(pullo, pullonpohja); 83 84 Add(aj);*/ 85 86 alareuna = PhysicsObject.CreateStaticObject(2000, 200); 87 alareuna.Y = -600; 34 88 alareuna.Color = vari; 35 89 alareuna.Tag = "alareuna"; 36 90 Add(alareuna); 37 91 92 ylareuna = PhysicsObject.CreateStaticObject(2000, 200); 93 ylareuna.Y = 600; 94 ylareuna.Color = vari; 95 ylareuna.Tag = "alareuna"; 96 Add(ylareuna); 97 38 98 PhysicsObject vasenreuna = PhysicsObject.CreateStaticObject(200, 3000); 39 vasenreuna.X = -1 050;99 vasenreuna.X = -1100; 40 100 vasenreuna.Y = 900; 41 101 Add(vasenreuna); 102 103 PhysicsObject taso = PhysicsObject.CreateStaticObject(300, 30); 104 taso.X = 0; 105 taso.Y = -100; 106 taso.Color = vari; 107 Add(taso); 42 108 43 109 PhysicsObject oikeareuna = PhysicsObject.CreateStaticObject(200, 3000); … … 49 115 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 50 116 Keyboard.Listen(Key.R, ButtonState.Pressed, AloitaPeli, "Restart"); 51 Mouse.Listen(MouseButton.Left, ButtonState.Released, Pyori, "Heitä pullo", pullo); 117 Keyboard.Listen(Key.Space, ButtonState.Released, Pyori, "Heitä pullo", pullo); 118 Keyboard.Listen(Key.Space, ButtonState.Down, AloitaLaskuri, "Heitä pullo"); 119 } 120 void d (PhysicsObject pullo, PhysicsObject alareuna) 121 { 122 if (pullo.Bottom == alareuna.Top) 123 { 124 pisteLaskuri.Value += 1; 125 } 126 } 127 Timer aikaLaskuri; 128 void AloitaLaskuri() 129 { 130 y = 0; 131 aikaLaskuri = new Timer(); 132 aikaLaskuri.Interval = 0.1; 133 aikaLaskuri.Timeout += delegate {y = y + 10; }; 134 aikaLaskuri.Start(); 135 52 136 } 53 137 void Pyori(PhysicsObject pullo) 54 138 { 55 pullo.Hit(new Vector( 0, 100));139 pullo.Hit(new Vector(50, y)); 56 140 pullo.AngularVelocity = 30; 141 MessageDisplay.Add(y.ToString()); 142 aikaLaskuri.Reset(); 143 } 144 IntMeter pisteLaskuri; 145 146 void LuoPistelaskuri() 147 { 148 pisteLaskuri = new IntMeter(0); 149 150 Label pisteNaytto = new Label(); 151 pisteNaytto.X = Screen.Left + 100; 152 pisteNaytto.Y = Screen.Top - 100; 153 pisteNaytto.TextColor = Color.White; 154 pisteNaytto.IntFormatString = "Flips: {0:D1}"; 155 pisteNaytto.BindTo(pisteLaskuri); 156 Add(pisteNaytto); 57 157 } 58 158 } -
2017/24/SamuelN/Bottleflip/Bottleflip/Bottleflip/Bottleflip.csproj.Debug.cachefile
r8505 r8596 1 1 Content\pullo.xnb 2 Content\flip.xnb 3 Content\IttyBitty.xnb 4 Content\PinballSpring.xnb 5 Content\pullo2.xnb 6 Content\IttyBitty.wma 7 Content\PinballSpring.wma -
2017/24/SamuelN/Bottleflip/Bottleflip/Bottleflip/obj/x86/Debug/Bottleflip.csproj.FileListAbsolute.txt
r8533 r8596 16 16 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\obj\x86\Debug\Bottleflip.exe 17 17 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\obj\x86\Debug\Bottleflip.pdb 18 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\flip.xnb 19 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\IttyBitty.xnb 20 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\PinballSpring.xnb 21 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\IttyBitty.wma 22 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\PinballSpring.wma 23 C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\pullo2.xnb -
2017/24/SamuelN/Bottleflip/Bottleflip/Bottleflip/obj/x86/Debug/ContentPipeline-{536D966A-8C7A-41D4-A0E3-DF5A9112B885}.xml
r8533 r8596 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\pullo.xnb</Output> 11 <Time>2017-06-12T12:06:16.7330895+03:00</Time> 11 <Time>2017-06-13T10:25:01.1873806+03:00</Time> 12 </Item> 13 <Item> 14 <Source>flip.wav</Source> 15 <Name>flip</Name> 16 <Importer>WavImporter</Importer> 17 <Processor>SoundEffectProcessor</Processor> 18 <Options>None</Options> 19 <Output>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\flip.xnb</Output> 20 <Time>2017-06-13T14:07:55.9813721+03:00</Time> 21 </Item> 22 <Item> 23 <Source>IttyBitty.mp3</Source> 24 <Name>IttyBitty</Name> 25 <Importer>Mp3Importer</Importer> 26 <Processor>SongProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\IttyBitty.xnb</Output> 29 <Extra>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\IttyBitty.wma</Extra> 30 <Time>2017-06-13T14:18:52.8341593+03:00</Time> 31 </Item> 32 <Item> 33 <Source>PinballSpring.mp3</Source> 34 <Name>PinballSpring</Name> 35 <Importer>Mp3Importer</Importer> 36 <Processor>SongProcessor</Processor> 37 <Options>None</Options> 38 <Output>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\PinballSpring.xnb</Output> 39 <Extra>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\PinballSpring.wma</Extra> 40 <Time>2017-06-13T14:19:24.6279234+03:00</Time> 41 </Item> 42 <Item> 43 <Source>pullo2.png</Source> 44 <Name>pullo2</Name> 45 <Importer>TextureImporter</Importer> 46 <Processor>TextureProcessor</Processor> 47 <Options>None</Options> 48 <Output>C:\MyTemp\SamuelN\Bottleflip\Bottleflip\Bottleflip\bin\x86\Debug\Content\pullo2.xnb</Output> 49 <Time>2017-06-13T14:36:52.3688506+03:00</Time> 12 50 </Item> 13 51 <BuildSuccessful>true</BuildSuccessful> … … 58 96 <Assembly> 59 97 <Key>C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key> 60 <Value>2017-06- 07T09:21:00.3687337+03:00</Value>98 <Value>2017-06-10T13:20:55.82404+03:00</Value> 61 99 </Assembly> 62 100 </Assemblies> -
2017/24/SamuelN/Bottleflip/Bottleflip/Bottleflip/obj/x86/Debug/cachefile-{536D966A-8C7A-41D4-A0E3-DF5A9112B885}-targetpath.txt
r8505 r8596 1 1 Content\pullo.xnb 2 Content\flip.xnb 3 Content\IttyBitty.xnb 4 Content\IttyBitty.wma 5 Content\PinballSpring.xnb 6 Content\PinballSpring.wma 7 Content\pullo2.xnb -
2017/24/SamuelN/Bottleflip/Bottleflip/BottleflipContent/BottleflipContent.contentproj
r8505 r8596 52 52 </Compile> 53 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="flip.wav"> 56 <Name>flip</Name> 57 <Importer>WavImporter</Importer> 58 <Processor>SoundEffectProcessor</Processor> 59 </Compile> 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="IttyBitty.mp3"> 63 <Name>IttyBitty</Name> 64 <Importer>Mp3Importer</Importer> 65 <Processor>SongProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="PinballSpring.mp3"> 70 <Name>PinballSpring</Name> 71 <Importer>Mp3Importer</Importer> 72 <Processor>SongProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="pullo2.png"> 77 <Name>pullo2</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 54 82 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 55 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.