Changeset 5246
- Timestamp:
- 2014-07-01 14:56:32 (9 years ago)
- Location:
- 2014/27/ArttuR/Peli_1/Peli_1
- Files:
-
- 12 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1/Peli_1.cs
r5205 r5246 10 10 { 11 11 PhysicsObject pelaaja; 12 PhysicsObject hirvio; 13 GameObject tahtain; 12 14 Vector suunta; 13 15 16 AssaultRifle pelaajanAse; 17 18 Image avaimenKuva = LoadImage("Avain"); 19 Image aseenKuva = LoadImage("ase_1"); 20 Image hirvionKuva = LoadImage("Hirvio"); 21 Image tahtainKuva = LoadImage("Tahtain"); 14 22 Image seinaKuva = LoadImage("Seina_1"); 15 23 Image pelaajanKuva = LoadImage("Pelaaja"); … … 18 26 public override void Begin() 19 27 { 20 LuoKentta(); 21 LisaaOhjaimet(); 22 LuoPelaaja(Level.Left + 50, 0); 23 Camera.Follow(pelaaja); 28 LuoAlkuvalikko(); 24 29 25 30 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 27 32 } 28 33 34 void AloitaPeli() 35 { 36 LuoKentta(); 37 } 38 29 39 void LuoKentta() 30 40 { 41 42 LuoPelaaja(Level.Left + 50, 0); 43 LuoHirvio(500, 0); 44 LuoAvain(500, -75); 45 LisaaOhjaimet(); 46 Camera.Follow(pelaaja); 31 47 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Kentta_1"); 32 48 … … 41 57 ruudut.Execute(40, 40); 42 58 43 IsMouseVisible = true;59 //IsMouseVisible = true; 44 60 } 45 61 46 62 void LisaaOhjaimet() 47 63 { 48 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1500, 0)); 49 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1500, 0)); 50 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1500)); 51 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1500)); 64 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-20000, 0)); 65 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaajaa, null, new Vector(20000, 0)); 66 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 20000)); 67 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -20000)); 68 Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", pelaajanAse); 52 69 } 53 70 … … 66 83 pelaaja.LinearDamping = 0.5; 67 84 pelaaja.Image = pelaajanKuva; 85 pelaaja.CanRotate = false; 68 86 pelaaja.RotateImage = true; 69 //pelaaja.Angle = Angle.FromDegrees(270); 70 Add(pelaaja, 3); 87 Add(pelaaja, 2); 71 88 72 Mouse.ListenMovement(1.0, KaannaPelaajanKuvaa, ""); 89 pelaajanAse = new AssaultRifle(30, 10); 90 pelaajanAse.Ammo.Value = 1000; 91 pelaajanAse.FireRate = 2; 92 pelaajanAse.Image = aseenKuva; 93 pelaajanAse.X = 5; 94 pelaajanAse.Y = 10; 95 pelaaja.Add(pelaajanAse); 96 pelaajanAse.Layer = pelaaja.Layer; 97 98 LuoTahtain(); 99 100 Camera.Zoom(1.2); 101 102 Mouse.ListenMovement(1.0, HiiriLiikkui, ""); 73 103 } 74 104 75 105 76 void KaannaPelaajanKuvaa(AnalogState hiirenLiike)106 void HiiriLiikkui(AnalogState hiirenLiike) 77 107 { 78 108 suunta = (Mouse.PositionOnWorld - pelaaja.AbsolutePosition).Normalize(); 79 109 pelaaja.Angle = suunta.Angle; 110 tahtain.AbsolutePosition = Mouse.PositionOnWorld; 80 111 } 81 112 82 113 83 void LuoAvain( Vector paikka, double leveys, double korkeus)114 void LuoAvain(double x, double y) 84 115 { 85 116 PhysicsObject avain = new PhysicsObject(20, 20); 117 avain.Image = avaimenKuva; 118 avain.X = x; 119 avain.Y = y; 120 Add(avain, 2); 86 121 } 87 122 … … 93 128 seina.Image = seinaKuva; 94 129 seina.CollisionIgnoreGroup = 1; 95 Add(seina, 3);130 Add(seina,2); 96 131 } 97 132 … … 104 139 Add(lattia,-3); 105 140 } 141 142 void LuoTahtain() 143 { 144 tahtain = new GameObject (20, 20); 145 tahtain.Image = tahtainKuva; 146 //tahtain.IgnoresPhysicsLogics = true; 147 Add(tahtain, 3); 148 } 149 150 void LuoHirvio(double x, double y) 151 { 152 hirvio = new PhysicsObject(50, 50); 153 hirvio.LinearDamping = 0.5; 154 hirvio.Image = hirvionKuva; 155 hirvio.CanRotate = false; 156 hirvio.X = x; 157 hirvio.Y = y; 158 Add(hirvio, 2); 159 160 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja); 161 seuraajanAivot.Speed = 200; 162 seuraajanAivot.DistanceFar = 600; 163 seuraajanAivot.TurnWhileMoving = true; 164 hirvio.Brain = seuraajanAivot; 165 } 166 167 void AmmuAseella(AssaultRifle ase) 168 { 169 PhysicsObject ammus = ase.Shoot(); 170 } 171 172 void LuoAlkuvalikko() 173 { 174 MultiSelectWindow alkuValikko = new MultiSelectWindow("Peli_1", "Aloita peli", "Asetukset", "Lopeta"); 175 Add(alkuValikko); 176 177 Level.Background.Color = Color.Gray; 178 179 alkuValikko.AddItemHandler(0, AloitaPeli); 180 } 106 181 } -
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1/Peli_1.csproj.Debug.cachefile
r5205 r5246 3 3 Content\Pelaaja.xnb 4 4 Content\Lattia_1.xnb 5 Content\Tahtain.xnb 6 Content\Hirvio.xnb 7 Content\ase_1.xnb 8 Content\Avain.xnb -
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1/obj/x86/Debug/ContentPipeline-{74419C50-653A-4569-B7AE-3488C78AF899}.xml
r5222 r5246 27 27 <Options>None</Options> 28 28 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Pelaaja.xnb</Output> 29 <Time>2014-07-01T12:3 3:33.9765458+03:00</Time>29 <Time>2014-07-01T12:38:52.8145113+03:00</Time> 30 30 </Item> 31 31 <Item> … … 37 37 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Lattia_1.xnb</Output> 38 38 <Time>2014-07-01T12:33:33.9765458+03:00</Time> 39 </Item> 40 <Item> 41 <Source>Tahtain.png</Source> 42 <Name>Tahtain</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Tahtain.xnb</Output> 47 <Time>2014-07-01T13:11:15.8253242+03:00</Time> 48 </Item> 49 <Item> 50 <Source>Hirvio.png</Source> 51 <Name>Hirvio</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Hirvio.xnb</Output> 56 <Time>2014-07-01T13:22:45.8283176+03:00</Time> 57 </Item> 58 <Item> 59 <Source>ase_1.png</Source> 60 <Name>ase_1</Name> 61 <Importer>TextureImporter</Importer> 62 <Processor>TextureProcessor</Processor> 63 <Options>None</Options> 64 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\ase_1.xnb</Output> 65 <Time>2014-07-01T13:55:12.7559909+03:00</Time> 66 </Item> 67 <Item> 68 <Source>Avain.png</Source> 69 <Name>Avain</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 <Options>None</Options> 73 <Output>C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Avain.xnb</Output> 74 <Time>2014-07-01T14:26:51.0828046+03:00</Time> 39 75 </Item> 40 76 <BuildSuccessful>true</BuildSuccessful> -
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1/obj/x86/Debug/Peli_1.csproj.FileListAbsolute.txt
r5205 r5246 11 11 C:\MYTEMP\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Pelaaja.xnb 12 12 C:\MYTEMP\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Lattia_1.xnb 13 C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Tahtain.xnb 14 C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Hirvio.xnb 15 C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\ase_1.xnb 16 C:\MyTemp\ArttuR\Peli_1\Peli_1\Peli_1\Peli_1\bin\x86\Debug\Content\Avain.xnb -
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1/obj/x86/Debug/cachefile-{74419C50-653A-4569-B7AE-3488C78AF899}-targetpath.txt
r5205 r5246 3 3 Content\Pelaaja.xnb 4 4 Content\Lattia_1.xnb 5 Content\Tahtain.xnb 6 Content\Hirvio.xnb 7 Content\ase_1.xnb 8 Content\Avain.xnb -
2014/27/ArttuR/Peli_1/Peli_1/Peli_1/Peli_1Content/Peli_1Content.contentproj
r5205 r5246 73 73 </Compile> 74 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="Tahtain.png"> 77 <Name>Tahtain</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="Hirvio.png"> 84 <Name>Hirvio</Name> 85 <Importer>TextureImporter</Importer> 86 <Processor>TextureProcessor</Processor> 87 </Compile> 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="ase_1.png"> 91 <Name>ase_1</Name> 92 <Importer>TextureImporter</Importer> 93 <Processor>TextureProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 97 <Compile Include="Avain.png"> 98 <Name>Avain</Name> 99 <Importer>TextureImporter</Importer> 100 <Processor>TextureProcessor</Processor> 101 </Compile> 102 </ItemGroup> 75 103 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 76 104 <!-- 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.