- Timestamp:
- 2016-06-21 15:54:16 (7 years ago)
- Location:
- 2016/25/PetteriR
- Files:
-
- 7 added
- 11 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/25/PetteriR/Pang/Pang/Pang/Pang.cs
r7474 r7480 59 59 void AloitaPeli() 60 60 { 61 Vector impulssi = new Vector( 800.0, 0.0);61 Vector impulssi = new Vector(1000.0, 0.0); 62 62 pallo.Hit(impulssi); 63 63 } -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyydd/hyppelyydd.cs
r7474 r7480 9 9 public class hyppelyydd : PhysicsGame 10 10 { 11 const double nopeus = 200;12 const double hyppyNopeus = 750;11 const double nopeus = 400; 12 const double hyppyNopeus = 800; 13 13 const int RUUDUN_KOKO = 40; 14 14 15 PlatformCharacter pelaaja1; 16 17 Image pelaajanKuva = LoadImage("pressa"); 15 PlatformCharacter pressa; 16 PlatformCharacter pollari; 17 Image pressanKuva = LoadImage("pressa"); 18 Image pollarinKuva = LoadImage("pollari"); 18 19 Image nippuKuva = LoadImage("nippu"); 20 Image aseKuva = LoadImage("asee"); 19 21 20 22 SoundEffect maaliAani = LoadSoundEffect("maali"); … … 27 29 LisaaNappaimet(); 28 30 29 Camera.Follow(p elaaja1);30 Camera.ZoomFactor = 1.2;31 Camera.StayInLevel = true;31 Camera.Follow(pressa,pollari); 32 //Camera.ZoomFactor = 1.2; 33 // Camera.StayInLevel = true; 32 34 } 33 35 … … 37 39 kentta.SetTileMethod('#', LisaaTaso); 38 40 kentta.SetTileMethod('*', LisaaNippu); 39 kentta.SetTileMethod('N', LisaaPelaaja); 41 kentta.SetTileMethod('N', LisaaPressa); 42 kentta.SetTileMethod('M', LisaaPollari); 40 43 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 41 44 Level.CreateBorders(); 42 Level.Background.CreateGradient(Color.Bl ack, Color.SkyBlue);45 Level.Background.CreateGradient(Color.Blue, Color.SkyBlue); 43 46 } 44 47 void LisaaPollari(Vector paikka, double leveys, double korkeus) 48 { 49 pollari = new PlatformCharacter(leveys, korkeus); 50 pollari.Position = paikka; 51 pollari.Mass = 4.0; 52 pollari.Image = pollarinKuva; 53 pollari.Tag = "pollari"; 54 Add(pollari); 55 56 57 //pelaaja1 on PlatformCharacter-tyyppinen 58 pollari.Weapon = new AssaultRifle(30, 10); 59 pollari.Weapon.Image = aseKuva; 60 pollari.Weapon.Y = pollari.Weapon.Y - 10; 61 //Ammusten määrä aluksi: 62 pollari.Weapon.Ammo.Value = 1000; 63 64 //Mitä tapahtuu kun ammus osuu johonkin? 65 pollari.Weapon.ProjectileCollision = AmmusOsui; 66 } 45 67 void LisaaTaso(Vector paikka, double leveys, double korkeus) 46 68 { 47 69 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 48 70 taso.Position = paikka; 49 taso.Color = Color. Black;71 taso.Color = Color.Gray; 50 72 Add(taso); 51 73 } … … 61 83 } 62 84 63 void LisaaP elaaja(Vector paikka, double leveys, double korkeus)85 void LisaaPressa(Vector paikka, double leveys, double korkeus) 64 86 { 65 pelaaja1 = new PlatformCharacter(leveys, korkeus); 66 pelaaja1.Position = paikka; 67 pelaaja1.Mass = 4.0; 68 pelaaja1.Image = pelaajanKuva; 69 AddCollisionHandler(pelaaja1, "nippu", Tormaanippuun); 70 Add(pelaaja1); 87 pressa = new PlatformCharacter(leveys, korkeus); 88 pressa.Position = paikka; 89 pressa.Mass = 4.0; 90 pressa.Image = pressanKuva; 91 AddCollisionHandler(pressa, "nippu", Tormaanippuun); 92 Add(pressa); 93 94 95 //pelaaja1 on PlatformCharacter-tyyppinen 96 pressa.Weapon = new AssaultRifle(30, 10); 97 pressa.Weapon.Image = aseKuva; 98 pressa.Weapon.Y = pressa.Weapon.Y - 10; 99 //Ammusten määrä aluksi: 100 pressa.Weapon.Ammo.Value = 1000; 101 102 //Mitä tapahtuu kun ammus osuu johonkin? 103 pressa.Weapon.ProjectileCollision = AmmusOsui; 71 104 } 72 105 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 106 { 107 ammus.Destroy(); 108 Explosion rajahdys = new Explosion(20); 109 rajahdys.Position = ammus.Position; 110 Add(rajahdys); 111 } 73 112 void LisaaNappaimet() 74 113 { … … 76 115 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 77 116 78 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 79 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 80 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 117 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pressa, -nopeus); 118 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pressa, nopeus); 119 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pressa, hyppyNopeus); 120 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pressa); 81 121 82 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 83 84 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus); 85 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus); 86 ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 122 Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pollari, -nopeus); 123 Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pollari, nopeus); 124 Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pollari, hyppyNopeus); 125 Keyboard.Listen(Key.Q, ButtonState.Down, AmmuAseella, "Ammu", pollari); 87 126 88 127 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 89 128 } 90 129 91 void Liikuta(PlatformCharacter hahmo, double nopeus)130 void AmmuAseella(PlatformCharacter pelaaja) 92 131 { 93 hahmo.Walk(nopeus); 132 PhysicsObject ammus; 133 if (pelaaja.Tag.Equals("pollari")) ammus = pollari.Weapon.Shoot(); 134 else ammus = pressa.Weapon.Shoot(); 135 136 if (ammus != null) 137 { 138 //ammus.Size *= 3; 139 // ammus.Image = ... 140 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 141 } 142 } 143 void Liikuta(PlatformCharacter pollari, double nopeus) 144 { 145 pollari.Walk(nopeus); 94 146 } 95 147 96 void Hyppaa(PlatformCharacter hahmo, double nopeus)148 void Hyppaa(PlatformCharacter pressa, double nopeus) 97 149 { 98 hahmo.Jump(nopeus);150 pressa.Jump(nopeus); 99 151 } 100 152 101 void Tormaanippuun(PhysicsObject hahmo, PhysicsObject nippu)153 void Tormaanippuun(PhysicsObject pressa, PhysicsObject nippu) 102 154 { 103 155 maaliAani.Play(); 104 MessageDisplay.Add(" Sina sait Rahaa!");156 MessageDisplay.Add("Varastit Rahan!"); 105 157 nippu.Destroy(); 106 158 } 107 }159 } -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyydd/hyppelyydd.csproj.Debug.cachefile
r7474 r7480 1 1 Content\maali.xnb 2 Content\norsu.xnb3 Content\tahti.xnb4 2 Content\kentta1.xnb 5 Content\ukko.xnb6 Content\Trump the Troll.xnb7 3 Content\DollarBillFace.xnb 8 4 Content\pressa.xnb 9 5 Content\nippu.xnb 6 Content\asee.xnb 7 Content\pollari.xnb -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyydd/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7474 r7480 12 12 </Item> 13 13 <Item> 14 <Source>norsu.png</Source>15 <Name>norsu</Name>16 <Importer>TextureImporter</Importer>17 <Processor>TextureProcessor</Processor>18 <Options>None</Options>19 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\norsu.xnb</Output>20 <Time>2016-06-20T13:06:08.5819728+03:00</Time>21 </Item>22 <Item>23 <Source>tahti.png</Source>24 <Name>tahti</Name>25 <Importer>TextureImporter</Importer>26 <Processor>TextureProcessor</Processor>27 <Options>None</Options>28 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\tahti.xnb</Output>29 <Time>2016-06-20T13:06:08.5819728+03:00</Time>30 </Item>31 <Item>32 14 <Source>kentta1.txt</Source> 33 15 <Name>kentta1</Name> … … 36 18 <Options>None</Options> 37 19 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2016-06-20T15:22:15.0361822+03:00</Time> 39 </Item> 40 <Item> 41 <Source>ukko.png</Source> 42 <Name>ukko</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\ukko.xnb</Output> 47 <Time>2016-06-20T13:32:54.7028901+03:00</Time> 48 </Item> 49 <Item> 50 <Source>Trump the Troll.jpg</Source> 51 <Name>Trump the Troll</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\Trump the Troll.xnb</Output> 56 <Time>2016-06-20T13:41:07.6479029+03:00</Time> 20 <Time>2016-06-21T15:37:34.3280108+03:00</Time> 57 21 </Item> 58 22 <Item> … … 72 36 <Options>None</Options> 73 37 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\pressa.xnb</Output> 74 <Time>2016-06-2 0T14:54:50.2510081+03:00</Time>38 <Time>2016-06-21T14:52:54.4249573+03:00</Time> 75 39 </Item> 76 40 <Item> … … 81 45 <Options>None</Options> 82 46 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\nippu.xnb</Output> 83 <Time>2016-06-20T14:12:24.6236089+03:00</Time> 47 <Time>2016-06-21T14:53:09.3697965+03:00</Time> 48 </Item> 49 <Item> 50 <Source>asee.png</Source> 51 <Name>asee</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\asee.xnb</Output> 56 <Time>2016-06-21T14:51:17.8567932+03:00</Time> 57 </Item> 58 <Item> 59 <Source>pollari.png</Source> 60 <Name>pollari</Name> 61 <Importer>TextureImporter</Importer> 62 <Processor>TextureProcessor</Processor> 63 <Options>None</Options> 64 <Output>C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\pollari.xnb</Output> 65 <Time>2016-06-21T15:17:36.1874251+03:00</Time> 84 66 </Item> 85 67 <BuildSuccessful>true</BuildSuccessful> -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyydd/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7474 r7480 1 1 Content\maali.xnb 2 Content\norsu.xnb3 Content\tahti.xnb4 2 Content\kentta1.xnb 5 Content\ukko.xnb6 Content\Trump the Troll.xnb7 3 Content\DollarBillFace.xnb 8 4 Content\pressa.xnb 9 5 Content\nippu.xnb 6 Content\asee.xnb 7 Content\pollari.xnb -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyydd/obj/x86/Debug/hyppelyydd.csproj.FileListAbsolute.txt
r7474 r7480 1 1 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\maali.xnb 2 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\norsu.xnb3 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\tahti.xnb4 2 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\kentta1.xnb 5 3 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\hyppelyydd.exe … … 10 8 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\obj\x86\Debug\hyppelyydd.exe 11 9 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\obj\x86\Debug\hyppelyydd.pdb 12 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\ukko.xnb13 10 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\obj\x86\Debug\hyppelyydd.csprojResolveAssemblyReference.cache 14 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\Trump the Troll.xnb15 11 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\DollarBillFace.xnb 16 12 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\pressa.xnb 17 13 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\nippu.xnb 14 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\asee.xnb 15 C:\Users\ohjelmointi\Documents\PetteriR\hyppelyydd\hyppelyydd\hyppelyydd\bin\x86\Debug\Content\pollari.xnb -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyyddContent/hyppelyyddContent.contentproj
r7474 r7480 51 51 <Processor>SoundEffectProcessor</Processor> 52 52 </Compile> 53 <Compile Include="norsu.png">54 <Name>norsu</Name>55 <Importer>TextureImporter</Importer>56 <Processor>TextureProcessor</Processor>57 </Compile>58 <Compile Include="tahti.png">59 <Name>tahti</Name>60 <Importer>TextureImporter</Importer>61 <Processor>TextureProcessor</Processor>62 </Compile>63 53 <Compile Include="kentta1.txt"> 64 54 <Name>kentta1</Name> … … 68 58 </ItemGroup> 69 59 <ItemGroup> 70 <Compile Include=" ukko.png">71 <Name> ukko</Name>60 <Compile Include="DollarBillFace.png"> 61 <Name>DollarBillFace</Name> 72 62 <Importer>TextureImporter</Importer> 73 63 <Processor>TextureProcessor</Processor> … … 75 65 </ItemGroup> 76 66 <ItemGroup> 77 <Compile Include="Trump the Troll.jpg"> 78 <Name>Trump the Troll</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 </Compile> 82 </ItemGroup> 83 <ItemGroup> 84 <Compile Include="DollarBillFace.png"> 85 <Name>DollarBillFace</Name> 67 <Compile Include="asee.png"> 68 <Name>asee</Name> 86 69 <Importer>TextureImporter</Importer> 87 70 <Processor>TextureProcessor</Processor> … … 102 85 </Compile> 103 86 </ItemGroup> 87 <ItemGroup> 88 <Compile Include="pollari.png"> 89 <Name>pollari</Name> 90 <Importer>TextureImporter</Importer> 91 <Processor>TextureProcessor</Processor> 92 </Compile> 93 </ItemGroup> 104 94 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 105 95 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2016/25/PetteriR/hyppelyydd/hyppelyydd/hyppelyyddContent/kentta1.txt
r7474 r7480 1 ############################################################ 2 # *************************N****************************** # 3 ####################### # ############################## 4 # *** ##### *************************** # 5 # ###**************** ####### ## #### ### ### ## # 6 ############################################################ 1 ############### 2 #*************# 3 #*************# 4 ######### #### 5 ######## # M ##### 6 # # ###### ###### 7 # # # ####### 8 # N # ## ######## 9 ######################################################
Note: See TracChangeset
for help on using the changeset viewer.