Macromedia Flash MX Game Design Demystified phần 5

Trong trường hợp của các trò chơi câu đố sử dụng TBWs, chẳng hạn như Pac-Man và Minesweeper, sự phức tạp của gạch là thấp. Họ thường chỉ có một vài mặt hàng khác nhau mà họ cần để hiển thị, chẳng hạn như một dấu chấm được thu thập, | same as the sign from the starting and ending positions the character has not yet reached the destination whew . At some point the character s current position will be greater than the destination say 105. The value of 100-105 100-105 is negative. Since this value no longer matches the positive value found with the starting and ending positions we know the character has reached the destination. We perform this check for both the x and z directions. Once one of these two conditions is met the character needs to stop walking. In line 13 we set the moving property to false and then the velocities to 0. In lines 16 and 17 we set the character s temporary position to be the destination. Then in line 18 we change the frame the character is displaying to the standing frame. The last function we need to look at is detectObjects . This function is called in every frame to the character is about to step on a frame that contains an object like a plant or a block . 1 function detectObjects 2 Extend a little in the direction of motion 3 var x 4 var z 5 var x_tile x 6 var z_tile z 7 if x_tile z_tile .isObject true 8 var x 9 var z 10 var x_tile x 11 var z_tile z 12 var depth x_tile z_tile .depth 1 13 depth 14 else 15 16 17 0 18 0 19 false 20 var frame 21 stand frame 22 23 In lines 3-6 we add the feelerx and feelerz values to the temporary x and z values to determine which the feeler is touching. Then in line 7 a conditional statement checks to see if there is an object in the tile feelers are in. If there is then we skip to the else leg of the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
127    264    4    26-06-2024
Đã 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.