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

Không có đối tượng cần được quan tâm đến va chạm với cảnh quan, và không có phong cảnh nên được quan tâm trong va chạm với các đối tượng khác. Danh sách 12-12 tĩnh trừu tượng khung cảnh lớp trừu tượng cmAbstractStaticScenery | Black Art of Java Game Programming Building the JAVAroids Game key bindings static final int LEFTINDEX 0 static final int LEFT q rotate left static final int RIGHTINDEX 1 static final int RIGHT w rotate right static final int THRUSTINDEX 2 static final int THRUST o thrust static final int FIREINDEX 3 static final int FIRE p fire static final int SHIELDINDEX 4 static final int SHIELD shield update Ship and Fire sprites based on key buffer public void update update fire sprites for int i 0 i MAX_SHOTS i f i .update if ship s alive if shipAlive check the key buffer and perform the associated action if keyState LEFTINDEX if keyState RIGHTINDEX if keyState THRUSTINDEX if keyState FIREINDEX handleFire if keyState SHIELDINDEX updateShield update the Ship sprite file D Downloads Books Computer Java 20Game 20Programming ch13 7 von 10 13 19 18 Black Art of Java Game Programming Building the JAVAroids Game otherwise the ship s not alive else if the waiting period s over initialize a new Ship sprite if gameOver waitPeriod-- 0 270 width 2 height 2 0 0 0 shieldStrength 100 shipAlive true initialize parameters for a new game public void newGame 270 width 2 height 2 0 0 0 shieldStrength 100 shipAlive true shipsLeft 2 gameOver false increase Shield strength when the Ship touches a powerup public void increaseShield shieldStrength 30 if shieldStrength 250 shieldStrength 250 file D Downloads Books Computer Java 20Game 20Programming ch13 8 von 10 13 19 18 Black Art of Java Game Programming Building the JAVAroids Game handle keyDown events by setting the appropriate field in the key buffer public void keyDown Event e int k switch k case LEFT keyState LEFTINDEX true break case RIGHT keyState RIGHTINDEX true break case FIRE keyState FIREINDEX true break case .

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.