tailieunhanh - Black Art of Java Game Programming PHẦN 3

, bạn sẽ tìm hiểu làm thế nào để tạo ra năng động giải trí trực tuyến của riêng bạn bằng cách sử dụng ngôn ngữ lập trình Java. Java báo hiệu một sự thay đổi mang tính cách mạng chơi game, đi từ máy tính để bàn và vào mạng. Sử dụng Java, bạn sẽ tạo ra các trò chơi mà mọi người có thể tải về thông qua web và chơi. | Black Art of Java Game Programming Building a Video Game else x-gun_width gun_y fire missile from given x coordinate public void fireMissile int x if if missile sprite isn t active if x min_x mis_min_x else if x max_x mis_max_x else x-2 initialize missile update all the parameters associated with the gun. In this case only the missile needs to move automatically. Also the gun manager checks if the missile hits anything public void update paint all sprites associated with gun public void paint Graphics g g g accessor function for gun public GunSprite getGun return gun public int getGunY return gun_y file D Downloads Books Computer Java 20Game 20Programming ch05 5 von 6 13 18 10 Black Art of Java Game Programming Building a Video Game Previous Table of Contents Next file D Downloads Books Computer Java 20Game 20Programming ch05 6 von 6 13 18 10 Black Art of Java Game Programming Building a Video Game Black Art of Java Game Programming by Joel Fan Sams Macmillan Computer Publishing ISBN 1571690433 Pub Date 11 01 96 Previous Table of Contents Next Notice that the missile is fired by calling its init method. This is much faster than creating a new MissileSprite object for each mouse click and it illustrates another general rule when writing games Avoid dynamic allocation of objects during game play. Try to allocate all the objects you will use at the very beginning if possible so the runtime system doesn t need to construct one when the game is running. Now let s create the aliens Defining the UFOManager The UFOManager is responsible for initializing the individual UFO sprites and telling them when to paint and update. Let s create the UFO class first before defining UFOManager. The UFO Class The UFO class will animate the sequence of bitmaps shown in Figure 5-2 so it becomes a subclass .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.