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

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

?? ch10.htm

?? 有關于游戲開發的教程我閱讀后感覺不錯所以就拿出來與大家共享。
?? 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国产精品国产精品久久| 风间由美一区二区三区在线观看 | 欧美午夜一区二区三区| 精品视频1区2区3区| 欧美一区二区三区公司| 欧美韩日一区二区三区| 亚洲一区二区不卡免费| 精品一区中文字幕| av在线不卡网| 欧美大片顶级少妇| 亚洲欧洲性图库| 奇米精品一区二区三区在线观看一| 国产精品一品视频| 在线免费观看视频一区| 欧美精品一区二区三区久久久 | 日本韩国欧美三级| 日韩欧美美女一区二区三区| 国产精品久久久久久久蜜臀 | 精品女同一区二区| 一区二区三区在线视频观看| 国模娜娜一区二区三区| 91国偷自产一区二区三区观看| 日韩免费在线观看| 亚洲欧洲综合另类| 国产乱一区二区| 欧美乱熟臀69xxxxxx| 国产精品妹子av| 美日韩黄色大片| 日本精品裸体写真集在线观看| 国产日韩欧美制服另类| 日本亚洲天堂网| 色综合天天综合网天天狠天天 | 99视频精品在线| 精品国产污网站| 爽好久久久欧美精品| 91网址在线看| 国产片一区二区三区| 久久成人免费网| 欧美日韩一区视频| 亚洲人精品午夜| 国产suv精品一区二区883| 日韩一区二区在线免费观看| 亚洲精品v日韩精品| 成人激情黄色小说| 亚洲精品在线电影| 久久精品国产澳门| 日韩欧美自拍偷拍| 日本三级亚洲精品| 欧美日韩一卡二卡三卡| 亚洲精品成人悠悠色影视| www.日本不卡| 中文字幕av一区二区三区免费看 | 亚洲精品v日韩精品| 成人av网在线| 亚洲国产高清在线观看视频| 国产精选一区二区三区| 日韩欧美国产成人一区二区| 日韩不卡一区二区三区| 欧美裸体一区二区三区| 亚洲国产视频一区| 色香色香欲天天天影视综合网| 国产精品护士白丝一区av| 国产不卡在线一区| 国产亚洲精品超碰| 国产伦精品一区二区三区视频青涩 | 18欧美亚洲精品| 成人小视频免费在线观看| 久久老女人爱爱| 国产一区二区三区av电影 | 国产jizzjizz一区二区| 国产无人区一区二区三区| 国产精品亚洲一区二区三区妖精| 精品国产凹凸成av人网站| 久久99国产乱子伦精品免费| 欧美成人a在线| 精品一区二区三区在线观看国产 | 不卡在线观看av| 亚洲婷婷在线视频| 欧洲视频一区二区| 午夜精品久久久久久久久久久| 欧美日韩一卡二卡| 蜜桃一区二区三区在线观看| 日韩欧美成人一区| 国产河南妇女毛片精品久久久| 欧美国产日韩a欧美在线观看 | 五月婷婷激情综合网| 91精品一区二区三区久久久久久| 免费成人在线影院| 26uuu国产电影一区二区| 国产成人在线观看| 亚洲女女做受ⅹxx高潮| 欧美日韩国产另类不卡| 久久精品国产一区二区三| 国产无人区一区二区三区| 91丨国产丨九色丨pron| 亚洲夂夂婷婷色拍ww47| 91精品久久久久久久久99蜜臂| 九一久久久久久| 中文字幕一区二区三区av| 欧美午夜精品久久久久久孕妇| 强制捆绑调教一区二区| 国产女人aaa级久久久级| 99re视频这里只有精品| 日本欧美在线看| 国产日韩精品一区| 欧美在线一二三| 精品亚洲欧美一区| 成人欧美一区二区三区| 欧美日本一区二区三区四区| 国产一区二区视频在线| 亚洲伦理在线免费看| 欧美一级二级三级蜜桃| 夫妻av一区二区| 日韩激情视频在线观看| 亚洲国产精品成人久久综合一区| 欧美日韩国产在线观看| 国产精华液一区二区三区| 亚洲精品国产精华液| 精品日韩欧美一区二区| 91美女精品福利| 国产揄拍国内精品对白| 一区二区三区自拍| 精品免费一区二区三区| 91福利在线看| 国产成人一区二区精品非洲| 五月天精品一区二区三区| 国产亲近乱来精品视频| 91精品国产手机| 91网站在线观看视频| 青草av.久久免费一区| 亚洲欧美激情在线| 精品粉嫩超白一线天av| 欧美日韩精品一区二区三区四区| 成人免费电影视频| 蜜桃一区二区三区在线| 一区二区三区四区亚洲| 久久九九国产精品| 91麻豆精品国产91久久久久久| 99精品热视频| 国产精品一色哟哟哟| 日本vs亚洲vs韩国一区三区 | 欧美日韩dvd在线观看| 不卡视频在线观看| 国产在线日韩欧美| 日韩精品一二三四| 亚洲欧美日韩精品久久久久| 久久夜色精品国产欧美乱极品| 欧美日韩国产在线观看| 色偷偷成人一区二区三区91| 国产黄色精品网站| 韩国精品在线观看| 秋霞午夜鲁丝一区二区老狼| 亚洲激情自拍视频| 国产精品少妇自拍| 久久精品夜色噜噜亚洲aⅴ| 日韩天堂在线观看| 欧美日韩一区二区三区四区| 99精品黄色片免费大全| 欧美一级精品大片| 欧美三级三级三级爽爽爽| 一本色道久久综合亚洲aⅴ蜜桃| 国产成人精品一区二区三区四区| 久久精品国产99国产精品| 日韩激情中文字幕| 日韩电影在线一区| 亚洲一本大道在线| 一区二区三区日韩精品视频| 国产欧美日韩三区| 国产午夜亚洲精品不卡| 国产亚洲一区二区三区在线观看 | 福利电影一区二区| 国产激情一区二区三区四区| 激情文学综合网| 国内一区二区在线| 激情六月婷婷久久| 激情综合五月天| 国产真实乱子伦精品视频| 精品午夜一区二区三区在线观看| 六月丁香婷婷久久| 精品一区二区三区视频| 麻豆精品久久精品色综合| 美脚の诱脚舐め脚责91| 久久99精品网久久| 激情综合色综合久久| 精品在线观看免费| 国产一区在线不卡| 国产xxx精品视频大全| 成人国产视频在线观看| 99久久夜色精品国产网站| 91网站黄www| 欧美伊人久久大香线蕉综合69 | 经典三级视频一区| 国产综合成人久久大片91| 国产成人精品免费看| 福利一区福利二区| 色94色欧美sute亚洲线路二| 欧美日韩一区成人| 欧美成人一区二区三区| 久久久www成人免费毛片麻豆| 欧美激情一区二区三区|