- Timestamp:
- 2017-06-14 12:35:26 (6 years ago)
- Location:
- 2017/24/TomasM/SpaceInvanders
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvanders/SpaceInvanders.cs
r8613 r8649 9 9 public class SpaceInvanders : PhysicsGame 10 10 { 11 11 IntMeter pistelaskuri; 12 12 PhysicsObject pelaaja; 13 13 PhysicsObject Pahis; … … 17 17 LuoPelaaja(); 18 18 LuoPahis(); 19 Asteroidit(); 19 LuoKlooni(); 20 LuoKlooni(); 21 LuoKlooni(); 22 LuoKlooni(); 23 LuoKlooni(); 24 LuoKlooni(); 25 LuoPistelaskuri(); 26 TormaaTahteen(); 27 LuoAikaLaskuri(); 28 AikaLoppui(); 29 30 IsMouseVisible = true; 31 32 20 33 Level.Background.Image = LoadImage ("tahtitaivas"); 21 34 Level.Background.Size = Screen.Size; … … 26 39 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000)); 27 40 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); 41 Mouse.Listen(MouseButton.Left, ButtonState.Down,Tulta,null); 42 28 43 29 44 Level.Width = Screen.Width; 30 45 Level.Height = Screen.Height; 31 46 Level.CreateBorders(); 32 47 33 48 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 34 49 } … … 47 62 pelaaja.Image = LoadImage("avaruusalus"); 48 63 AddCollisionHandler(pelaaja, "pahapoika", BOOM); 64 pelaaja.Tag = "hyvapoika"; 49 65 50 51 66 52 67 … … 65 80 } 66 81 void LuoPahis() 67 { 68 Pahis = new PhysicsObject(75.0, 75.0); 69 //Pahis.Tag "kelju"; 70 Add(Pahis); 71 Pahis.Image = LoadImage("ufokuva2"); 72 73 82 { // 83 //Pahis = new PhysicsObject(75.0, 75.0); 84 // 85 //Add(Pahis); 86 //Pahis.Image = LoadImage("ufokuva2"); 87 //Pahis.X = -300.0; 88 // Pahis.Y = 100.0; 89 // 90 // 74 91 75 92 } 76 93 77 void Asteroidit() 94 95 96 void LuoKlooni() 78 97 { 79 98 PhysicsObject asteroidi = new PhysicsObject(100.0, 100.0); 80 asteroidi.Image = LoadImage("komeetta");81 asteroidi.X = 600.0;82 asteroidi.Y = - 300.0;99 asteroidi.Image = LoadImage("Asteroidi"); 100 asteroidi.X = RandomGen.NextDouble(Level.Left,Level.Right); 101 asteroidi.Y = -RandomGen.NextDouble(Level.Top, Level.Bottom); 83 102 asteroidi.Tag = "pahapoika"; 84 103 Add(asteroidi); 85 104 86 105 } 87 106 void LuoPistelaskuri() 107 { 108 // pistelaskuri = new IntMeter(0); 109 // Label pisteNaytto = new Label(); 110 // pisteNaytto.X = Screen.Left + 100; 111 // pisteNaytto.Y = Screen.Top - 100; 112 // pisteNaytto.TextColor = Color.Black; 113 // pisteNaytto.Color = Color.White; 114 // pisteNaytto.BindTo(pistelaskuri); 115 // Add(pisteNaytto); 116 // pistelaskuri.Value++; 117 118 119 } 120 void TormaaTahteen() 121 { 122 // PhysicsObject tahti = new PhysicsObject(150.0, 150.0); 123 // tahti.Image = LoadImage("tahti"); 124 // tahti.X = -414.0; 125 // tahti.Y = 345.0; 126 // Add(tahti); 127 // pistelaskuri.Value++; 128 129 //hahmo.Destroy(); 130 131 132 133 } 134 void Tulta() 135 { 136 PhysicsObject ammus = new PhysicsObject(5,5); 137 Vector suunta = Mouse.PositionOnScreen - pelaaja.Position; 138 ammus.Velocity = suunta * 10; 139 ammus.IgnoresCollisionWith(pelaaja); 140 ammus.MaximumLifetime = new TimeSpan(0, 0, 0,5); 141 Add(ammus); 142 143 144 } 145 void LuoAikaLaskuri() 146 { 147 Timer aikaLaskuri = new Timer(); 148 aikaLaskuri.Interval = 60; 149 aikaLaskuri.Timeout += AikaLoppui; 150 aikaLaskuri.Start(1); 151 152 Label aikaNaytto = new Label(); 153 aikaNaytto.TextColor = Color.White; 154 aikaNaytto.DecimalPlaces = 1; 155 aikaNaytto.BindTo(aikaLaskuri.SecondCounter); 156 Add(aikaNaytto); 157 } 158 159 void AikaLoppui() 160 { 161 MessageDisplay.Add("Aika loppui..."); 162 163 // täydennä mitä tapahtuu, kun aika loppuu 164 } 88 165 } -
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvanders/SpaceInvanders.csproj.Debug.cachefile
r8613 r8649 6 6 Content\komeetta.xnb 7 7 Content\ufokuva2.xnb 8 Content\Asteroidi.xnb 9 Content\tahti.xnb -
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvanders/obj/x86/Debug/ContentPipeline-{D89DCF55-38C9-4BD1-B73C-611D49CDD9D9}.xml
r8613 r8649 65 65 <Time>2017-06-13T14:41:59.3329305+03:00</Time> 66 66 </Item> 67 <Item> 68 <Source>Asteroidi.png</Source> 69 <Name>Asteroidi</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 <Options>None</Options> 73 <Output>C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\Asteroidi.xnb</Output> 74 <Time>2017-06-14T10:13:22.8124713+03:00</Time> 75 </Item> 76 <Item> 77 <Source>tahti.png</Source> 78 <Name>tahti</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\tahti.xnb</Output> 83 <Time>2017-06-14T10:44:52.2842072+03:00</Time> 84 </Item> 67 85 <BuildSuccessful>true</BuildSuccessful> 68 86 <Settings> -
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvanders/obj/x86/Debug/SpaceInvanders.csproj.FileListAbsolute.txt
r8613 r8649 14 14 C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\ufokuva2.xnb 15 15 C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\komeetta.xnb 16 C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\Asteroidi.xnb 17 C:\MyTemp\TomasM\SpaceInvanders\SpaceInvanders\SpaceInvanders\bin\x86\Debug\Content\tahti.xnb -
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvanders/obj/x86/Debug/cachefile-{D89DCF55-38C9-4BD1-B73C-611D49CDD9D9}-targetpath.txt
r8613 r8649 6 6 Content\komeetta.xnb 7 7 Content\ufokuva2.xnb 8 Content\Asteroidi.xnb 9 Content\tahti.xnb -
2017/24/TomasM/SpaceInvanders/SpaceInvanders/SpaceInvandersContent/SpaceInvandersContent.contentproj
r8613 r8649 90 90 </Compile> 91 91 </ItemGroup> 92 <ItemGroup> 93 <Compile Include="Asteroidi.png"> 94 <Name>Asteroidi</Name> 95 <Importer>TextureImporter</Importer> 96 <Processor>TextureProcessor</Processor> 97 </Compile> 98 </ItemGroup> 99 <ItemGroup> 100 <Compile Include="tahti.png"> 101 <Name>tahti</Name> 102 <Importer>TextureImporter</Importer> 103 <Processor>TextureProcessor</Processor> 104 </Compile> 105 </ItemGroup> 92 106 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 93 107 <!-- 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.