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

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

?? ch13.htm

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

<HEAD>
   <TITLE>Chapter 13 -- Scorpion Roundup: Action By Moonlight</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 13</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Scorpion Roundup: Action By Moonlight</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="#DesigningScorpionRoundup" >Designing Scorpion Roundup</A>
<UL>
<LI><A HREF="#Sprites" >Sprites</A>
<LI><A HREF="#GamePlay" >Game Play</A>
<LI><A HREF="#Options" >Options</A>
</UL>
<LI><A HREF="#SampleAppletScorpionRoundup" >Sample Applet: Scorpion Roundup</A>
<UL>
<LI><A HREF="#TheSpriteClasses" >The Sprite Classes</A>
<LI><A HREF="#TheScorpionRoundupClass" >The ScorpionRoundup 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>
Yesterday you saw how sound is supported in Java. You also wrote
a fairly simple applet to demonstrate how sound can be used in
a creative way. Today you go a step further by creating your second
complete game, including sound effects and music. The entire lesson
today is devoted to the design and development of this game, which
will provide you with another invaluable Java game creation experience.
<P>
The game you develop today is called Scorpion Roundup, and it
uses the all too familiar sprite classes to implement its animation
and sprite interactions. It uses the <TT>AudioClip</TT>
class you learned about in yesterday's lesson to represent both
sound effects and music. Unlike the Traveling Gecko game you developed
a few days ago, which used the keyboard exclusively for user input,
Scorpion Roundup uses the mouse as the user input device. You'll
see why when you get into the game.
<P>
The following topics are covered in today's lesson:
<UL>
<LI>Designing Scorpion Roundup
<LI>Sample applet: Scorpion Roundup
</UL>
<H2><A NAME="DesigningScorpionRoundup"><B><FONT SIZE=5 COLOR=#FF0000>Designing
Scorpion Roundup</FONT></B></A></H2>
<P>
Unlike Traveling Gecko, Scorpion Roundup isn't directly modeled
after any other game. Before getting into how the game plays,
you need some background on the premise surrounding the game,
because it is based on a very real concept that is pretty interesting.
<P>
Scorpions are fairly popular as pets. Not quite as popular as
dogs or cats, but what do you expect? They are also useful in
captivity for retrieving their poison, which is used in developing
antivenin medicine for people and pets stung by them. They are
also used to make souvenirs; just visit Sky Harbor Airport in
Phoenix, Arizona, and you'll see plenty of scorpions frozen in
plastic in the gift shops. The point here is that there are a
variety of human uses for scorpions. And where there's a demand,
there's a supply. This means that someone has to take on the job
of heading out into the desert and catching the rascals.
<P>
Catching a scorpion isn't as easy as you might think, though.
They are nocturnal creatures, so they only come out at night.
The thought of taking off into the desert at night might not appeal
to everyone, but conquering your fear of the dark desert isn't
the only hurdle when hunting for scorpions: It's hard to find
them at night! One of those brave souls that head into the darkness
in search of scorpions figured out a neat approach to finding
scorpions in the dark-using a black light. Black lights give off
a greenish glow that illuminates certain objects, including scorpions.
Therefore, to catch scorpions you simply head out into the darkness
with a black light and a net. That's the premise of the Scorpion
Roundup game. You're a scorpion hunter armed with a net, working
within a landscape illuminated by a black light that shows the
scorpions with their greenish glow.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Warning</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Real scorpions are caught by real professionals. For your own safety, I suggest only trying to catch the Java scorpions you meet in today's lesson!</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Based on this description of the game, you might already see why
the mouse is the ideal input device for the game. This is because
you are controlling a net, which is a hand-held object in real
life. The best way to handle controlling a net with the mouse
is to make the net a sprite. You also need a scorpion sprite to
model the scorpions that you are trying to catch.
<P>
At this point, the game is defined enough to move into more specifics.
Let's start by taking a look at the sprites in more detail.
<H3><A NAME="Sprites"><B>Sprites</B></A></H3>
<P>
You've established that the game requires two types of sprites
for modeling the net and the scorpions. You also know that the
net sprite is to be controlled by the mouse. Basically, all you
need the net sprite to do is follow the mouse around, which requires
very basic sprite movement. Based on this requirement of the net
sprite, it doesn't sound like you need to use a derived class
for it; you don't need any functionality beyond that provided
in the base <TT>Sprite</TT> class.
This is a correct assumption because deriving a new class is usually
only necessary when you need to add new functionality.
<P>
This means that Scorpion Roundup really only needs one derived
sprite class: the <TT>Scorpion</TT>
sprite class. What should this sprite do? To make the game a little
more simple to implement, let's limit the scorpion sprites to
traveling in horizontal directions only. The scorpions can run
in either the left or right direction, which means that they can
also face in either the left or right direction. You're probably
thinking that the directional sprite you developed last week might
work well here. Unfortunately, it won't work in this case because
it was specifically designed for sprites having exactly eight
directions; the scorpions in Scorpion Roundup only have two directions
(left and right).
<P>
The scorpion sprite needs to be frame animated so that the scorpions
look like they are moving their legs and running. You've also
established that the sprite needs two directions. Anything else?
Actually, there is one other thing. The goal of the game is to
catch as many scorpions as possible. However, you haven't established
how a game is lost; the game has no negative result when you don't
catch any scorpions. One solution is to have the scorpions get
away when they reach the other side of the screen, rather than
wrapping around. Furthermore, you could track how many scorpions
get away and end the game when a certain number of them escape.
The only place to determine when a scorpion has made it across
is within the <TT>Scorpion</TT> class.
Therefore, the <TT>Scorpion</TT> class
needs some method of determining when a scorpion has escaped and
modifying a value accordingly.
<H3><A NAME="GamePlay"><B>Game Play</B></A></H3>
<P>
Now that you understand how the sprites work in the game, let's
move on to the specifics of the game itself. You've established
that the goal of the game is to use a net to catch scorpions that
are running across the screen. You lose the game when you miss
a certain number of scorpions. You never really win; you just
try to catch as many scorpions as possible.
<P>
One thing you haven't covered is how the player is to be challenged
as the game goes on. Few games remain fun without increasing the
challenge as the play progresses, and Scorpion Roundup is no different.
The easiest way to make the game harder is to speed up the scorpions
themselves. You could also increase the speed at which the scorpions
are created; more scorpions on the screen at a time mean more
work for the player.
<P>
How do you establish when to increase the difficulty of the game?
Well, you could just do it behind the scenes based on time or
on how many scorpions have been caught. I like the latter approach
because it directly increases the difficulty based on the performance
of the player. The only catch is that most game players like to
know when they have progressed to another difficulty level. This
is easy enough to accommodate; just display the current level
along with the number of scorpions caught and lost. You then increment
the difficulty level when a certain number of scorpions have been
caught.
<H3><A NAME="Options"><B>Options</B></A></H3>
<P>
That wraps up the play aspects of the game, but you should consider
a few other small issues related to how the player controls the
game. The first one is how to start a new game. You might recall
that the Traveling Gecko game you developed a few days ago used
a New Game button to start new games. That approach was fine in
Traveling Gecko because the button was drawn on top of one of
the rocks. In Scorpion Roundup, the game appearance would suffer
more by having a button drawn on top of everything. The easy way
around starting a new game without using a button is to simply
allow the player to start a game with a certain key press, such
as the N key.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
You actually could use buttons without covering up any of the game area by using an awt <TT>Canvas</TT> object as the game area, rather than the applet window. This is a good way to handle sharing the applet window between user interface controls and the 
game area, but it involves more complexity. I didn't want this added complexity to make the game implementation more difficult to understand.
</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
The only other issue in Scorpion Roundup that needs to be addressed
is music. Because the game uses looped music, it would be nice
for the player to be able to easily turn it on and off. Using
the keyboard approach again, the M key makes perfect sense as
a music toggle key.
<P>
That wraps up the design phase for Scorpion Roundup. Hopefully,
you're now anxious to dive into the details of implementing all
these cool ideas to build a real game!
<H2><A NAME="SampleAppletScorpionRoundup"><B><FONT SIZE=5 COLOR=#FF0000>Sample
Applet: Scorpion Roundup</FONT></B></A></H2>
<P>
The Scorpion Roundup applet is your second fully functional Java
game and shows off the sound skills you developed in yesterday's
lesson. Figure 13.1 shows a screen shot of a fast and furious
game of Scorpion Roundup. The complete source code, executable,
images, and sounds for Scorpion Roundup are located on the accompanying
CD-ROM.
<P>
<A HREF="f13-1.gif" ><B>Figure 13.1 :</B> <I>The Scopion Roundup sample applet in action.</I></A>
<P>
Scorpion Roundup begins by creating the net sprite, which you
can move around the play area with the mouse. Scorpions then begin
to run across the screen. If you click on a scorpion with the
net, you hear a sound indicating that you got him. If you miss,
you hear a sound of the net swishing through the air. All the
while, the music is playing in the background.
<P>
The current difficulty level is displayed in the upper left corner
of the screen, along with the number of scorpions caught and lost.
The level is incremented and a cheering sound is played each time
you catch 15 new scorpions. The scorpions start running faster
and appearing quicker with each increasing difficulty level.
<P>
If you let five scorpions get away, the game ends and you see
a <TT>Game Over</TT> message. Figure
13.2 shows Scorpion Roundup right after the game ends.
<P>
<A HREF="f13-2.gif" ><B>Figure 13.2 : </B><I>A Scorpion Roundup game that has come to an end.</I></A>
<P>
At this point, you can simply press the N key to start a new game.
If you haven't run Scorpion Roundup yet, please load the CD-ROM
and try it out. If you're not the type that responds well to the
word &quot;please,&quot; then by all means skip playing the game
and read on!
<H3><A NAME="TheSpriteClasses"><B>The Sprite Classes</B></A></H3>
<P>
The only derived <TT>Sprite</TT> class
used in Scorpion Roundup is the <TT>Scorpion</TT>
class, which models a horizontally running scorpion. Listing 13.1
shows the source code for the <TT>Scorpion</TT>
class.
<HR>
<BLOCKQUOTE>
<B>Listing 13.1. The </B><TT><B><FONT FACE="Courier">Scorpion</FONT></B></TT><B>
class.<BR>
</B>
</BLOCKQUOTE>
<BLOCKQUOTE>
<TT>public class Scorpion extends Sprite
{<BR>
&nbsp;&nbsp;public static Image[][] image;<BR>
&nbsp;&nbsp;private static Random&nbsp;&nbsp; rand = new Random(System.currentTimeMillis());
<BR>
<BR>
&nbsp;&nbsp;public Scorpion(Component comp, int dir, int speedInc)
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;super(comp, image[dir], 0, 1, 1, new Point((dir
== 0) ?<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(comp.size().width - image[dir][0].getWidth(comp))
: 0,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;60 + Math.abs(rand.nextInt()
% 5) * 44), new Point((dir == 0)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;? (-5 - speedInc) : (5 + speedInc),
0), 10,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sprite.BA_DIE);<BR>
&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;public static void initResources(Applet app, MediaTracker
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;tracker, int id) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;image = new Image[2][2];<BR>
&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 0; i &lt; 2; i++)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int j = 0; j &lt; 2;
j++) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image[i][j] =
app.getImage(app.getCodeBase(),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Res/Scorp&quot;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色成年激情久久综合| 国产精品亚洲一区二区三区在线| 欧美成人精品福利| 成人动漫一区二区三区| 性做久久久久久免费观看欧美| 久久免费精品国产久精品久久久久 | 2024国产精品| 91日韩精品一区| 国产精品国产三级国产| 成人免费毛片aaaaa**| 日本在线不卡视频一二三区| 亚洲欧美区自拍先锋| 欧美国产日韩a欧美在线观看| 欧美一区二区不卡视频| 精品视频在线视频| 91久久精品一区二区三| 成人动漫中文字幕| 不卡一二三区首页| 99热国产精品| 91亚洲精华国产精华精华液| 成人午夜在线播放| 国产精品91一区二区| 国产激情精品久久久第一区二区| 亚洲一区二区欧美激情| 一区二区三区日韩精品| 中文字幕乱码一区二区免费| 国产日韩欧美高清| 国产欧美一区二区精品性色超碰| 欧美成人国产一区二区| 中文字幕一区二区三区精华液| 国产喂奶挤奶一区二区三区| 国产午夜一区二区三区| 国产丝袜欧美中文另类| 国产精品久久久久久久第一福利| 中文字幕欧美日韩一区| 亚洲免费观看在线视频| 亚洲图片一区二区| 精品一区二区在线免费观看| 国产综合久久久久久久久久久久 | 日本不卡高清视频| 黑人巨大精品欧美黑白配亚洲| 狠狠v欧美v日韩v亚洲ⅴ| 99这里只有精品| 日韩一本二本av| 亚洲免费观看高清完整版在线观看熊 | 不卡的av在线播放| 在线观看一区不卡| 久久精品视频在线免费观看| 中文字幕一区在线观看| 免费看日韩a级影片| 成人动漫一区二区在线| 91精品欧美综合在线观看最新| 久久精品亚洲麻豆av一区二区 | 成熟亚洲日本毛茸茸凸凹| 91在线视频播放地址| 欧美精品一区二区三区高清aⅴ| 自拍偷拍亚洲欧美日韩| 日日夜夜免费精品视频| www.日韩av| 国产精品色哟哟网站| 麻豆精品一二三| 国产精品资源网站| 国产成人夜色高潮福利影视| 91成人网在线| 国产精品久久久久久久浪潮网站| 免费在线观看视频一区| 欧美专区日韩专区| 国产精品美日韩| 成人激情黄色小说| 国产精品久久久久一区二区三区共| 麻豆91小视频| 欧美一区二区三区人| 丝袜诱惑亚洲看片| 欧美精品一二三| 亚洲va欧美va国产va天堂影院| 99精品桃花视频在线观看| 国产视频911| 成人免费观看av| 日韩毛片视频在线看| 97国产一区二区| 亚洲男人天堂av| 欧美性生交片4| 日韩高清不卡一区二区三区| 91麻豆精品国产91久久久资源速度| 无码av中文一区二区三区桃花岛| 欧美日韩免费观看一区二区三区| 亚洲猫色日本管| 欧美另类久久久品| 美腿丝袜亚洲一区| 国产欧美一区二区精品婷婷| 99国产精品久久久久| 亚洲成a人片在线观看中文| 欧美一区二区成人6969| 北岛玲一区二区三区四区| 亚洲蜜桃精久久久久久久| 日韩三区在线观看| 丰满放荡岳乱妇91ww| 亚洲成人精品影院| 精品成人免费观看| 91在线视频免费91| 精品无人码麻豆乱码1区2区 | 精一区二区三区| 亚洲人成影院在线观看| 欧美一区二区三区四区高清| 成人一区二区三区在线观看| 午夜影院在线观看欧美| 国产精品久久久久永久免费观看 | 国产福利精品一区二区| 亚洲一区二区欧美日韩 | 亚洲视频香蕉人妖| 精品国产第一区二区三区观看体验| 99re成人精品视频| 国产经典欧美精品| 精品一区二区三区在线播放| 亚洲动漫第一页| 玉足女爽爽91| 亚洲精品五月天| 国产精品动漫网站| 国产精品嫩草久久久久| 久久久精品免费观看| 欧美刺激午夜性久久久久久久| 欧美日韩色一区| 欧美区一区二区三区| 宅男噜噜噜66一区二区66| 欧美群妇大交群的观看方式| 欧美伦理视频网站| 日韩一卡二卡三卡国产欧美| 青青草精品视频| 国产精品视频一二| 国产精品视频一二三| 中文字幕欧美激情| 国产精品高潮久久久久无| 中文av一区二区| 一区二区三区四区亚洲| 亚洲综合色丁香婷婷六月图片| 亚洲黄色小视频| 美女一区二区三区在线观看| 狠狠色狠狠色合久久伊人| 国产精品综合二区| 91在线观看高清| 6080午夜不卡| 国产片一区二区| 亚洲成人手机在线| 国产精选一区二区三区| 91网站在线播放| 欧美一级在线视频| 国产精品无人区| 午夜视频一区在线观看| 国产精品123| 91精品国产综合久久精品| 国产午夜亚洲精品午夜鲁丝片| 国产精品国产a级| 美女视频黄久久| 在线精品视频一区二区| 欧美国产精品一区二区| 丝瓜av网站精品一区二区| 粉嫩一区二区三区在线看| 欧美一区欧美二区| 一区二区三区在线观看动漫| 国产资源精品在线观看| 欧美日韩国产免费| 亚洲欧美日韩中文字幕一区二区三区 | 亚洲综合免费观看高清完整版 | 欧美一级专区免费大片| 亚洲色图另类专区| www.综合网.com| 国产午夜精品一区二区| 老色鬼精品视频在线观看播放| 欧美性大战xxxxx久久久| 亚洲人成网站在线| 成人理论电影网| 久久久久久久久久久99999| 欧美aaaaaa午夜精品| 欧美日韩aaaaaa| 日本欧美在线观看| 日韩午夜精品视频| 美女视频网站久久| 精品国产麻豆免费人成网站| 美国av一区二区| 久久在线免费观看| 国产乱色国产精品免费视频| 久久天天做天天爱综合色| 国产精品12区| 中文字幕人成不卡一区| 欧美中文字幕一二三区视频| 亚洲午夜激情网站| 欧美一卡2卡三卡4卡5免费| 激情久久久久久久久久久久久久久久| 欧美一区二区三区四区在线观看| 免费成人美女在线观看| 久久久噜噜噜久久中文字幕色伊伊 | av在线播放不卡| 午夜激情综合网| 久久久久一区二区三区四区| 91色porny蝌蚪| 麻豆精品在线播放| 亚洲精品成人少妇| 精品国产乱码久久久久久免费| 99久久精品费精品国产一区二区| 亚洲国产成人av网|