Changeset 3640
- Timestamp:
- 2012-07-06 10:47:06 (11 years ago)
- Location:
- 2012/27/DenisZ/TheDungeonGame/TheDungeonGame
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/Item.cs
r3563 r3640 28 28 public virtual void onPickup(Player picker) 29 29 { 30 picker.ItemInInventory = this;31 picker.updateGuiImage();30 //picker.ItemInInventory = this; 31 //picker.updateGuiImage(); 32 32 } 33 33 34 34 public ItemEntity createWorldObject() 35 35 { 36 ItemEntity result = new ItemEntity(this );36 ItemEntity result = new ItemEntity(this, itemTexture.Width/4, itemTexture.Height/4); 37 37 result.Image = itemTexture; 38 38 result.Tag = "Item"; -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/ItemEntity.cs
r3624 r3640 12 12 public Item bindedItem; 13 13 14 public ItemEntity(Item item )15 : base( 40, 40, Shape.Rectangle)14 public ItemEntity(Item item, double width, double height) 15 : base(width, height, Shape.Rectangle) 16 16 { 17 17 Tag = "Item"; -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/Room.cs
r3624 r3640 61 61 entitiesSpawned++; 62 62 } 63 //for (int i = 0; i < entityAmount; i++) 64 //{ 65 // EntityBase entity = RoomCreator.getEntity(Entities.entities.Length-1); 66 // if(!addEntityAt(entity, RandomGen.NextInt(bWidth-2)+1, RandomGen.NextInt(bHeight-2)+1)) 67 68 //} 63 } 64 65 public void spawnRandomItems(int itemAmount) 66 { 67 int itemsSpawned = 0; 68 while (itemsSpawned < itemAmount) 69 { 70 ItemEntity item = RoomCreator.getItem(RandomGen.NextInt(1)).createWorldObject(); 71 if (!addBlock(item, RandomGen.NextInt(bWidth - 2) + 1, RandomGen.NextInt(bHeight - 2) + 1)) 72 continue; 73 itemsSpawned++; 74 } 69 75 } 70 76 … … 191 197 } 192 198 193 public voidaddBlock(IPhysicsObject obj, int bx, int by)194 { 195 if (bx >= bWidth || bx < 0 || by >= bHeight || by < 0 || insideObjects[bx, by] != null) return ;199 public bool addBlock(IPhysicsObject obj, int bx, int by) 200 { 201 if (bx >= bWidth || bx < 0 || by >= bHeight || by < 0 || insideObjects[bx, by] != null) return false; 196 202 obj.Left = insidePos.X + (bx * blockWidth); 197 203 obj.Top = insidePos.Y - (by * blockHeight); 198 204 insideObjects[bx, by] = obj; 199 }200 201 public void addBlock(IPhysicsObject obj, int bx, int by, Vector offset) 202 {203 addBlock(obj, bx, by);205 return true; 206 } 207 208 public bool addBlock(IPhysicsObject obj, int bx, int by, Vector offset) 209 { 204 210 obj.Position += offset; 211 return addBlock(obj, bx, by); 212 205 213 } 206 214 -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/RoomTemplates.cs
r3624 r3640 7 7 using MathHelper; 8 8 using Entity; 9 using Items; 9 10 10 11 namespace Rooms … … 20 21 { 21 22 createLevelDecorations(); 22 23 23 spawnRandomItems(1); 24 24 } 25 25 } … … 221 221 if (id == 0) 222 222 ent = new EntityFly((TheDungeonGame)TheDungeonGame.Instance, Vector.Zero, new Vector(50, 50), Shape.Circle); 223 else if (id == 1)223 else if (id == 1) 224 224 ent = new EntityZombie((TheDungeonGame)TheDungeonGame.Instance, Vector.Zero, new Vector(60, 60), Shape.Rectangle); 225 else if (id == 2)225 else if (id == 2) 226 226 ent = new EntityDerpFace((TheDungeonGame)TheDungeonGame.Instance, Vector.Zero, new Vector(60, 60), Shape.Circle); 227 else if (id == 3)227 else if (id == 3) 228 228 ent = new EntityDerpFly((TheDungeonGame)TheDungeonGame.Instance, Vector.Zero, new Vector(50, 50), Shape.Circle); 229 229 //else if(id == 4) … … 231 231 return ent; 232 232 } 233 234 public static Item getItem(int id) 235 { 236 Item item = null; 237 if (id == 0) 238 item = new ItemHealth(); 239 240 return item; 241 } 233 242 } 234 243 } -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/TheDungeonGame.cs
r3633 r3640 87 87 soundEffects.Add(LoadSoundEffect("sound/bug_hit")); 88 88 soundEffects.Add(LoadSoundEffect("sound/zombie_hit")); 89 soundEffects.Add(LoadSoundEffect("sound/item_pickup")); 89 90 } 90 91 … … 104 105 objectTextures.Add(LoadImage("objects/door_opened")); 105 106 objectTextures.Add(LoadImage("objects/bossdoor")); 107 objectTextures.Add(LoadImage("objects/healthcan")); 108 objectTextures.Add(LoadImage("objects/ammo_speed")); 109 objectTextures.Add(LoadImage("objects/ammo_damage")); 106 110 } 107 111 -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGame/TheDungeonGame.csproj
r3596 r3640 128 128 <Compile Include="Ohjelma.cs" /> 129 129 <Compile Include="RoomTemplates.cs" /> 130 <Compile Include=" TestItem.cs" />130 <Compile Include="ItemTemplates.cs" /> 131 131 <Compile Include="TheDungeonGame.cs" /> 132 132 <Compile Include="Properties\AssemblyInfo.cs" /> -
2012/27/DenisZ/TheDungeonGame/TheDungeonGame/TheDungeonGameContent/TheDungeonGameContent.contentproj
r3628 r3640 291 291 </Compile> 292 292 </ItemGroup> 293 <ItemGroup> 294 <Compile Include="sound\item_pickup.wav"> 295 <Name>item_pickup</Name> 296 <Importer>WavImporter</Importer> 297 <Processor>SoundEffectProcessor</Processor> 298 </Compile> 299 </ItemGroup> 300 <ItemGroup> 301 <Compile Include="objects\ammo_damage.png"> 302 <Name>ammo_damage</Name> 303 <Importer>TextureImporter</Importer> 304 <Processor>TextureProcessor</Processor> 305 </Compile> 306 <Compile Include="objects\ammo_speed.png"> 307 <Name>ammo_speed</Name> 308 <Importer>TextureImporter</Importer> 309 <Processor>TextureProcessor</Processor> 310 </Compile> 311 <Compile Include="objects\healthcan.png"> 312 <Name>healthcan</Name> 313 <Importer>TextureImporter</Importer> 314 <Processor>TextureProcessor</Processor> 315 </Compile> 316 </ItemGroup> 293 317 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 294 318 <!-- 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.