Changeset 2590
- Timestamp:
- 2011-08-05 12:09:15 (8 years ago)
- Location:
- 2011/31/SanteriP
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/31/SanteriP/Acon/Acon/Peli.cs
r2551 r2590 21 21 { 22 22 Alkuvalikko(); 23 23 24 //AikaLoppui(); 24 25 } 25 26 26 27 void LuoKentta() 27 28 28 { 29 29 30 Acon = new PhysicsObject( 30, 80);30 Acon = new PhysicsObject(90, 80); 31 31 Acon.Shape = Shape.Triangle; 32 32 Acon.Color = Color.White; 33 33 Acon.Image = olionKuva; 34 Acon.LinearDamping = 0.9; 34 35 Acon.Tag = "Acon"; 35 36 Add(Acon); 36 37 LuoAikaLaskuri(); 37 38 pyssy = new LaserGun(20, 5); 38 39 pyssy.LaserCollision = LaserSadeOsuu; 39 40 pyssy.Angle += Angle.FromDegrees(90); 40 pyssy.Ammo.Value = 500;41 pyssy.Ammo.Value = 100000; 41 42 pyssy.Tag = "pyssy"; 42 43 Acon.Add(pyssy); 43 44 44 45 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 45 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet");46 46 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000)); 47 47 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); … … 51 51 52 52 Level.CreateBorders(1.0, false); 53 Level.Background.CreateStars( 100);53 Level.Background.CreateStars(750); 54 54 Level.BackgroundColor = Color.Black; 55 55 Camera.ZoomToLevel(); 56 56 57 57 Timer ajastin = new Timer(); 58 ajastin.Interval = 1.7;58 ajastin.Interval = 0.5; 59 59 ajastin.Timeout += delegate { LuoVihollinen(); }; 60 60 ajastin.Start(); … … 73 73 void LuoVihollinen() 74 74 { 75 Asteroid = new PhysicsObject( 150, 150);75 Asteroid = new PhysicsObject(75, 75); 76 76 Asteroid.Shape = Shape.FromImage( AsteroidinKuva ); 77 77 RandomMoverBrain satunnaisAivot = new RandomMoverBrain(); 78 78 satunnaisAivot.Active = true; 79 satunnaisAivot.Speed = 1 000;79 satunnaisAivot.Speed = 1700; 80 80 Asteroid.X = RandomGen.NextDouble(Level.Left, Level.Right); 81 81 Asteroid.Y = RandomGen.NextDouble(Level.Bottom,Level.Top); … … 102 102 Add(rajahdys); 103 103 Acon.Destroy(); 104 AikaLoppui(); 104 105 } 105 106 } … … 112 113 rajahdys.Position = kohde.Position; 113 114 Add(rajahdys); 114 Asteroid.Destroy();115 kohde.Destroy(); 115 116 } 116 117 } … … 137 138 valikonKohdat = new List<Label>(); 138 139 139 Label kohta1 = new Label(" Aloita Peli");140 Label kohta1 = new Label("Start Game"); 140 141 kohta1.Position = new Vector(0, 40); 141 142 valikonKohdat.Add(kohta1); 142 143 Label kohta2 = new Label("Lopeta Peli"); 143 kohta1.TextColor = Color.Cyan; 144 145 Label kohta2 = new Label("Exit"); 144 146 kohta2.Position = new Vector(0, -40); 145 147 valikonKohdat.Add(kohta2); 146 147 Label kohta3 = new Label("Ohjeet"); 148 kohta3.Position = new Vector(0, 0); 149 valikonKohdat.Add(kohta3); 148 kohta2.TextColor = Color.Cyan; 150 149 151 150 Level.Background.Image = AlotusKuva; 152 151 Level.Background.FitToLevel(); 153 Camera.ZoomToLevel();154 152 153 Camera.ZoomFactor = 1.1; 155 154 156 155 foreach (Label valikonKohta in valikonKohdat) … … 158 157 Add(valikonKohta); 159 158 } 160 161 159 162 160 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, AloitaPeli, null); 163 161 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Exit, null); 164 Mouse.ListenOn(kohta3, MouseButton.Left, ButtonState.Pressed, Ohjeet, null);165 162 166 163 Mouse.IsCursorVisible = true; … … 193 190 LuoKentta(); 194 191 } 195 void Ohjeet() 196 { 197 198 } 199 192 void LuoAikaLaskuri() 193 { 194 Timer aikaLaskuri = new Timer(); 195 aikaLaskuri.Interval = 15; 196 aikaLaskuri.Timeout += AikaLoppui; 197 aikaLaskuri.Start(1); 198 199 Label aikaNaytto = new Label(); 200 aikaNaytto.TextColor = Color.White; 201 aikaNaytto.DecimalPlaces = 1; 202 aikaNaytto.BindTo(aikaLaskuri.SecondCounter); 203 Add(aikaNaytto); 204 } 205 void AikaLoppui() 206 { 207 MessageDisplay.Add("Aika loppui, selvist asteroidi vyöryn !"); 208 MessageDisplay.TextColor = Color.White; 209 Alkuvalikko(); 210 211 } 200 212 } 201 213 -
2011/31/SanteriP/Acon/AconContent/AconContent.contentproj
r2551 r2590 52 52 </ItemGroup> 53 53 <ItemGroup> 54 <Compile Include="Alus.png">55 <Name>Alus</Name>56 <Importer>TextureImporter</Importer>57 <Processor>TextureProcessor</Processor>58 </Compile>59 </ItemGroup>60 <ItemGroup>61 54 <Compile Include="Asteroid.png"> 62 55 <Name>Asteroid</Name> … … 72 65 </Compile> 73 66 </ItemGroup> 67 <ItemGroup> 68 <Compile Include="Alus.png"> 69 <Name>Alus</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 </Compile> 73 </ItemGroup> 74 74 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 75 75 <!-- 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.