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

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

?? ch3.htm

?? 有關于游戲開發的教程我閱讀后感覺不錯所以就拿出來與大家共享。
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
The main character class would maintain information such as life
points and any items picked up during the game, such as weapons,
lanterns, keys, and so on. The character class would have methods
for moving in different directions based on the player's input.
The items carried by the character also would be objects. The
lantern class would contain information such as how much fuel
is left and whether the lantern is on or off. The lantern would
have methods for turning it on and off, which would cause it to
use up fuel.
<P>
There would be a general creature class from which all creatures
would be derived. This creature class would contain information
such as life points and how much damage the creature inflicts
when fighting. It would have methods for moving in different directions.
Unlike the character class, however, the creature's move methods
would be based on some type of intelligence programmed into the
creature class. The mean creatures might always go after the main
character if they are on the same screen together, for example,
but passive creatures might just ignore the main character. Derived
creature classes would add extra attributes, such as the capability
to swim or fly. Figure 3.4 shows the class hierarchy for this
hypothetical game.
<P>
<A HREF="f3-4.gif" ><B>Figure 3.4 : </B><I>Class hierarchy for a hypothetical adventure game.</I></A>
<P>
I've obviously left out a lot of detail in the descriptions of
these hypothetical objects. This is intentional because I want
to highlight the benefit of the object approach, not the details
of fully implementing a real example. Although you already might
see the benefits of the object design so far, the real gains come
when you put all the objects together in the context of the complete
game.
<P>
After you have designed all the object classes, you just create
objects from them and let them go. You already will have established
methods that enable the objects to interact with each other, so
in a sense the game world is autonomous. The intelligence of any
object in the game is hidden in the object implementation, so
no external manipulation is required of them. All you really must
do is provide a main game loop that updates everything. Each object
would have some method for updating its status. For creatures,
this update would entail determining the direction in which to
move and whether they should attack. For the main character object,
an update would involve performing an action based on the user
input. The key point to understand here is that the objects are
independent entities that know how to maintain themselves.
<P>
Of course, this game also could be designed using a procedural
approach, but then there would be no concept of an object linked
with its actions. You would have to model the objects as data
structures and then have a bunch of functions that act on those
structures. No function would be more associated with a particular
data structure than any other. And more importantly, the data
structures would know nothing about the functions. You also would
lose all the benefits of deriving similar objects from a common
parent object. This means that you would have duplicate code for
all these types of objects that would have to be maintained independently.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Procedural programming is the precursor to object oriented programming. In procedural programming, the focus to solving programmatic problems is on using blocks of code called procedures that independently act on data. This is in direct contrast to object 
oriented programming, in which procedures and data are combined in a single unit: the object.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
A more dramatic benefit of using OOP becomes apparent when you
develop new games in the future. By following an OOP design in
the first game, you will be able to reuse many of the objects
for new games. This is not just a side effect of using OOP techniques,
it is a fundamental goal of OOP design. Although you can certainly
cut and paste code in a procedural approach, this hardly compares
to reusing and deriving from entire objects. As an example, the
creature class developed in the hypothetical adventure game could
be used as a base class for any kind of creature object, even
those in other games.
<P>
Although this example is brief, it should illustrate the advantages
of using an OOP design for games. If nothing else, I wanted to
at least get you thinking about how OOP design techniques can
make games easier to develop, which ultimately makes your job
more fun!
<P>
The good news about all this OOP stuff is that Java is designed
from the ground up as an OOP language. As a matter of fact, you
don't even have the option of writing procedural code in Java.
Nevertheless, it still takes effort to maintain a consistent OOP
approach when you are writing Java games, which is why I've spent
so much time today discussing OOP theory.
<H2><A NAME="JavaandOtherOOPLanguages"><B><FONT SIZE=5 COLOR=#FF0000>Java
and Other OOP Languages</FONT></B></A></H2>
<P>
You've learned that OOP has obvious advantages over procedural
approaches, especially when it comes to games. OOP was conceived
from the ground up with the intention of sim-ulating the real
world. However, in the world of game programming, the faster language
has traditionally always won. This is evident by the amount of
assembly language still being written in the commercial game-development
community. No one can argue the fact that carefully written assembly
language is faster than C, and that even more carefully written
C is sometimes faster than C++. And unfortunately, Java ranks
a distant last behind all these languages in terms of efficiency
and speed.
<P>
However, the advantages of using Java to write games stretch far
beyond the speed benefits provided by these faster languages.
This doesn't mean that Java is poised to sweep the game community
as the game development language of choice; far from it! It means
that Java provides an unprecedented array of features that scale
well to game development. The goal for Java game programmers is
to write games in the present within the speed limitations of
Java, while planning games for the future that will run well when
faster versions of Java are released.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
In fact two separate speed issues are involved in Java game programming. The first is the issue of the speed of the Java language and runtime environment which will no doubt improve as better compilers and more efficient versions of the runtime environment 
are released. The second issue is that of Internet connection speed which is limited by the speed of the modem or physical line used to connect to the Internet. Both of these issues are important but they impact Java games in different ways: The first 
speed limitation affects how fast a game runs while the second limitation affects how fast a game loads.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Due to languages such as Smalltalk, which treats everything as
an object (an impediment for simple problems), and their built-in
memory-allocation handling (a sometimes very slow process), OOP
languages have developed a reputation for being slow and inefficient.
C++ remedied this situation in many ways but brought with it the
pitfalls and complexities of C, which are largely undesirable
in a distributed environment such as the Internet. Java includes
many of the nicer features of C++, but incorporates them in a
more simple and robust language.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
For more information about exactly how Java improves C++ see appendix C &quot;Differences Between Java and C/C++.&quot;</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
The current drawback to using Java for developing games is the
speed of Java programs, which is significantly slower than C++
programs because Java programs execute in an interpreted fashion.
The just-in-time compilation enhancements promised in future versions
of Java should help remedy this problem. You learn about some
optimization techniques to help speed up Java code near the end
of this book on <A HREF="ch20.htm" >Day 20</A>, &quot;Optimizing
Java Code for Games.&quot;
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Currently, Java programs are interpreted, meaning that they go through a conversion process as they are being run. Although this interpreted approach is beneficial because it allows Java programs to run on different types of computers, it greatly affects 
the speed of the programs. A promising solution to this problem is just in time compilation, which is a technique in which a Java program is compiled into an executable native to a particular type of computer before being run.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Today, Java is still not ready for prime time when it comes to
competing as a game programmer's language. It just isn't possible
yet in the current release of Java to handle the high-speed graphics
demanded by commercial games. To alleviate this problem, you have
the option of integrating native C code to Java programs. This
might or might not be a workable solution, based on the particular
needs of a game.
<P>
Regardless of whether Java can compete as a high-speed gaming
language, it is certainly capable of meeting the needs of many
other types of games that are less susceptible to speed restrictions.
The games you develop throughout this book are examples of the
types of games that can be developed in the current release of
Java.
<H2><A NAME="Summary"><B><FONT SIZE=5 COLOR=#FF0000>Summary</FONT></B></A>
</H2>
<P>
Today you learned about object-oriented programming and how it
relates to Java. You saw that the concept of an object is at the
heart of the OOP paradigm and serves as the conceptual basis for
all Java code design. You also found out exactly what an object
is, along with some of the powerful benefits of following an object-centric
design approach.
<P>
You learned in today's lesson how OOP design principles can be
applied to games. Games are a very natural application of OOP
strategies, because they typically resemble simulations. You then
learned that OOP game programming in Java is not without its drawbacks.
Execution speed is often the killer in game programming, and Java
game programming is no exception. However, future enhancements
to Java should lessen the performance gap between Java and other
popular OOP languages such as C++.
<P>
Now that the conceptual groundwork for Java game programming has
been laid, you are ready to move on to more specific game programming
issues. To be exact, you now are ready to learn about the basics
of using graphics in games, which are covered in tomorrow's lesson.
<H2><A NAME="QA"><B><FONT SIZE=5 COLOR=#FF0000>Q&amp;A</FONT></B></A>
<BR>
</H2>

