- Timestamp:
- 2010-07-06 14:55:20 (11 years ago)
- Location:
- 2010/24/arhetaka
- Files:
-
- 11 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/arhetaka/AcesHigh/AcesHigh/Content/Content.contentproj
r1069 r1097 1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> 2 2 <PropertyGroup> 3 3 <ProjectGuid>e096284d-6cca-445f-9d84-17525e965d28</ProjectGuid> … … 34 34 <Reference Include="Microsoft.Xna.Framework.Content.Pipeline.XImporter, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" /> 35 35 </ItemGroup> 36 <ItemGroup> 37 <Compile Include="kone1.png"> 38 <Name>kone1</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 43 <ItemGroup> 44 <Compile Include="kone1_nurin.png"> 45 <Name>kone1_nurin</Name> 46 <Importer>TextureImporter</Importer> 47 <Processor>TextureProcessor</Processor> 48 </Compile> 49 </ItemGroup> 50 <ItemGroup> 51 <Compile Include="rajahdys.png"> 52 <Name>rajahdys</Name> 53 <Importer>TextureImporter</Importer> 54 <Processor>TextureProcessor</Processor> 55 </Compile> 56 </ItemGroup> 57 <ItemGroup> 58 <Compile Include="kone2.png"> 59 <Name>kone2</Name> 60 <Importer>TextureImporter</Importer> 61 <Processor>TextureProcessor</Processor> 62 </Compile> 63 <Compile Include="kone2_nurin.png"> 64 <Name>kone2_nurin</Name> 65 <Importer>TextureImporter</Importer> 66 <Processor>TextureProcessor</Processor> 67 </Compile> 68 </ItemGroup> 69 <ItemGroup> 70 <Compile Include="kone1_nurin_2.png"> 71 <Name>kone1_nurin_2</Name> 72 <Importer>TextureImporter</Importer> 73 <Processor>TextureProcessor</Processor> 74 </Compile> 75 <Compile Include="kone1_nurin_3.png"> 76 <Name>kone1_nurin_3</Name> 77 <Importer>TextureImporter</Importer> 78 <Processor>TextureProcessor</Processor> 79 </Compile> 80 <Compile Include="kone1_nurin_4.png"> 81 <Name>kone1_nurin_4</Name> 82 <Importer>TextureImporter</Importer> 83 <Processor>TextureProcessor</Processor> 84 </Compile> 85 </ItemGroup> 86 <ItemGroup> 87 <Compile Include="kone2_nurin_2.png"> 88 <Name>kone2_nurin_2</Name> 89 <Importer>TextureImporter</Importer> 90 <Processor>TextureProcessor</Processor> 91 </Compile> 92 <Compile Include="kone2_nurin_3.png"> 93 <Name>kone2_nurin_3</Name> 94 <Importer>TextureImporter</Importer> 95 <Processor>TextureProcessor</Processor> 96 </Compile> 97 <Compile Include="kone2_nurin_4.png"> 98 <Name>kone2_nurin_4</Name> 99 <Importer>TextureImporter</Importer> 100 <Processor>TextureProcessor</Processor> 101 </Compile> 102 </ItemGroup> 36 103 </Project> -
2010/24/arhetaka/AcesHigh/AcesHigh/Peli.cs
r1069 r1097 4 4 using Jypeli.ScreenObjects; 5 5 using Jypeli.Assets; 6 using Jypeli.Effects; 6 7 7 8 public class Peli : PhysicsGame 8 9 { 9 10 PhysicsObject kone1; 11 PhysicsObject kone2; 12 ExplosionSystem systeemi; 13 10 14 11 15 int Pelaaja1NosteenSuunta = 1; 16 int Pelaaja2NosteenSuunta = 1; 17 18 Animation kone1_kaantyy_animation; 19 Animation kone2_kaantyy_animation; 12 20 13 21 protected override void Begin() 14 22 { 15 LuoKentta(); 23 LuoKentta(); 16 24 } 17 25 … … 19 27 { 20 28 Level.BackgroundColor = Color.LightBlue; 21 Gravity = new Vector(0.0, -50.0); 22 Camera.ZoomToLevel(); 29 Gravity = new Vector(0.0, -150.0); 30 Level.Height = Screen.Height; 31 Level.Width = 20000; 32 Level.CreateBorders(); 33 //Camera.ZoomToLevel(); 23 34 //Level.CreateBottomBorder(); 24 Level.CreateGround(100, 1.0, 3, Color.LightGreen); 35 PhysicsObject maa = new PhysicsObject(Level.Width, 50); 36 //maa.CollisionIgnorer. 37 maa.Color = Color.Green; 38 maa.Tag = "maailma"; 39 maa.Y = Level.Bottom; 40 41 Add(maa); 25 42 kone1 = TeeLentokone(true); 43 kone1.Image = LoadImage("kone1"); 44 kone1.Tag = "kone1"; 45 kone1.X = -100; 46 Add(kone1); 47 //Camera.FollowedObject = kone1.; 48 49 50 kone2 = TeeLentokone(true); 51 kone2.Image = LoadImage("kone2"); 52 kone2.Tag = "kone2"; 53 54 kone2.X = 100; 55 Add(kone2); 56 57 Image[] kone1_kaantyy_kuvat = LoadImages("kone1_nurin", "kone1_nurin_2", "kone1_nurin_3", "kone1_nurin_4", "kone1"); 58 kone1_kaantyy_animation = new Animation(kone1_kaantyy_kuvat); 59 60 Image[] kone2_kaantyy_kuvat = LoadImages("kone2_nurin", "kone2_nurin_2", "kone2_nurin_3", "kone2_nurin_4", "kone2"); 61 kone2_kaantyy_animation = new Animation(kone2_kaantyy_kuvat); 62 63 26 64 TeeOhjaimet(); 27 Add(kone1); 28 29 Timer ajastin = new Timer();30 ajastin.Interval= 0.1;31 ajastin.Trigger += PaivitaNoste;32 Add(ajastin);33 ajastin.Start();65 66 systeemi = new ExplosionSystem(LoadImage("rajahdys"), 100, false); 67 systeemi.MaxScale = 0.3; 68 systeemi.MinScale = 0.1; 69 systeemi.MaxLifetime = 0.1; 70 systeemi.MinLifetime = 0.08; 71 Add(systeemi); 34 72 35 73 } 36 74 PhysicsObject TeeLentokone(bool ihminen) 37 75 { 38 PhysicsObject kone = new PhysicsObject( 20, 7);76 PhysicsObject kone = new PhysicsObject(30, 30); 39 77 kone.Color = Color.Black; 40 78 kone.IgnoresGravity = false; 41 kone.LinearDamping = 0.9 9;79 kone.LinearDamping = 0.985; 42 80 return kone; 43 81 } … … 45 83 void TeeOhjaimet() 46 84 { 47 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, kone1 , 0);85 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, kone1); 48 86 Keyboard.Listen(Key.Right, ButtonState.Down, KaannaPelaajaa, null, kone1, -1); 49 87 Keyboard.Listen(Key.Left, ButtonState.Down, KaannaPelaajaa, null, kone1, 1); 50 88 Keyboard.Listen(Key.Right, ButtonState.Up, KaannaPelaajaa, null, kone1, 0); 51 89 Keyboard.Listen(Key.Left, ButtonState.Up, KaannaPelaajaa, null, kone1, 0); 52 Keyboard.Listen(Key.Down, ButtonState.Pressed, PyoritaPelaajaa1, null, 0); 53 } 54 55 void LiikutaPelaajaa(PhysicsObject pelaaja, int nopeus) 56 { 57 pelaaja.Push(Vector.FromLengthAndAngle(200, kone1.Angle)); 58 } 59 void KaannaPelaajaa(PhysicsObject pelaaja, int nopeus) 90 Keyboard.Listen(Key.Down, ButtonState.Pressed, PyoritaPelaajaa, null, kone1); 91 Keyboard.Listen(Key.RightControl, ButtonState.Pressed, Ammu, null, kone1, 1); 92 93 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaajaa, null, kone2); 94 Keyboard.Listen(Key.D, ButtonState.Down, KaannaPelaajaa, null, kone2, -1); 95 Keyboard.Listen(Key.A, ButtonState.Down, KaannaPelaajaa, null, kone2, 1); 96 Keyboard.Listen(Key.D, ButtonState.Up, KaannaPelaajaa, null, kone2, 0); 97 Keyboard.Listen(Key.A, ButtonState.Up, KaannaPelaajaa, null, kone2, 0); 98 Keyboard.Listen(Key.S, ButtonState.Pressed, PyoritaPelaajaa, null, kone2); 99 Keyboard.Listen(Key.LeftControl, ButtonState.Pressed, Ammu, null, kone2, 1); 100 } 101 102 void LiikutaPelaajaa(PhysicsObject pelaaja) 103 { 104 pelaaja.Push(Vector.FromLengthAndAngle(300, pelaaja.Angle)); 105 } 106 void KaannaPelaajaa(PhysicsObject pelaaja, int nopeus) //pitäisikö riippua nopeudesta? 60 107 { 61 108 pelaaja.AngularVelocity = nopeus; 62 109 } 63 64 void PaivitaNoste(Timer sender) //päivittää siipien aiheuttaman nosteen, riippuu nopeudesta 65 { 66 kone1.Push(Vector.FromLengthAndAngle((kone1.Velocity.Magnitude * 2), (kone1.Angle + Angle.RightAngle)* Pelaaja1NosteenSuunta)); 67 kone1.Push(Vector.FromLengthAndAngle(10, kone1.Angle)); //tyhjäkäynti 68 } 69 70 void PyoritaPelaajaa1(int nopeus) 71 { 72 Pelaaja1NosteenSuunta = Pelaaja1NosteenSuunta * -1; 110 111 void PaivitaKoneenNoste(PhysicsObject kone) 112 { 113 Vector KoneenNokanSuunta = Vector.FromLengthAndAngle(1, kone.Angle); 114 Vector KoneenNopeusEteen = kone.Velocity.Project(KoneenNokanSuunta); 115 if (KoneenNopeusEteen.Magnitude != 0) 116 { 117 if ((kone.Velocity.Magnitude / KoneenNopeusEteen.Magnitude / 100) < 0.05) 118 { 119 kone.LinearDamping = 1 - (kone.Velocity.Magnitude / KoneenNopeusEteen.Magnitude / 200); 120 } 121 } 122 if (kone.Tag == "kone1") 123 { 124 kone.Push(Vector.FromLengthAndAngle((KoneenNopeusEteen.Magnitude / 2), (kone.Angle + Angle.RightAngle) * Pelaaja1NosteenSuunta)); 125 } 126 else 127 { 128 kone.Push(Vector.FromLengthAndAngle((KoneenNopeusEteen.Magnitude / 2), (kone.Angle + Angle.RightAngle) * Pelaaja2NosteenSuunta)); 129 } 130 kone.Push(Vector.FromLengthAndAngle(10, kone.Angle)); //tyhjäkäynti 131 } 132 133 134 void PyoritaPelaajaa(PhysicsObject pelaaja) 135 { 136 if (pelaaja.Tag == "kone1") 137 { 138 Pelaaja1NosteenSuunta = Pelaaja1NosteenSuunta * -1; 139 if (Pelaaja1NosteenSuunta == -1) 140 { 141 Animation kone1_kaantyy_reverse_animation = Animation.Flip(kone1_kaantyy_animation); 142 kone1.Animation = kone1_kaantyy_reverse_animation; 143 kone1.Animation.FPS = 6; 144 kone1.Animation.StopOnLastFrame = true; 145 kone1.Animation.Start(1); 146 } 147 else 148 { 149 kone1.Animation = kone1_kaantyy_animation; 150 kone1.Animation.FPS = 6; 151 kone1.Animation.StopOnLastFrame = true; 152 kone1.Animation.Start(1); 153 } 154 } 155 else 156 { 157 Pelaaja2NosteenSuunta = Pelaaja2NosteenSuunta * -1; 158 if (Pelaaja2NosteenSuunta == -1) 159 { 160 Animation kone2_kaantyy_reverse_animation = Animation.Flip(kone2_kaantyy_animation); 161 kone2.Animation = kone2_kaantyy_reverse_animation; 162 kone2.Animation.FPS = 6; 163 kone2.Animation.StopOnLastFrame = true; 164 kone2.Animation.Start(1); 165 } 166 else 167 { 168 kone2.Animation = kone2_kaantyy_animation; 169 kone2.Animation.FPS = 6; 170 kone2.Animation.StopOnLastFrame = true; 171 kone2.Animation.Start(1); 172 } 173 } 174 175 } 176 void Ammu(PhysicsObject kone, int nopeus) 177 { 178 PhysicsObject ammus = new PhysicsObject(4, 4); 179 ammus.Shape = Shapes.Circle; 180 ammus.Color = Color.Yellow; 181 ammus.X = kone.X; 182 ammus.Y = kone.Y; 183 ammus.Mass = 5; 184 ammus.IgnoresCollisionResponse = false; 185 ammus.IgnoresExplosions = true; 186 TimeSpan elinaika = new TimeSpan(15000000); 187 ammus.MaximumLifetime = elinaika; 188 ammus.Tag = kone.Tag + "ammus"; 189 AddCollisionHandler(ammus, AmmusOsuu); 190 Add(ammus); 191 Angle koneenKulma = kone.Angle; 192 Vector KoneenNokanSuunta = Vector.FromLengthAndAngle(1, kone.Angle); 193 Vector KoneenNopeusEteen = kone.Velocity.Project(KoneenNokanSuunta); 194 Vector impulssi = Vector.FromLengthAndAngle(KoneenNopeusEteen.Magnitude * 5 + 2500, koneenKulma); 195 ammus.Hit(impulssi); 196 } 197 void AmmusOsuu(PhysicsObject ammus, PhysicsObject kohde) 198 { 199 if (kohde.Tag != "") 200 { 201 string ampuja = ammus.Tag.ToString(); 202 string uhri = kohde.Tag.ToString(); 203 204 205 if (ampuja[4] != uhri[4] && kohde.Tag != "ajopiste") 206 { 207 systeemi.AddEffect(ammus.X, ammus.Y, 5); 208 ammus.Destroy(); 209 } 210 } 211 } 212 213 protected override void Update(Time time) 214 { 215 PaivitaKoneenNoste(kone1); 216 PaivitaKoneenNoste(kone2); 217 Camera.X = kone1.X; 218 base.Update(time); 73 219 } 74 220 } -
2010/24/arhetaka/FysiikkaPeli1/FysiikkaPeli1/FysiikkaPeli1.csproj
r989 r1097 57 57 </PropertyGroup> 58 58 <ItemGroup> 59 <Reference Include="Jypeli2, Version=2. 1.9.0, Culture=neutral, processorArchitecture=x86">59 <Reference Include="Jypeli2, Version=2.3.1.0, Culture=neutral, processorArchitecture=x86"> 60 60 <SpecificVersion>False</SpecificVersion> 61 <HintPath>..\..\..\ ..\..\..\..\MyTemp\tags\2.1.9\lib\Jypeli2.dll</HintPath>61 <HintPath>..\..\..\lib\Jypeli2.dll</HintPath> 62 62 </Reference> 63 63 <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" />
Note: See TracChangeset
for help on using the changeset viewer.