- Timestamp:
- 2010-07-29 15:00:01 (13 years ago)
- Location:
- 2010/30/heanjule/Pyromaani
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/30/heanjule/Pyromaani/Content/Content.contentproj
r1334 r1424 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>9adf86e8-3688-4f82-b869-f604a9dc3bf0</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="pyro.png"> 38 <Name>pyro</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 36 43 </Project> -
2010/30/heanjule/Pyromaani/Peli.cs
r1400 r1424 1 1 using System; 2 using System.Collections.Generic; 2 3 using Jypeli; 3 4 using Jypeli.Widgets; … … 14 15 PlatformCharacter pyro; 15 16 GameObject pyronPaikka; 17 18 List<Weapon> inventory; 19 int valittuAse; 20 16 21 17 22 protected override void Begin() … … 34 39 taustaruudut.Insert(ruudunLeveys, ruudunKorkeus); 35 40 41 inventory = new List<Weapon>(); 42 valittuAse = 0; 36 43 37 44 TileMap ruudut = TileMap.FromFile("kentta.txt"); … … 80 87 { 81 88 PhysicsObject ase = PhysicsObject.CreateStaticObject(20.0, 20.0); 89 ase.Tag = "ase"; 82 90 return ase; 83 91 } … … 97 105 pyro.Color = Color.Black; 98 106 pyro.Mass = 10.0; 99 100 pyro.Weapon = new AssaultRifle(20, 5); 107 AddCollisionHandler(pyro, esineenKerays); 108 109 AssaultRifle kivaari = new AssaultRifle(20, 5); 110 inventory.Add(kivaari); 111 112 PlasmaCannon plasma = new PlasmaCannon(20, 5); 113 inventory.Add(plasma); 114 115 pyro.Weapon = kivaari; 116 //pyro.Weapon = new PlasmaCannon(20, 5); 101 117 102 118 … … 108 124 109 125 } 126 127 void esineenKerays(PhysicsObject pyro, PhysicsObject kohde) 128 { 129 if (kohde.Tag.ToString() == "ase") 130 { 131 //inventory.Add(kohde); 132 kohde.Destroy(); 133 134 135 } 136 } 137 138 110 139 void LisaaNappaimet() 111 140 { … … 124 153 125 154 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu"); 126 Keyboard.Listen(Key.G, ButtonState.Down, HeitaKranaatti, "Heitä"); 155 Keyboard.Listen(Key.G, ButtonState.Pressed, HeitaKranaatti, "Heitä"); 156 Keyboard.Listen(Key.E, ButtonState.Pressed, VaihdaAse, "Vaihda"); 127 157 128 158 } … … 142 172 143 173 if (ammus != null) 174 { 175 ammus.Size *= 2; 176 } 177 } 178 179 void HeitaKranaatti() 180 { 181 ClusterGrenade kranaatti = new ClusterGrenade(4.0, 2); 182 kranaatti.X = pyro.X + 40; 183 kranaatti.Y = pyro.Y + 10; 184 kranaatti.FuseTime = TimeSpan.FromSeconds(3); 185 186 187 Add(kranaatti); 188 Vector heittoVoima = Vector.FromLengthAndAngle(4000, Angle.Degrees(45)); 189 kranaatti.Hit(heittoVoima); 190 kranaatti.NumberOfClusters = 4; 191 192 193 } 194 void VaihdaAse() 195 { 196 valittuAse++; 197 198 if (valittuAse >= inventory.Count) 144 199 { 145 ammus.Size *= 2; 146 } 147 } 148 149 void HeitaKranaatti() 150 { 151 ClusterGrenade kranaatti = new ClusterGrenade(4.0, 2); 152 kranaatti.X = pyro.X + 10; 153 kranaatti.Y = pyro.Y + 10; 154 kranaatti.FuseTime = TimeSpan.FromSeconds(4); 155 156 Add(kranaatti); 157 Vector heittoVoima = Vector.FromLengthAndAngle(4000, Angle.Degrees( 45) ); 158 kranaatti.Hit( heittoVoima ); 159 kranaatti.NumberOfClusters = 4; 160 161 162 163 } 164 165 166 167 200 valittuAse = 0; 201 pyro.Weapon = inventory[valittuAse]; 202 } 203 else 204 { 205 pyro.Weapon = inventory[valittuAse]; 206 207 } 208 } 209 210 168 211 169 212
Note: See TracChangeset
for help on using the changeset viewer.