TAILIEUCHUNG - 3D Game Programming All in One- P8

3D Game Programming All in One- P8: During the past several years while working on the Tubettiland “Online Campaign” software and more recently while working on the Tubettiworld game, I figure I’ve received more than a hundred queries from people of all ages about how to get started making games. There were queries from 40-year-olds and 13-year-olds and every age in between. Most e-mails were from guys I would estimate to be in their late teens or early 20s. | 3D Programming 117 if scale and hasn t gotten too big scale make it bigger else grow false if it s too big don t let it grow more else if it s shrinking if scale and isn t too small scale - then make it smaller else grow true if it s too small don t let it grow smaller scale SPC scale SPC scale lx SPC ly SPC lz SPC rx SPC ry SPC rz SPC rd schedule 200 0 AnimShape shape dist angle scale function DoAnimTest ------------------------------------------------------- a function to tie together the instantiation and the movement in one easy to type function call. ------------------------------------------------------- as InsertTestShape grow true AnimShape as -1 2 This module is almost identical to the MoveShape module we worked with earlier. The function AnimShape accepts a shape handle in shape a distance step as dist an angle value as angle and a scaling value as scale and uses these to transform the shape indicated by the shape handle. First it obtains the current position of the shape using the method of the Item class. As with the earlier MoveShape function the AnimShape function fetches the transform of the shape and updates one of the axis values. Then it updates the rotation value stored rd. Team LRN 118 Chapter 3 3D Programming Concepts Then it adjusts the scale value by determining if the shape is growing or shrinking. Depending on which way the size is changing the scale is incremented unless the scale exceeds the too large or too small limits. When a limit is exceeded the change direction is reversed. Next the scale of the shape is changed to the new values using the method for the shape. Finally the function sets the item s transform to be the new transform values within the statement. The DoAnimTest function first inserts the new instance of the shape object using the InsertTestShape function and saves the handle to the new object in the variable as. It

Đã 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.