<TABLE>
<TR VALIGN=TOP><TD WIDTH=50><B>Q</B></TD><TD><B>What is an object-oriented language?</B>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=50><B>A</B></TD><TD>A language that supports the concept of an object, which is the merger of data and methods into a logically single element. Furthermore, object-oriented languages typically support features such as 
encapsulation, inheritance, and polymorphism, which combine to encourage code reuse.
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=50><B>Q</B></TD><TD><B>What is the difference between a class and an object?</B>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=50><B>A</B></TD><TD>A class is a blueprint, or template, that defines the data and methods necessary to model a &quot;thing.&quot; An object is an instance of a class that exists in the computer's memory and can be interacted with 
much like a &quot;thing&quot; in the real world. You can create as many objects from a single class as memory will allow.
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=50><B>Q</B></TD><TD><B>What's the difference between a message and a method?</B>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=50><B>A</B></TD><TD>Nothing, really. &quot;Sending a message&quot; is another way of saying &quot;calling a method&quot; and is often used in more general OOP discussions.
</TD></TR>
</TABLE>
<H2><A NAME="Workshop"><B><FONT SIZE=5 COLOR=#FF0000>Workshop</FONT></B></A>
</H2>
<P>
The Workshop section provides questions and exercises to help
solidify the material you learned today. Try to answer the questions
and at least study the exercises before moving on to tomorrow's
lesson. You'll find the answers to the questions in appendix A,
&quot;Quiz Answers.&quot;
<H3><A NAME="Quiz"><B>Quiz</B></A></H3>
<OL>
<LI>What is an object?
<LI>What is encapsulation?
<LI>Why is implementation hiding important?
<LI>What is the major problem with Java in regard to game programming?
</OL>
<H3><A NAME="Exercises"><B>Exercises</B></A></H3>
<OL>
<LI>Develop a class hierarchy for a game idea of your own, similar
to the one created for the hypothetical adventure game.
<LI>Play some computer games, paying particular attention to how
they can each be broken down into groups of objects.
<LI>If you are a C or C++ programmer new to Java, read appendix
C, &quot;Differences Between Java and C/C++.&quot;
</OL>
<P>
<HR WIDTH="100%"></P>

