Visual C# Game Programming for Teens phần 10

phải được thực hiện (hợp tác giữa các nhà thiết kế và lập trình, nếu có nhiều hơn một người đang làm việc trên các trò chơi): mục này sẽ được xác định ở các cấp độ dungeon? Tên sản phẩm sẽ được thêm vào để data1, hoặc số mục, hoặc một số loại mã? | Treasure Caches 405 Figure The gold has been added to the dungeon like monster loot. must be made cooperatively between the designer and programmer if more than one person is working on the game How will items be identified in the dungeon levels Will the item name just be added to Datal or the item number or some sort of code This is really up to you but I will give you some pointers on just one way to do it. We already know where the item will be located in the level because it will be added right over the top of the tile it belongs to. So really all we need is the item name. I m not even sure if quantity is needed Do we ever want to add like 50 magic rings or hatchets No I don t think so You can if you want it s no big deal to just use one of the other data fields for quantity. I m going to use a code word ITEM to mean that an item should be dropped at that tile location. The Data2 field will contain the item name. See Figure . 406 Chapter 14 Populating the Dungeon Figure A Long Bow item has been added to a dungeon tile. To add items to the dungeon automatically based on tile properties adds a huge element of design power to the game engine The code to search for the ITEM flag and add the associated item to the dungeon will be similar to the code used to position the player. But instead of breaking when the first item is found as was done with the player spawn tile this code needs to keep going and scan the tile records of the entire level. See Figure . for int y 0 y 128 y for int x 0 x 128 x Item it null tile x y if ITEM Monster Spawns 407 Figure Adding items to the dungeon automatically via the level data. i t DropTreasureItem ref it x 32 y 32 Tip Some of the item artwork is obviously too large for the dungeon. It s an easy matter to shrink the drop image to a manageable size that better corresponds with the dungeon but you may not want to

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG