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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch6.htm

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

<HEAD>
   <TITLE>Chapter 6 -- Sprite Animation</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 6</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Sprite Animation</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="#WhatIsAnimation" >What Is Animation?</A>
<LI><A HREF="#TypesofAnimation" >Types of Animation</A>
<UL>
<LI><A HREF="#FrameBasedAnimation" >Frame-Based Animation</A>
<LI><A HREF="#CastBasedAnimation" >Cast-Based Animation</A>
</UL>
<LI><A HREF="#ImplementingSpriteAnimation" >Implementing Sprite Animation</A>
<UL>
<LI><A HREF="#TheSpriteClass" >The Sprite Class</A>
<LI><A HREF="#TheSpriteVectorClass" >The SpriteVector Class</A>
<LI><A HREF="#TheBackgroundClasses" >The Background Classes</A>
</UL>
<LI><A HREF="#SampleAppletAtoms" >Sample Applet: Atoms</A>
<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>
The heart of graphics in almost all games is animation. Without
animation, there would be no movement, and without movement, we'd
all be stuck playing board games and card games. Today's lesson
presents the fundamental concepts surrounding animation in games
and, more specifically, sprite animation. As you'll soon learn,
practically every game with animation employs some type of animation
engine, typically involving sprites.
<P>
After learning the basics of animation and how it applies to games,
you dig into building a set of sprite animation classes that are
powerful and extensive enough to handle all of your Java game
animation needs. As a matter of fact, you'll reuse the sprite
classes in every game throughout the rest of the book. These sprite
classes handle all the details of managing multiple animated sprite
objects with support for transparency, Z-order, collision detection,
and custom actions. You don't understand some of those last features?
Well, don't worry; you will soon enough. Read on!
<H2><A NAME="WhatIsAnimation"><B><FONT SIZE=5 COLOR=#FF0000>What
Is Animation?</FONT></B></A></H2>
<P>
Before getting into animation as it relates to Java and games,
it's important to understand the basics of what animation is and
how it works. Let's begin by asking this fundamental question:
What is animation? Put simply, animation is the illusion of movement.
Am I saying that every animation you've ever seen is really just
an illusion? That's exactly right! And probably the most surprising
animated illusion is one that captured attentions long before
computers-the television. When you watch television, you see lots
of things moving around. But what you perceive as movement is
really just a trick being played on your eyes.
<P>
<I>Animation</I> is the illusion of movement.
<P>
In the case of television, the illusion of movement is created
by displaying a rapid succession of images with slight changes
in content. The human eye perceives these changes as movement
because of its low visual acuity, which means that your eyes are
fairly easy to trick into believing the illusion of animation.
More specifically, the human eye can be tricked into perceiving
animated movement with as low as 12 frames of movement per second.
It should come as no surprise that this animation speed is the
minimum target speed for most computer games. Animation speed
is measured in frames per second (fps).
<P>
<I>Frames per second</I> (fps) is the number of animation frames,
or image changes, presented every second.
<P>
Although 12 fps is technically enough to fool your eyes into seeing
animation, animations at speeds this low often end up looking
somewhat jerky. Therefore, most professional animations use a
higher frame rate. Television, for example, uses 30 fps. When
you go to the movies, you see motion pictures at about 24 fps.
It's pretty apparent that these frame rates are more than enough
to captivate your attention and successfully create the illusion
of movement.
<P>
Unlike television and motion pictures, computer games are much
more limited when it comes to frame rate. Higher frame rates in
games correspond to much higher processor overhead, so game developers
are left to balance the frame rate against the system speed and
resources. That is why some games provide different resolution
and graphics quality options. By using a lower resolution and
more simple graphics, a game can increase its frame rate and generate
smoother animations. Of course, the trade-off is a lower resolution
and more simple graphics.
<P>
When programming animation in Java, you typically have the ability
to manipulate the frame rate a reasonable amount. The most obvious
limitation on frame rate is the speed at which the computer can
generate and display the animation frames. Actually, the same
limitation must be dealt with by game developers, regardless of
the programming language or platform. However, it is a little
more crucial in Java because Java applets are currently much slower
than native applications. Hopefully, the advent of just-in-time
Java compilers will speed up Java applets and therefore give Java
games a boost.
<P>
When determining the frame rate for a Java game, you usually have
some give and take in establishing a low enough frame rate to
yield a smooth animation, while not bogging down the processor
and slowing the system down. But don't worry too much about this
right now. For now, just keep in mind that when programming animation
for Java games, you are acting as a magician creating the illusion
of movement.
<H2><A NAME="TypesofAnimation"><B><FONT SIZE=5 COLOR=#FF0000>Types
of Animation</FONT></B></A></H2>
<P>
Although the focus of today's lesson is ultimately on sprite animation,
it is important to understand the primary types of animation used
in Java programming. Actually, a lot of different types of animation
exist, all of which are useful in different instances. However,
for the purposes of implementing animation in Java, I've broken
animation down into two basic types: frame-based animation and
cast-based animation.
<H3><A NAME="FrameBasedAnimation"><B>Frame-Based Animation</B></A>
</H3>
<P>
The most simple animation technique is frame-based animation,
which finds a lot of usage in nongaming animations. Frame-based
animation involves simulating movement by displaying a sequence
of pregenerated, static frame images. A movie is a perfect example
of frame-based animation: Each frame of the film is a frame of
animation, and when the frames are shown in rapid succession,
they create the illusion of movement.
<P>
<I>Frame-based animation</I> simulates movement by displaying
a sequence of pregenerated, static frame images.
<P>
Frame-based animation has no concept of a graphical object distinguishable
from the background; everything appearing in a frame is part of
that frame as a whole. The result is that each frame image contains
all the information necessary for that frame in a static form.
This is an important point because it distinguishes frame-based
animation from cast-based animation, which you learn about next.
<H3><A NAME="CastBasedAnimation"><B>Cast-Based Animation</B></A>
</H3>
<P>
A more powerful animation technique employed by many games is
cast-based animation, which is also known as <I>sprite animation</I>.
Cast-based animation involves graphical objects that move independently
of a background. At this point, you might be a little confused
by the usage of the term <I>graphical object</I> when referring
to parts of an animation. In this case, a graphical object is
something that logically can be thought of as a separate entity
from the background of an animation image. For example, in the
animation of a space shoot-em-up game, the aliens are separate
graphical objects that are logically independent of the starfield
background.
<P>
<I>Cast-based animation</I> simulates movement using graphical
objects that move independently of a background.
<P>
Each graphical object in a cast-based animation is referred to
as a <I>sprite</I>, and can have a position that varies over time.
In other words, sprites have a velocity associated with them that
determines how their position changes over time. Almost every
video game uses sprites to some degree. For example, every object
in the classic Asteroids game is a sprite that moves independently
of the background.
<P>
A <I>sprite</I> is a graphical object that can move independently
of a background or other objects.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
You might be wondering where the term <I>cast-based animation</I> comes from. It comes from the fact that sprites can be thought of as cast members moving around on a stage. This analogy of relating computer animation to theatrical performance is very 
useful. By thinking of sprites as cast members and the background as a stage, you can take the next logical step and think of an animation as a theatrical performance. In fact, this isn't far from the mark, because the goal of theatrical performances is to 
entertain the audience by telling a story through the interaction of the cast members. Likewise, cast-based animations use the interaction of sprites to entertain the user, while often telling a story.
</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Even though the fundamental principle behind sprite animation
is the positional movement of a graphical object, there is no
reason you can't incorporate frame-based animation into a sprite.
Incorporating frame-based animation into a sprite enables you
to change the image of the sprite as well as alter its position.
This hybrid type of animation is actually what you will implement
later in today's lesson in the Java sprite classes.
<P>
I mentioned in the frame-based animation discussion that television
is a good example of frame-based animation. But can you think
of something on television that is created in a manner similar
to cast-based animation (other than animated movies and cartoons)?
Have you ever wondered how weatherpeople magically appear in front
of a computer-generated map showing the weather? The news station
uses a technique known as <I>blue-screening</I>, which enables
them to overlay the weatherperson on top of the weather map in
real time. It works like this: The person stands in front of a
blue backdrop, which serves as a transparent background. The image
of the weatherperson is overlaid onto the weather map; the trick
is that the blue background is filtered out when the image is
overlaid so that it is effectively transparent. In this way, the
weatherperson is acting exactly like a sprite!
<H4><B>Transparency</B></H4>
<P>
The weatherperson example brings up a very important point regarding
sprites: <I>transparency</I>. Because bitmapped images are rectangular
by nature, a problem arises when sprite images aren't rectangular
in shape. In sprites that aren't rectangular in shape, which is
the majority of sprites, the pixels surrounding the sprite image
are unused. In a graphics system without transparency, these unused
pixels are drawn just like any others. The end result is sprites
that have visible rectangular borders around them, which completely
destroys the effectiveness of having sprites overlaid on a background
image.
<P>
What's the solution? Well, one solution is to make all of your
sprites rectangular. Because this solution isn't very practical,
a more realistic solution is transparency, which allows you to
define a certain color in an image as unused, or transparent.
When pixels of this color are encountered by drawing routines,
they are simply skipped, leaving the original background intact.
Transparent colors in images act exactly like the weatherperson's
blue screen in the example earlier.
<P>
<I>Transparency colors</I> are colors in an image that are unused,
meaning that they aren't drawn when the rest of the colors in
the image are drawn.
<P>
You're probably thinking that implementing transparency involves
a lot of low-level bit twiddling and image pixel manipulation.
In some programming environments, you would be correct in this
assumption, but not in Java. Fortunately, transparency is already
supported in Java by way of the GIF 89a image format. In the GIF
89a image format, you simply specify a color of the GIF image
that serves as the transparent color. When the image is drawn,
pixels matching the transparent color are skipped and left undrawn,
leaving the background pixels unchanged.
<H4><B>Z-Order</B></H4>
<P>
In many instances, you will want some sprites to appear on top
of others. For example, in a war game you might have planes flying
over a battlefield dropping bombs on everything in sight. If a
plane sprite happens to fly over a tank sprite, you obviously
want the plane to appear above the tank and, therefore, hide the
tank as it passes over. You handle this problem by assigning each
sprite a screen depth, which is also referred to as <I>Z-order</I>.
<P>
<I>Z-order</I> is the relative depth of sprites on the screen.
<P>
The depth of sprites is called <I>Z-order</I> because it works

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内偷窥港台综合视频在线播放| 日本不卡一二三| 成人免费黄色在线| 国产精品久久久久影视| 成人夜色视频网站在线观看| 欧美国产综合色视频| www.一区二区| 亚洲激情av在线| 欧美高清视频在线高清观看mv色露露十八 | 欧美高清视频一二三区 | 99久久精品一区二区| 亚洲视频免费在线| 欧美日韩一卡二卡三卡| 日韩av电影免费观看高清完整版 | 美洲天堂一区二卡三卡四卡视频| 日韩欧美成人午夜| 国产麻豆成人精品| 一区二区三区美女| 精品奇米国产一区二区三区| 丁香婷婷综合五月| 亚洲一区二区三区中文字幕在线| 在线91免费看| 国产精品18久久久久久久网站| 中文字幕一区二区三区色视频 | 日韩女优毛片在线| 福利一区二区在线| 丝袜亚洲另类欧美综合| 国产欧美一区二区三区网站| 在线观看成人免费视频| 久久99精品国产.久久久久| 国产精品久久三区| 日韩欧美激情四射| 99精品视频在线观看| 日本欧美一区二区三区| 国产精品三级视频| 欧美一级理论性理论a| 国产成人高清在线| 男人的j进女人的j一区| 最新久久zyz资源站| 精品乱码亚洲一区二区不卡| 91丝袜呻吟高潮美腿白嫩在线观看| 日本欧美加勒比视频| 亚洲你懂的在线视频| 久久综合999| 91精品国产一区二区三区蜜臀| 丁香五精品蜜臀久久久久99网站| 日韩av一区二区三区四区| 136国产福利精品导航| 日韩欧美电影一二三| 欧美日韩免费在线视频| 成人18视频日本| 久久黄色级2电影| 亚洲国产毛片aaaaa无费看| 欧美激情综合在线| 久久丝袜美腿综合| 2021中文字幕一区亚洲| 欧美精品日韩精品| 欧美在线观看视频一区二区 | 美女被吸乳得到大胸91| 亚洲综合免费观看高清在线观看| 国产午夜精品一区二区三区视频| 日韩精品一区二区三区四区视频| 韩国欧美一区二区| 欧美日韩极品在线观看一区| 国产精品一二三| 日韩不卡一区二区三区| 亚洲欧美二区三区| 中文字幕一区二区三区不卡在线| 欧美不卡一区二区三区四区| 欧美午夜片在线看| 在线观看一区不卡| 91黄视频在线| 一本久道久久综合中文字幕 | 蜜臀av一区二区在线免费观看 | 在线91免费看| 国产精品视频九色porn| 26uuu亚洲综合色欧美| 国产日韩欧美制服另类| 午夜精品一区二区三区电影天堂 | 日韩午夜激情av| 91麻豆精品国产91久久久更新时间| 91久久精品一区二区| 在线一区二区三区四区五区| 在线国产电影不卡| 欧美三电影在线| 欧美猛男gaygay网站| 这里只有精品免费| 日韩一级片在线观看| 久久久一区二区三区捆绑**| 久久影音资源网| 国产精品视频一二三| 国产精品情趣视频| 亚洲欧美日韩国产成人精品影院| 亚洲婷婷在线视频| 亚洲成a人在线观看| 日本va欧美va瓶| 国产一区999| 成人福利视频在线| 欧美在线你懂得| 日韩欧美国产综合在线一区二区三区| 欧美成人一区二区三区在线观看| 2022国产精品视频| 18成人在线观看| 日韩精品一区第一页| 精品一区二区在线播放| 懂色av一区二区三区免费观看| 99久久婷婷国产精品综合| 欧美三级视频在线| 久久综合久久综合久久综合| 国产精品久久久久aaaa樱花| 亚洲一二三区不卡| 韩国精品一区二区| 91蜜桃婷婷狠狠久久综合9色| 欧美日韩一二三区| 丝袜亚洲另类欧美| 国产麻豆成人精品| 精品视频色一区| 久久精品在线观看| 亚洲高清免费视频| 粉嫩嫩av羞羞动漫久久久| 欧美视频日韩视频| 日本一区二区三区四区| 亚洲成av人影院| 国产精品123| 欧美日韩在线一区二区| 国产日韩欧美综合一区| 亚洲电影激情视频网站| 国产成人av网站| 欧美日韩一区二区在线观看视频| 久久久精品人体av艺术| 日日噜噜夜夜狠狠视频欧美人 | 日韩欧美在线观看一区二区三区| 日本一区二区高清| 天天操天天干天天综合网| 成人国产一区二区三区精品| 欧美日韩一区二区三区在线看| 国产视频一区在线播放| 亚洲成a人片综合在线| av成人动漫在线观看| 久久色在线视频| 亚洲成av人片一区二区三区| 9久草视频在线视频精品| 精品1区2区在线观看| 婷婷国产v国产偷v亚洲高清| 91色综合久久久久婷婷| 国产视频亚洲色图| 久久疯狂做爰流白浆xx| 欧美日韩成人综合天天影院| 中文字幕在线播放不卡一区| 国产福利一区二区三区在线视频| 日韩一区二区三区电影| 亚洲成a人片在线不卡一二三区| 99国产精品久久| 国产精品视频yy9299一区| 国产老肥熟一区二区三区| 日韩三级免费观看| 首页国产欧美久久| 欧美午夜影院一区| 亚洲一区二区三区自拍| 91在线播放网址| 亚洲欧洲日韩在线| av成人免费在线| 中文字幕色av一区二区三区| 国产福利一区二区三区视频| www久久精品| 中文一区在线播放| 一本大道久久a久久精品综合| 亚洲国产精品欧美一二99| 精品日韩一区二区三区免费视频| 懂色中文一区二区在线播放| 舔着乳尖日韩一区| 精品国产一区久久| 成人看片黄a免费看在线| 亚洲一区免费视频| 国产日韩精品一区| 欧美美女网站色| 成人h动漫精品一区二| 日韩av在线播放中文字幕| 一区二区成人在线视频| 精品国产制服丝袜高跟| 激情六月婷婷综合| 久久先锋影音av| 国产成人自拍网| 最近中文字幕一区二区三区| 91黄视频在线| 青娱乐精品在线视频| 欧美精品一区二区蜜臀亚洲| 国产91精品久久久久久久网曝门| 国产精品国产三级国产三级人妇| 一本一本大道香蕉久在线精品| 亚洲国产欧美另类丝袜| 日韩欧美国产午夜精品| 粉嫩av一区二区三区| 亚洲日本在线看| 欧美一区二区三区视频在线 | 亚洲3atv精品一区二区三区| 91精品欧美一区二区三区综合在 | 国产欧美日韩不卡免费| 91网址在线看| 欧美v日韩v国产v|