<CENTER><P><A HREF="ch2.htm"><IMG SRC="pc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="index.htm"><IMG SRC="hb.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="#CONTENTS"><IMG SRC="cc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="ch4.htm"><IMG 
SRC="nc.gif" BORDER=0 HEIGHT=88 WIDTH=140></A></P></CENTER>

<P>
<HR WIDTH="100%"></P>

</BODY>
</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美丰满嫩嫩电影| 日韩精品一区二区三区在线观看 | 欧美激情资源网| 在线看日本不卡| 激情文学综合网| 亚洲精品水蜜桃| 亚洲一区二区三区自拍| 精品国产凹凸成av人网站| 亚洲人123区| 成人午夜碰碰视频| 美洲天堂一区二卡三卡四卡视频 | 国产iv一区二区三区| 欧美精品一二三| av资源网一区| 三级久久三级久久久| 欧美无砖砖区免费| 日本不卡一二三| 精品精品欲导航| 亚洲精品国产视频| 欧美伊人久久大香线蕉综合69| 色综合色综合色综合| 国产综合色视频| 蜜桃一区二区三区在线| 欧洲生活片亚洲生活在线观看| 精品一区二区三区的国产在线播放| 欧美精品色综合| 99国产麻豆精品| 欧美二区三区的天堂| 95精品视频在线| 免费高清视频精品| 亚洲国产欧美在线| **网站欧美大片在线观看| 亚洲国产成人午夜在线一区| 久久青草欧美一区二区三区| 精品国产一区二区三区不卡| 欧美一二三四区在线| 久久99九九99精品| 欧美电影免费提供在线观看| 国产精品系列在线观看| 国产精品系列在线观看| 国产一区91精品张津瑜| 国产精品视频麻豆| 国产成人综合自拍| 国产欧美日韩在线视频| a级精品国产片在线观看| 午夜伊人狠狠久久| 欧美三级蜜桃2在线观看| 91免费视频网址| 精品国产91久久久久久久妲己| 欧美电影一区二区| 日韩一区二区在线播放| 日韩一区二区三区免费看| 99久久综合色| 日韩电影免费在线| 久久99国产精品麻豆| 国产精品主播直播| 成人午夜激情影院| 欧美日韩一区二区三区在线看| 91精品午夜视频| 色婷婷精品久久二区二区蜜臂av| 欧美日韩国产另类不卡| 久久综合久久综合九色| 欧美三片在线视频观看| 日本亚洲电影天堂| 国产亚洲一区二区在线观看| 亚洲欧美色一区| 一区免费观看视频| 日韩欧美一区电影| 色香色香欲天天天影视综合网| 亚洲第一成年网| 三级影片在线观看欧美日韩一区二区| 成人91在线观看| 中文在线资源观看网站视频免费不卡 | 亚洲一二三级电影| 色婷婷综合五月| 亚洲精品五月天| 欧美亚洲动漫另类| 欧美私人免费视频| xf在线a精品一区二区视频网站| 国产精品三级视频| eeuss鲁片一区二区三区 | 91网站在线播放| 一本色道**综合亚洲精品蜜桃冫| 欧美日韩激情一区二区| 久久综合中文字幕| 精品中文字幕一区二区| 精品国产一二三| 狠狠狠色丁香婷婷综合久久五月| 欧美成人精品福利| 国产盗摄精品一区二区三区在线 | 亚洲欧美日韩国产手机在线| eeuss鲁片一区二区三区| 欧洲人成人精品| 日韩精品成人一区二区在线| 日韩久久久久久| 国产美女在线精品| 欧美精品视频www在线观看| 免费高清成人在线| 欧美草草影院在线视频| 国产区在线观看成人精品| 亚洲欧洲三级电影| 制服视频三区第一页精品| 欧美日韩激情一区二区三区| 奇米精品一区二区三区四区| 日韩女优av电影| jlzzjlzz亚洲女人18| 午夜精品视频一区| 国产日韩欧美精品电影三级在线| 91影视在线播放| 精品国产91九色蝌蚪| 成人小视频在线| 日韩av一区二| 国产精品电影一区二区三区| 欧美视频你懂的| 国产福利电影一区二区三区| 一区二区三区四区av| 久久伊99综合婷婷久久伊| 91传媒视频在线播放| 国产乱人伦偷精品视频不卡| 久久久久久久国产精品影院| 亚洲va欧美va国产va天堂影院| 日本伊人午夜精品| 国产精品美女久久久久aⅴ| 欧美中文字幕一区| 粉嫩av一区二区三区| 日本女人一区二区三区| 一区二区三区色| 国产欧美日韩在线看| 精东粉嫩av免费一区二区三区| 亚洲嫩草精品久久| 91成人在线观看喷潮| 国产不卡视频一区| 久久精品这里都是精品| 经典一区二区三区| 亚洲蜜臀av乱码久久精品蜜桃| 2023国产精品自拍| 777色狠狠一区二区三区| 亚洲欧美国产77777| 91麻豆精品视频| 亚洲日本青草视频在线怡红院| 99这里都是精品| 中文字幕亚洲区| 欧美专区亚洲专区| 91网站视频在线观看| 亚洲成人激情社区| 一级精品视频在线观看宜春院 | 日本道色综合久久| 成人激情图片网| 国产福利视频一区二区三区| 国产一区二区三区四| 久久福利资源站| 欧美国产成人精品| 色婷婷精品久久二区二区蜜臂av| 亚洲国产精品天堂| 久久精品水蜜桃av综合天堂| 欧美成人一区二区三区片免费| 91精品国产一区二区| 久久成人麻豆午夜电影| 亚洲国产经典视频| 欧美激情中文不卡| 自拍偷拍亚洲综合| 亚洲国产精品久久人人爱蜜臀| 日韩欧美久久久| 久久天堂av综合合色蜜桃网| 在线观看日韩国产| 欧美精品777| av资源网一区| 在线观看三级视频欧美| 国产成人免费视| www.66久久| 2020国产精品久久精品美国| 久久久不卡影院| 亚洲欧美色图小说| 五月天国产精品| 日本一区二区在线不卡| 欧美美女激情18p| 91丨九色丨蝌蚪富婆spa| 免费欧美在线视频| 亚洲亚洲精品在线观看| 日韩中文字幕亚洲一区二区va在线 | 久久久久99精品一区| 国产精品传媒视频| 日韩影院免费视频| 亚洲免费观看高清| 久久久亚洲精华液精华液精华液 | 欧美日韩国产影片| 久久久91精品国产一区二区精品 | 欧美电影免费观看高清完整版在线| 久久综合色之久久综合| 亚洲六月丁香色婷婷综合久久| 日韩欧美国产麻豆| 欧美日韩激情一区| 欧美色手机在线观看| 欧美日韩亚洲综合一区二区三区| 久久99精品国产.久久久久| 99免费精品在线| 99久久免费国产| 麻豆91在线观看| 麻豆久久一区二区| 91黄视频在线观看|