<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 0,  comments - 6,  trackbacks - 0

    Space Invaders (太空侵略者)java 2D 游戲開發指南系列文章來自 Coke and Code ,主要包括下面四篇:

     

    我現在翻譯的是 Space Invaders 101  第一部分 簡介 (整篇文檔和源代碼請點擊下載

    通過 Space Invaders 太空侵略者 系列譯文,我們將學習類似于經典小游戲“小蜜蜂”的 2D Java游戲如何一步一步開發出來。游戲效果如圖:

     
    圖片


    Introduction

    簡介


    This tutorial hopes to give the reader a simple introduction to the world of 2D games using Java. We're going to cover the following areas at a fairly simplistic level:


    譯:本指南希望能給讀者一個使用Java開發2D 游戲的簡單介紹。文章將在相當簡單的水平上涵蓋以下領域:


    · Accelerated Mode Graphics 圖形加速模式

    · Simple game loops 簡單游戲循環

    · Keyboard Input 鍵盤輸入

    · Brute force collision detection強力碰撞檢測


    The final game can be see here. The complete source for the tutorial can be found here. Its intended that you read through this tutorial with the source code at your side. The tutorial isn't going to cover every line of code but should give you enough to fully understand how it works.


    譯:你可以點擊這里下載游戲的可運行版本。點擊這里下載本文的完整源代碼。請在閱讀本文前下載好完整的源代碼,以便在閱讀本文過程中隨時參考。本文在介紹某一主題時僅包括足以讓你理解該主題編程思路的主要代碼片段。


    Context highlighted source is also available here:

    譯:你也可以通過下面高亮顯示的源程序連接下載源程序:
    Game.java
    SpriteStore.java
    Sprite.java
    Entity.java
    ShipEntity.java
    ShotEntity.java
    AlienEntity.java


    Disclaimer: This tutorial is provided as is. I don't guarantee that the provided source is perfect or that that it provides best practices.

    譯:免責聲明:我不保證本教程提供的源代碼是完美的或是最佳的實現。


    Design

    譯:設計思路


    Before starting any game its always a good idea to work out what's going to be in the game and how you're going to build your classes around that. You don't need to read this section unless you're interested in why the source is written the way it is.


    譯:在開始設計任何游戲之前,明確我們的游戲有什么內容,以及圍繞游戲內容如何構建類是一個好主意。除非你對源程序為什么要這樣寫感興趣,否則你不需要閱讀本章節。


    For our space invaders game we're going to have a main window. The window needs to use acceleated graphics. It also needs to respond to the player's key presses to move our player's ship around. For now we can call this class Game since it represents our main game.


    譯:我們的太空侵略者游戲將有一個主窗口。該窗口需要圖形加速,也必須能夠根據玩家的鍵盤操作來控制飛船的移動。我們給這個窗口類起個名字叫“Game”,因為他是游戲的核心部分。


    In that window we want to see some things moving around. The player's ship, the aliens and the shots that the players fire. Since all of these things have common properites (i.e. they display a graphic and move around the screen) we can infer a common class to represent each one with potentially subclasses to define the specific behaviours of these different types. Since "thing" is such a terrible name for a class, for our design I'm going to call them Entities. From this we get 4 classes. Entity with 3 subclasses, ShipEntityAlienEntity and ShotEntity


    譯:在“Game”窗口中,我們想看見玩家的戰船、外星人和玩家射出的子彈這些“東西”在屏幕中飛來飛去。因為“東西”對一個類來說是如此糟糕的一個名字,所以我們準備叫他們實體。因為所有的這些實體都擁有一些共同的特征(都用圖形來表示,并能夠在屏幕上來回移動),所以我們可以設計一個公共父類抽象描述所有可能的子類型,在不同類型實體的子類中定義具體行為。于是我們得到4個類,一個公共父類和三個實體子類,戰船實體,外星人實體和子彈實體。


    Finally for each Entity we have we'd like to have an image displayed, using an old term, a Sprite. However, we might use the same Sprite for multiple entities, for instance the aliens. It seems logically therefore to keep the sprite as a seperate object from the entity. In addition we don't want to waste graphics memory so we'd like to only load each sprite once. To manage this it'd be nice to add a class to manage loading of the Sprites and storing them for future use. So we add a pair of classes to our design, Sprite and SpriteStore.


    譯:最后,對于每一個實體,我們用一個圖片來展示,并且用一個老術語“精靈(Sprite)”來稱呼。但是,多個實體對象可能會是同一種精靈(Sprite,例如外星人實例因此,似乎精靈作為一個單獨的對象更加符合邏輯此外,我們不想浪費顯存,所以我們希望每一個精靈只加載一次。為了管理這一點,增加一個管理精靈的加載,并存儲起來供將來使用是一個非常不錯的主意。因此,我們在設計中加入了SpriteSpriteStore兩個類。

    學軟件開發,到蜂鳥科技!
    超強的師資力量 、完善的課程體系 、超低的培訓價格 、真實的企業項目。

    網址:www.ntcsoft.com 
    電話:0371-63839606 
    鄭州軟件開發興趣小組群:38236716

    posted on 2010-11-25 23:29 whistler 閱讀(1014) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    留言簿(2)

    我參與的團隊

    文章檔案(22)

    搜索

    •  

    最新評論

    主站蜘蛛池模板: 激情内射亚洲一区二区三区爱妻| 亚洲国产成人久久一区二区三区 | 日韩免费一区二区三区在线| 亚洲一区二区观看播放| 亚洲视频人成在线播放| 无码专区AAAAAA免费视频| 亚洲国产精品无码久久98| 亚洲国产另类久久久精品| 18禁无遮挡无码网站免费| 一级一级毛片免费播放| 亚洲一级片在线播放| 亚洲男人在线无码视频| 国产成在线观看免费视频| 国产精品成人啪精品视频免费| 亚洲中文无码av永久| 久久久久亚洲精品中文字幕| 男女免费观看在线爽爽爽视频| 成人午夜免费视频| 亚洲一区二区三区不卡在线播放| 亚洲精品无码久久久久AV麻豆| 无码国产精品一区二区免费式直播| 特色特黄a毛片高清免费观看| 亚洲男人的天堂久久精品| 国产偷国产偷亚洲清高动态图| 香蕉高清免费永久在线视频| 日本一卡精品视频免费| 丁香六月婷婷精品免费观看| 亚洲熟女www一区二区三区| 亚洲av女电影网| 久久久久一级精品亚洲国产成人综合AV区| 最近中文字幕无吗免费高清| 亚洲免费在线视频| 丝袜足液精子免费视频| 深夜免费在线视频| 精品韩国亚洲av无码不卡区| 久久久久se色偷偷亚洲精品av | 亚洲狠狠色丁香婷婷综合| 久久亚洲春色中文字幕久久久| 国内精品久久久久久久亚洲| 日本成人免费在线| 毛片视频免费观看|