Đang chuẩn bị liên kết để tải về tài liệu:
Visual C# Game Programming for Teens phần 10

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

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 14.8 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 14.9. 406 Chapter 14 Populating the Dungeon Figure 14.9 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 14.10. for int y 0 y 128 y for int x 0 x 128 x Item it null Level.tilemapStruct tile game.World.getTile x y if tile.data1.ToUpper ITEM tile.data2 Monster Spawns 407 Figure 14.10 Adding items to the dungeon automatically via the level data. i t game.Items.getItem tile.data2 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

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.