- Timestamp:
- 2013-07-24 13:55:59 (10 years ago)
- Location:
- 2013/30/VilleF/Lentokone/Lentokone
- Files:
-
- 8 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/30/VilleF/Lentokone/Lentokone/Lentokone/Lentokone.cs
r4621 r4626 9 9 public class Lentokone : PhysicsGame 10 10 { 11 private Animation ukkelianim; 11 private Animation sauruksenLento; 12 private Animation juusto; 13 private Animation miesa; 12 14 13 14 Image ukkeliP = LoadImage("ukkeliP"); 15 Image ukkeliPi = LoadImage("ukkeli"); 15 16 Image pommik = LoadImage("pommi"); 16 17 17 Image maisema = LoadImage("havutausta"); 18 Image havusaurus kuva= LoadImage("havusauruskuva");18 Image havusaurus = LoadImage("havusauruskuva"); 19 19 Vector nopeusYlos = new Vector(0, 1000); 20 20 Vector nopeusAlas = new Vector(0, -1000); 21 21 PhysicsObject pelaaja; 22 22 PhysicsObject pommi; 23 PhysicsObject vihu;23 PhysicsObject ukkeli1; 24 24 25 26 private Animation sauruksenLento;27 28 29 30 25 public override void Begin() 31 26 { 32 ukkelianim = LoadAnimation("ukkeli"); 27 miesa = LoadAnimation("blingbling"); 28 juusto = LoadAnimation("ukkeli"); 33 29 sauruksenLento = LoadAnimation("animaatio"); 34 30 Level.Width = 1920; … … 38 34 LuoKentta(); 39 35 LuoPelaaja(); 36 LisaaVihollinen(); 37 LisaaVihollinen(); 40 38 pelaaja.Animation = sauruksenLento; 41 39 pelaaja.Animation.Start(); 42 40 pelaaja.Animation.FPS = 3; 43 44 41 Camera.ZoomToLevel(); 45 42 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 46 pelaaja.Animation = sauruksenLento;47 pelaaja.Animation.Start();48 pelaaja.Animation.FPS = 3;49 50 43 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 51 44 Keyboard.Listen(Key.Left, ButtonState.Down, … … 67 60 void LisaaVihollinen() 68 61 { 69 PhysicsObject ukkeli = new PhysicsObject(40, 20); 70 ukkeli.Animation = ukkelianim; 71 ukkeli.Animation.Start(); 72 ukkeli.Animation.FPS = 5; 73 74 75 76 Add(vihu); 62 int n = 0; 63 while (n < 10) { 64 65 double x = RandomGen.NextDouble(Level.Right, Level.Left); 66 PhysicsObject ukkeli1 = new PhysicsObject(40, 60); 67 //ukkeli1.Shape = Shape.FromImage("ukkeliP"); 68 ukkeli1.Animation = juusto; 69 ukkeli1.Animation.Start(); 70 ukkeli1.Animation.FPS = 5; 71 ukkeli1.Tag = "vihollinen"; 72 PhysicsObject mies = new PhysicsObject(40, 60); 73 mies.Animation = miesa; 74 mies.Animation.Start(); 75 mies.Animation.FPS = 4; 76 mies.Tag = "vihollinen"; 77 ukkeli1.X = x; 78 mies.X = x; 79 ukkeli1.Y = Level.Bottom + 80; 80 mies.Y = Level.Bottom + 80; 81 Add(RandomGen.SelectOne (mies, ukkeli1)); 82 n++; 83 } 77 84 } 78 85 79 86 80 87 void TiputaPommi() 81 88 … … 92 99 Add(pommi); 93 100 94 AddCollisionHandler(pommi, "vihollinen", CollisionHandler.ExplodeTarget(20 0, true));101 AddCollisionHandler(pommi, "vihollinen", CollisionHandler.ExplodeTarget(20, true)); 95 102 AddCollisionHandler(pommi, CollisionHandler.ExplodeObject(20, true)); 96 103 97 104 98 105 } 106 99 107 void KaannaPelaajaa(double kaannos) 100 108 { … … 102 110 103 111 104 } 112 } 113 105 114 106 115 … … 127 136 void LiikutaPelaajaa(int suunta) 128 137 { 129 130 138 pelaaja.Push(Vector.FromLengthAndAngle(3000*suunta, pelaaja.Angle)); 131 132 139 } 133 140 … … 137 144 Level.Background.Image = maisema; 138 145 Level.Background.FitToLevel(); 139 Surface alareuna = new Surface(Level.Width, 30, 50, 60, 10);146 Surface alareuna = new Surface(Level.Width, 50, 20, 60, 60); 140 147 alareuna.Color = Color.Green; 141 148 alareuna.Bottom = Level.Bottom; … … 147 154 { 148 155 pelaaja = new PhysicsObject(150.0, 190.0); 149 pelaaja.Shape = Shape.FromImage(havusaurus kuva);150 pelaaja.Image = havusaurus kuva;156 pelaaja.Shape = Shape.FromImage(havusaurus); 157 pelaaja.Image = havusaurus; 151 158 pelaaja.LinearDamping = 0.99; 152 159 pelaaja.CollisionIgnoreGroup = 2; 153 160 //pelaaja.MirrorImage(); 161 pelaaja.Animation = sauruksenLento; 162 pelaaja.Animation.Start(); 163 pelaaja.Animation.FPS = 3; 154 164 Add(pelaaja); 155 165 AddCollisionHandler(pelaaja, CollisionHandler.ExplodeObject(200, true)); 166 AddCollisionHandler(pelaaja, "vihollinen", CollisionHandler.ExplodeTarget(50, true)); 156 167 pelaaja.MaxVelocity = 600; 157 168 Timer ajastin = new Timer(); -
2013/30/VilleF/Lentokone/Lentokone/LentokoneContent/LentokoneContent.contentproj
r4622 r4626 118 118 </Compile> 119 119 </ItemGroup> 120 <ItemGroup />121 120 <ItemGroup> 122 121 <Compile Include="ukkeliP.png"> … … 127 126 </ItemGroup> 128 127 <ItemGroup> 129 <Compile Include="ukkeli\Ukkeli01.png"> 130 <Name>Ukkeli01</Name> 131 <Importer>TextureImporter</Importer> 132 <Processor>TextureProcessor</Processor> 133 </Compile> 134 <Compile Include="ukkeli\Ukkeli02.png"> 135 <Name>Ukkeli02</Name> 136 <Importer>TextureImporter</Importer> 137 <Processor>TextureProcessor</Processor> 138 </Compile> 139 <Compile Include="ukkeli\Ukkeli03.png"> 140 <Name>Ukkeli03</Name> 141 <Importer>TextureImporter</Importer> 142 <Processor>TextureProcessor</Processor> 143 </Compile> 144 <Compile Include="ukkeli\Ukkeli04.png"> 145 <Name>Ukkeli04</Name> 146 <Importer>TextureImporter</Importer> 147 <Processor>TextureProcessor</Processor> 148 </Compile> 149 <Compile Include="ukkeli\Ukkeli05.png"> 150 <Name>Ukkeli05</Name> 151 <Importer>TextureImporter</Importer> 152 <Processor>TextureProcessor</Processor> 153 </Compile> 154 <Compile Include="ukkeli\Ukkeli06.png"> 155 <Name>Ukkeli06</Name> 156 <Importer>TextureImporter</Importer> 157 <Processor>TextureProcessor</Processor> 158 </Compile> 159 <Compile Include="ukkeli\Ukkeli07.png"> 160 <Name>Ukkeli07</Name> 161 <Importer>TextureImporter</Importer> 162 <Processor>TextureProcessor</Processor> 128 <Compile Include="blingbling.anim"> 129 <Name>blingbling</Name> 130 <Importer>AnimationImporter</Importer> 131 <Processor>AnimationContentProcessor</Processor> 163 132 </Compile> 164 133 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.