- Timestamp:
- 2014-07-25 10:50:41 (9 years ago)
- Location:
- 2014/30/RoosaH/Roskapeli
- Files:
-
- 9 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/Roskapeli.cs
r5630 r5664 13 13 PhysicsObject ylaReuna; 14 14 PhysicsObject alaReuna; 15 PhysicsObject pelaaja; 15 16 PlatformCharacter pelaaja; 16 17 17 18 List<PhysicsObject> roskat = new List<PhysicsObject>(); 18 19 19 20 20 IntMeter keratytEsineet; 21 21 22 22 Timer ajastin; 23 24 private Image[] hahmonkavely = LoadImages("hahmo2", "hahmo"); 25 26 private Image[] hahmonseisominen = LoadImages("hahmo3"); 27 private Image[] hahmonkuolema = LoadImages("hahmo4"); 23 28 24 29 Image hahmonkuva = LoadImage("hahmo"); 25 30 Image roskankuva = LoadImage("roska"); 26 31 Image tausta = LoadImage("Tausta"); 27 32 28 33 29 34 public override void Begin() … … 34 39 35 40 valikko(); 36 37 41 } 38 42 void AloitaPeli() … … 83 87 Add(alaReuna); 84 88 85 86 87 89 Level.Background.Color = Color.White; 88 90 Level.Background.Image = tausta; … … 91 93 void AsetaOhjaimet() 92 94 { 93 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu vasemmalle", new Vector(-200.0, 0.0));94 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu oikealle", new Vector(200.0, 0.0));95 Keyboard.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero);96 Keyboard.Listen(Key.Right, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero);95 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu vasemmalle", -200.0); 96 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, "Pelaaja liikkuu oikealle", 200.0); 97 //Keyboard.Listen(Key.Left, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 98 //Keyboard.Listen(Key.Right, ButtonState.Released, LiikutaPelaajaa, null, Vector.Zero); 97 99 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, keraa, "Keraa roskan"); 98 100 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 99 101 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 100 101 }102 void LiikutaPelaajaa(Vector suunta)103 {104 pelaaja.Velocity = suunta;105 } 106 P hysicsObjectLuoPelaaja(double x, double y)107 { 108 P hysicsObject pelaaja = new PhysicsObject(100.0, 150.0);102 } 103 void LiikutaPelaajaa(double suunta) 104 { 105 pelaaja.Walk(suunta); 106 //pelaaja.Velocity = suunta; 107 } 108 PlatformCharacter LuoPelaaja(double x, double y) 109 { 110 PlatformCharacter pelaaja = new PlatformCharacter(100.0, 150.0); 109 111 Add(pelaaja); 110 112 pelaaja.Image = hahmonkuva; 113 //pelaaja.Animation = new Animation(hahmonkavely); 114 pelaaja.AnimWalk = new Animation(hahmonkavely); 115 pelaaja.AnimIdle = new Animation(hahmonseisominen); 116 pelaaja.AnimWalk.FPS = (2); 117 //Animation pelaajaPeilattu = Animation.Mirror(); 118 //pelaaja.Animation.Start(); 119 111 120 pelaaja.Mass = 90000; 112 121 pelaaja.Restitution = 0.0; … … 114 123 pelaaja.Y = y; 115 124 pelaaja.CanRotate = false; 125 116 126 return pelaaja; 117 127 } … … 127 137 roska.Y = y; 128 138 return roska; 129 130 139 } 131 140 void keraa() … … 135 144 if (Vector.Distance(roska.Position, pelaaja.Position) < 100.0) 136 145 { 137 138 146 roska.Destroy(); 139 147 roskat.Remove(roska); … … 142 150 } 143 151 } 144 145 152 } 146 153 void Lisaaroskia() … … 151 158 PhysicsObject uusiroska = Luoroska(satunnainenX, satunnainenY); 152 159 roskat.Add(uusiroska); 160 161 153 162 if (roskat.Count >= 8) 154 163 { 155 164 Label gameover = new Label("Game Over"); 156 165 gameover.Color = Color.White; 166 ClearControls(); 167 Image rage = LoadImage("hahmo4"); 168 pelaaja.AnimIdle = new Animation (hahmonkuolema); 157 169 Add(gameover); 158 ClearControls();170 159 171 ajastin.Stop(); 160 172 Timer.SingleShot(4.0, valikko); … … 181 193 alkuValikko.AddItemHandler(0, AloitaPeli); 182 194 alkuValikko.AddItemHandler(1, Exit); 195 alkuValikko.Color = Color.White; 183 196 Add(alkuValikko); 184 185 } 186 187 } 188 189 190 197 } 198 199 } 200 201 202 -
2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/Roskapeli.csproj.Debug.cachefile
r5629 r5664 3 3 Content\Tausta.xnb 4 4 Content\hahmo2.xnb 5 Content\hahmo3.xnb 6 Content\hahmo4.xnb -
2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/ContentPipeline-{6B75B0A9-AF5F-495D-BD9C-473F93CC40FA}.xml
r5629 r5664 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo.xnb</Output> 11 <Time>2014-07-2 3T09:57:42.9539875+03:00</Time>11 <Time>2014-07-24T14:36:08.8169683+03:00</Time> 12 12 </Item> 13 13 <Item> … … 28 28 <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\Tausta.xnb</Output> 29 29 <Time>2014-07-23T13:16:17.5101928+03:00</Time> 30 </Item> 31 <Item> 32 <Source>hahmo2.png</Source> 33 <Name>hahmo2</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo2.xnb</Output> 38 <Time>2014-07-24T14:39:40.1791024+03:00</Time> 39 </Item> 40 <Item> 41 <Source>hahmo3.png</Source> 42 <Name>hahmo3</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo3.xnb</Output> 47 <Time>2014-07-25T09:51:45.8992156+03:00</Time> 48 </Item> 49 <Item> 50 <Source>hahmo4.png</Source> 51 <Name>hahmo4</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo4.xnb</Output> 56 <Time>2014-07-25T10:16:52.5128619+03:00</Time> 30 57 </Item> 31 58 <BuildSuccessful>true</BuildSuccessful> -
2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/Roskapeli.csproj.FileListAbsolute.txt
r5629 r5664 10 10 C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\roska.xnb 11 11 C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\Tausta.xnb 12 C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo2.xnb 13 C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo3.xnb 14 C:\MyTemp\RoosaH\Roskapeli\Roskapeli\Roskapeli\bin\x86\Debug\Content\hahmo4.xnb -
2014/30/RoosaH/Roskapeli/Roskapeli/Roskapeli/obj/x86/Debug/cachefile-{6B75B0A9-AF5F-495D-BD9C-473F93CC40FA}-targetpath.txt
r5629 r5664 2 2 Content\roska.xnb 3 3 Content\Tausta.xnb 4 Content\hahmo2.xnb 5 Content\hahmo3.xnb 6 Content\hahmo4.xnb -
2014/30/RoosaH/Roskapeli/Roskapeli/RoskapeliContent/RoskapeliContent.contentproj
r5629 r5664 66 66 </Compile> 67 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="hahmo2.png"> 70 <Name>hahmo2</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="hahmo3.png"> 77 <Name>hahmo3</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="hahmo4.png"> 84 <Name>hahmo4</Name> 85 <Importer>TextureImporter</Importer> 86 <Processor>TextureProcessor</Processor> 87 </Compile> 88 </ItemGroup> 68 89 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 69 90 <!-- 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.