亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch10.htm

?? 有關于游戲開發(fā)的教程我閱讀后感覺不錯所以就拿出來與大家共享。
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<HTML>

<HEAD>
   <TITLE>Chapter 10 -- Traveling Gecko: Blistering Desert Fun</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 10</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Travelin Gecko: Blistering Desert Fun</FONT></B>
</H1>
<P>
<HR WIDTH="100%"></P>
<P>
<H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A>
</FONT></FONT></H3>

<UL>
<LI><A HREF="#DesigningTravelingGecko" >Designing Traveling Gecko</A>
<UL>
<LI><A HREF="#Sprites" >Sprites</A>
<LI><A HREF="#GamePlay" >Game Play</A>
</UL>
<LI><A HREF="#SampleAppletTravelingGecko" >Sample Applet: Traveling Gecko</A>
<UL>
<LI><A HREF="#TheSpriteClasses" >The Sprite Classes</A>
<LI><A HREF="#TheTravelingGeckoClass" >The TravelingGecko Class</A>
</UL>
<LI><A HREF="#Summary" >Summary</A>
<LI><A HREF="#QA" >Q&amp;A</A>
<LI><A HREF="#Workshop" >Workshop</A>
<UL>
<LI><A HREF="#Quiz" >Quiz</A>
<LI><A HREF="#Exercises" >Exercises</A>
</UL>
</UL>
<HR>
<P>
On <A HREF="ch9.htm" >Day 9</A>, you learned all about handling
user input in Java. In this lesson, you combine what you learned
about user input with your knowledge of the sprite classes to
create your first complete Java game, Traveling Gecko. In doing
so, you learn and apply new techniques for extending the sprite
classes.
<P>
Today's lesson presents and solves the major technical issues
involved in putting together a complete Java game. By developing
a complete game, your core Java game programming skills come full
circle. You'll see that putting together a complete game isn't
really that much more complex than the sample sprite applets you've
already worked on. After you finish this lesson, you'll have the
fundamental Java game programming constructs firmly in place so
that you can move on to more advanced topics.
<H2><A NAME="DesigningTravelingGecko"><B><FONT SIZE=5 COLOR=#FF0000>Designing
Traveling Gecko</FONT></B></A></H2>
<P>
As you learned back in <A HREF="ch7.htm" >Day 7</A>, &quot;Sim
Tarantula: Creepy Crawly Sprites,&quot; it's very important to
think through a game design as thoroughly as possible before writing
any code. So, before you even consider editing a Java source file,
be sure to think about the game design in both general and specific
terms. With that in mind, let's break the Traveling Gecko sample
game into its logical components.
<P>
The Traveling Gecko game is modeled roughly on the classic Atari
2600 Frogger game. In the original Frogger game, you guide a frog
through traffic and then across a river using floating logs to
get across. Traveling Gecko takes a similar approach, in that
the goal is to maneuver an animal from one place to another while
dodging dangers along the way. However, the setting for Traveling
Gecko is the desert southwest, and your character is a gecko on
the move. Your journeying little gecko only wants to get across
a particularly small stretch of desert, but he has to contend
with a variety of predators to do so. The predators include Gila
monsters, scorpions, rattlesnakes, and tarantulas.
<H3><A NAME="Sprites"><B>Sprites</B></A></H3>
<P>
Based on the game description thus far, you probably already have
in mind some sprites that the game will need. Let's go ahead and
break the game down into sprites, because that's where most of
the substance of the game is located. Obviously, the most important
sprite is the gecko sprite itself, which needs to be able to move
based on user input. The gecko sprite is the heart of the game
and must be designed with care.
<P>
Because the gecko is capable of being killed by the predators,
you'll also need an animation of the gecko dying-a geckocide sprite.
If you recall, you used a similar approach (spidercide sprite)
when developing the Sim Tarantula applet on <A HREF="ch7.htm" >Day 7</A>.
The geckocide sprite simply shows an animation of the gecko dying
so that it doesn't just disappear when it dies.
<P>
Moving along, it's fairly obvious that you'll also need sprite
objects for the predators. Although each one has basically the
same functionality, let's go ahead and think of them as different
sprite objects, because you might decide to add unique behavior
to one of them later. You should have some special logic for handling
a collision between the predators and the gecko, because this
contact results in the gecko's death.
<P>
Before you finish itemizing the sprites, take a moment to think
about the specifics surrounding the gecko's path across the desert.
Taking an approach similar to Frogger's, the gecko must travel
from the bottom of the screen to safety at the top. However, it
seems too easy to simply have him go from the bottom of the screen
to the top with no other obstacles than the predators. Frogger
has specific locations at the top of the screen where the frog
must go. Let's take a similar approach here. By placing large
rocks at the top and bottom of the screen, you can provide openings
at which the gecko can start and finish. This makes sense too,
because the openings in the rocks make good hiding places for
the gecko.
<P>
If you're now thinking that the rocks would make good additions
to the sprite inventory for Traveling Gecko, then pat yourself
on the back! If not, don't feel too bad; it might be because you
think they could just be made part of the background. That's true,
but there would be a big problem in detecting collisions between
the gecko and the rocks. The rocks are there for a reason-to limit
the gecko's movement. And the only way to limit the gecko's movement
is to detect a collision between him and a rock and not let him
move if he's colliding with a rock. Without making the rocks sprites,
you would have to add a bunch of special case code to a derived
<TT><FONT FACE="Courier">SpriteVector</FONT></TT> class to see
whether the gecko is colliding with them. Adding code to a derived
<TT><FONT FACE="Courier">SpriteVector</FONT></TT> class isn't
the problem, though; the problem is duplicating the collision
detection functionality you've already written.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
The discussion about the rock sprite brings up a good point in regard to game objects: Practically any graphical object in a game that can be interacted with or handled independently of the background should be implemented as a sprite. Remember that 
sprites are roughly analogous to cast members in a theatrical play. To carry things a bit further, you can extend the usage of sprites to also include the props used in a play. This is essentially the role rocks play in the Traveling Gecko game: 
props!</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
The rocks are the last sprites you'll need to write for the game.
To summarize what you have thus far, Traveling Gecko requires
sprites modeling the following objects:
<UL>
<LI>Gecko
<LI>Geckocide
<LI>Gila monster
<LI>Scorpion
<LI>Rattlesnake
<LI>Tarantula
<LI>Rock
</UL>
<P>
The gecko sprite models the player and is controlled by the player's
user input responses. The geckocide sprite is used to show a dying
gecko and comes in the form of a simple frame animation. The Gila
monster, scorpion, rattlesnake, and tarantula sprites model the
predators who are trying to ruin the gecko's trip. Remember that
there has to be some method of killing the gecko based on a collision
with these predators. This is an issue you'll deal with later
in this lesson, when you get into writing the Java code. Finally,
the rock sprite models rocks that block the gecko's movement,
thereby making it more difficult for him to get across the desert
safely.
<H3><A NAME="GamePlay"><B>Game Play</B></A></H3>
<P>
Now that you have an idea of what sprite classes you need to write,
let's take a look at the game itself and how it will play. First,
it wouldn't be much fun if the game ended as soon as you were
killed by a predator. So let's give the player four geckos (lives)
to play with; the game isn't over until all four are killed.
<P>
Although it is certainly fulfilling to help out a gecko in need,
it would also be nice to reward the player with some type of point
system. Let's give the player 25 points each time the gecko makes
it safely across the desert. Then the player's good will for saving
a gecko's life is given a numeric value that can be viewed with
pride!
<P>
Because every game ultimately ends when all four geckos are killed,
you also need to provide the player with a way to start a new
game. This is an ideal situation for a button; the player simply
clicks the button to start a new game.
<P>
This finishes the game design for Traveling Gecko. You now have
all the information you need to get into the specifics surrounding
the applet and support classes. What are you waiting for?
<H2><A NAME="SampleAppletTravelingGecko"><B><FONT SIZE=5 COLOR=#FF0000>Sample
Applet: Traveling Gecko</FONT></B></A></H2>
<P>
The Traveling Gecko applet is your first complete Java game and
makes the most of the indispensable sprite classes you've come
to know so well. Figure 10.1 shows the Traveling Gecko applet
in the middle of a heated game.
<P>
<A HREF="f10-1.gif" ><B>Figure 10.1 : </B><I>The Traveling Gecko sample applet.</I></A>
<P>
Traveling Gecko begins by creating the gecko, rocks, and predators.
You then use the keyboard to control the gecko and attempt to
guide him safely into the rock opening at the top right of the
screen. The score is displayed in the upper left corner of the
screen. Immediately to the right of the score is the number of
remaining gecko lives, which are displayed graphically as tiny
geckos.
<P>
The different predators all roam around the desert background
at different speeds hoping to make a quick meal out of your trusting
gecko. If one of them gets lucky, a geckocide object is created
to show the dying gecko. The number of remaining lives is then
decremented.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Warning</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Watch out for those pesky scorpions; they're quite fast!</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
If you guide the gecko safely across, you receive 25 points and
the chance to help him across again. I know, one would think that
the gecko would be thankful for making it across once and not
want to try again, but that's not the case! If you're able to
help him across a few times, you'll notice that the predators
start calling in reinforcements to make things more difficult.
<P>
If you manage to lose all four of your geckos to the predators,
the game ends and you see a message indicating that the game is
over. Figure 10.2 shows Traveling Gecko when a game has just ended.
<P>
<A HREF="f10-2.gif" ><B>Figure 10.2 : </B><I>A Traveling Gecko game that has come to an end.</I></A>
<P>
At this point, all you have to do is click the New Game button
with the mouse, and everything starts over. If you haven't checked
it out yet, now might be a good time to grab the accompanying
CD-ROM and try the game out for yourself. The complete source
code, executable, and images for the Traveling Gecko game are
included on the CD-ROM. If you just can't wait to find out all
the gory details, then by all means skip the CD-ROM and read on!
<H3><A NAME="TheSpriteClasses"><B>The Sprite Classes</B></A></H3>
<P>
As you probably guessed, the heart of the Traveling Gecko applet
is the extended sprite classes. The first of these classes is
the <TT><FONT FACE="Courier">Gecko</FONT></TT> class, which models
the gecko that is controlled by the player. The <TT><FONT FACE="Courier">Gecko</FONT></TT>
class is derived straight from <TT><FONT FACE="Courier">Sprite</FONT></TT>.
You might think that it would make more sense to derive <TT><FONT FACE="Courier">Gecko</FONT></TT>
from <TT><FONT FACE="Courier">DirectionalSprite</FONT></TT> (<A HREF="ch7.htm" >see Day 7</A>),
because a gecko clearly should face and move in different directions.
This is logical thinking, but the gecko's movement is limited
to up, down, left, and right. The <TT><FONT FACE="Courier">DirectionalSprite</FONT></TT>
class is geared more toward objects that can spin around and move
in different directions, including diagonal directions.
<P>
However, there is a drawback to not deriving the <TT><FONT FACE="Courier">Gecko</FONT></TT>
class from <TT><FONT FACE="Courier">DirectionalSprite</FONT></TT>:
The gecko can't face in the direction it is moving. That is why
the gecko is always facing upward, regardless of its movement.
This is a little unrealistic because most geckos probably don't
sidestep, but it makes things easier to implement. This is one
of those cases in which you sometimes have to make sacrifices
in detail for the sake of making the code simpler.
<P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色爱综合网| 中文字幕在线不卡| 亚洲婷婷综合色高清在线| 日韩主播视频在线| 99久久久无码国产精品| 精品国产污网站| 亚洲精品成人少妇| 成人一区二区视频| 精品久久久久久久人人人人传媒 | 在线观看91精品国产入口| 26uuuu精品一区二区| 亚洲国产成人porn| 色88888久久久久久影院野外| 欧美国产乱子伦| 国产麻豆91精品| 久久综合狠狠综合| 精品一区二区三区免费视频| 日韩午夜av一区| 日韩和欧美一区二区三区| 欧美三级视频在线观看| 一区二区三区产品免费精品久久75| 成人性生交大片免费看视频在线| 久久综合色播五月| 激情偷乱视频一区二区三区| 欧美成人精品二区三区99精品| 丝袜脚交一区二区| 6080国产精品一区二区| 亚洲午夜影视影院在线观看| 欧美丝袜丝交足nylons| 亚洲人精品午夜| 91啦中文在线观看| 洋洋av久久久久久久一区| 色噜噜久久综合| 亚洲一区电影777| 欧美日韩和欧美的一区二区| 天天综合天天综合色| 91精品在线麻豆| 国内外精品视频| 国产亚洲短视频| caoporen国产精品视频| 最新国产精品久久精品| 色av一区二区| 日本午夜精品视频在线观看| 精品美女被调教视频大全网站| 国产在线日韩欧美| 国产日韩av一区二区| 91视频免费观看| 亚洲无人区一区| 日韩欧美一区中文| 国产精品影视在线观看| 日韩一区在线免费观看| 在线观看国产91| 久久99精品久久久久久久久久久久 | 一区二区三区精品视频在线| 色就色 综合激情| 污片在线观看一区二区| 欧美成人r级一区二区三区| 国产精品1区2区3区在线观看| 中文字幕一区二区三区视频| 欧美日韩精品欧美日韩精品一综合| 美女视频黄a大片欧美| 久久精品无码一区二区三区| 91麻豆国产在线观看| 视频一区欧美精品| 久久久久久久久97黄色工厂| 在线观看av一区| 国产精品一区二区三区99| 一区二区三区不卡视频| 久久久久久夜精品精品免费| 97se亚洲国产综合自在线观| 美美哒免费高清在线观看视频一区二区 | 奇米影视7777精品一区二区| 久久久国产精品不卡| 欧美在线免费观看亚洲| 国内精品视频666| 亚洲一区二区欧美日韩| 久久久久综合网| 欧美浪妇xxxx高跟鞋交| 粉嫩欧美一区二区三区高清影视| 亚洲一区在线视频| 国产精品色在线观看| 91精品婷婷国产综合久久性色| 丁香五精品蜜臀久久久久99网站 | 日韩欧美在线观看一区二区三区| 97精品久久久午夜一区二区三区| 蜜臀av性久久久久蜜臀aⅴ | 国产精品国产三级国产普通话三级| 欧美日韩成人在线一区| 91香蕉视频在线| 国产成人aaa| 精品综合免费视频观看| 日韩国产欧美在线播放| 亚洲激情自拍视频| 亚洲同性同志一二三专区| 国产偷国产偷亚洲高清人白洁 | 色狠狠一区二区三区香蕉| 国产成人亚洲综合a∨猫咪| 五月激情综合色| 亚洲精品免费电影| 亚洲品质自拍视频| 中文字幕亚洲综合久久菠萝蜜| 久久亚洲一区二区三区四区| 日韩精品一区在线| 欧美一区二区三区白人| 制服丝袜国产精品| 欧美精品自拍偷拍| 欧美三级在线播放| 欧洲亚洲精品在线| 欧美影院一区二区| 欧美色图一区二区三区| 欧美午夜一区二区三区 | 99re这里都是精品| av电影天堂一区二区在线观看| 成人性生交大合| 99精品桃花视频在线观看| 成人午夜激情影院| 99精品久久99久久久久| 91麻豆免费观看| 欧美三级在线视频| 日韩免费视频线观看| 日韩欧美一二区| 精品久久久久久久人人人人传媒| 精品国产91乱码一区二区三区| 久久久久9999亚洲精品| 国产精品久久久久永久免费观看| 国产精品日日摸夜夜摸av| 国产精品国产自产拍高清av王其| 亚洲视频网在线直播| 亚洲一区二区三区四区在线| 天涯成人国产亚洲精品一区av| 婷婷久久综合九色国产成人| 精品一区二区久久久| 高清视频一区二区| 一本大道久久a久久综合| 欧美亚洲一区二区在线观看| 3d动漫精品啪啪1区2区免费 | 亚洲色图在线播放| 亚洲va中文字幕| 国产一区二区在线视频| 成人aaaa免费全部观看| 欧美日韩国产高清一区二区| 日韩精品一区二区三区视频播放 | 成人免费va视频| 欧美性淫爽ww久久久久无| 欧美一区二区人人喊爽| 国产精品国产三级国产aⅴ中文| 亚洲综合激情网| 韩国一区二区在线观看| 色一情一乱一乱一91av| 欧美电影免费观看高清完整版 | 中文字幕不卡一区| 亚洲一区二区三区国产| 国产精品911| 欧美日韩一级视频| 久久综合精品国产一区二区三区| 亚洲欧洲精品一区二区三区不卡| 无吗不卡中文字幕| 99久久精品国产一区二区三区| 91.麻豆视频| 亚洲丝袜另类动漫二区| 久久99精品久久久久久动态图| 99久久精品免费看国产免费软件| 日韩一区二区三区电影在线观看 | 国产欧美精品国产国产专区| 五月综合激情网| www.日韩精品| 久久久美女毛片| 日本少妇一区二区| 色中色一区二区| 国产精品你懂的| 久久99久久久欧美国产| 欧美三级电影网站| 亚洲欧美中日韩| 国产91精品精华液一区二区三区| 欧美一区日本一区韩国一区| 亚洲欧美日韩电影| 国产91精品久久久久久久网曝门| 日韩欧美国产麻豆| 日本v片在线高清不卡在线观看| 国产视频一区二区在线| 日韩成人一区二区| 欧美日韩精品一二三区| 一区二区三区精密机械公司| 国产成人激情av| 久久精品夜色噜噜亚洲a∨| 日韩不卡一区二区三区 | 久久久久国产精品免费免费搜索| 日韩av一级电影| 6080国产精品一区二区| 婷婷国产v国产偷v亚洲高清| 色www精品视频在线观看| 亚洲欧美日韩在线播放| eeuss鲁片一区二区三区| 国产精品久久久久天堂| 成人动漫av在线| 国产精品久久久久久户外露出 | 成人动漫在线一区| 国产精品久久久久三级| 成人免费三级在线| 国产精品国产三级国产专播品爱网 |