<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)

    搜索

    •  

    最新評論

    主站蜘蛛池模板: 伊人久久五月丁香综合中文亚洲| jzzijzzij在线观看亚洲熟妇| 黄色片在线免费观看 | 亚洲日韩一区二区一无码| 亚洲 另类 无码 在线| 久久成人免费播放网站| 337p日本欧洲亚洲大胆人人| 久久噜噜噜久久亚洲va久| 妞干网在线免费视频| 成全视频高清免费观看电视剧| 亚洲精品综合在线影院| 亚洲中文字幕久久精品无码APP | 色多多A级毛片免费看| 亚洲视频一区二区在线观看| 免费大片黄手机在线观看| 波多野结衣免费在线| 国产精品视频全国免费观看| 亚洲色大成网站www尤物| 久久久久亚洲av无码专区导航| 全部免费毛片免费播放| 可以免费看的卡一卡二| 国产午夜成人免费看片无遮挡 | 久久久久女教师免费一区| 国产人成亚洲第一网站在线播放| 国产亚洲人成网站观看| 免费国产a国产片高清网站| 免费专区丝袜脚调教视频| 99久久免费国产特黄| 国产午夜亚洲精品不卡免下载| 亚洲国产精品久久网午夜 | 亚洲乱码中文字幕小综合| 亚洲va中文字幕无码久久不卡| 免费v片视频在线观看视频| 免费看韩国黄a片在线观看| 99热免费在线观看| 99久久免费国产特黄| 亚洲一区二区三区免费| 羞羞漫画页面免费入口欢迎你| 激情综合亚洲色婷婷五月| 久久99亚洲网美利坚合众国| 亚洲妇熟XXXX妇色黄|