AndEngine学习笔记(一) 入门知识

项目地址:http://code.google.com/p/andengine/

 


AndEngine的加载过程

onLoadEngine()-->onLoadResources()-->onLoadScene()--> onLoadComplete()

 

 

AndEngine Game Concepts

The movie analogy we referred to earlier is a good way to approach AndEngine. Your game is like a movie, and the game engine includes concepts that are analogous to those involved in making a movie.

Camera

The “camera” of the game determines the view of the game that is presented to players. It is very much like a movie camera in two-dimensional space. The camera can pan and zoom across the scene to change the view presented. The panning and zooming can either be under the player’s control or be driven programmatically.

Scene

A game, like a movie, consists of a series of scenes where the action takes place. In a movie, the scenes are edited together in a fixed way. In games, the sequence of scenes is driven by the play of the game. Games are like movies edited on the fly.

Layer

Scenes are composed of layers of graphics. The layers are superimposed on one another, much like the animation cels used to create cartoons in the old days. Layers can also be used to introduce 2½D effects, where, as the camera pans, closer layers move faster than more distant layers.

Sprite

Sprites are the visual representation of the actors in our movie, whether those actors are people or objects. Sprites can be animated or not, but they often move about the scene during the course of game play. Sprite textures are often loaded from one large image that comprises a collection of sprite images, called a sprite sheet.

Entity

In AndEngine, entities are just about anything that’s drawn to the screen. Sprites are entities, as are tiles, geometric shapes, and lines drawn on the screen. All entities have properties, such as color, rotation, scale and position, that can be changed by modifiers.

Modifier

Modifiers change the properties of an entity, and they are very powerful in AndEngine. They can be used on any entity, and the change they cause can either be immediate or occur gradually over a specified duration. In our game, we’ll use modifiers frequently to create effects with sprites and other entities.

Texture

A texture is a 2D, generally bitmapped graphic that can be applied to objects to give them, well, texture. Textures define the way entities look, and much of the OpenGL graphics environment is built around the use of textures.

Texture Region

A texture defines a complete bitmap graphic, and a texture region defines a subset of that region. We’ll talk a lot about performance optimizations of 2D graphics later, and using texture regions to map small pieces of a large combined bitmap is one of the key tricks used to create these optimizations.

Engine

An engine runs a scene. It takes care of letting animations and modifiers know when to update the presented graphics, coordinates the actual drawing, handles user input events (touch, keys, sensors), and generally manages the progress of the game. The engine is a lot like the producer/director of our movie, telling everyone what they need to do.

BaseGameActivity

This class, which extends the Android Activity class, will be the basis of each scene in our game. BaseGameActivity does all the work common to all scenes, setting up the game engine, conforming to the Android Activity Lifecycle requirements, and enabling sensors. We’ll explore this class in more depth in Chapter 3.

Physics Connector

AndEngine includes basic physics capabilities in the base engine, but the Box2D physics engine expands greatly on those capabilities. We connect AndEngine objects with Box2D through a physics connector. If your game doesn’t use Box2D physics, you won’t have a physics connector.

Box2D Physics Engine

AndEngine includes the open-source JBox2D port of the Box2D physics engine. It can be used to realistically simulate the interaction of physical objects in the following ways (among others): Simulation of the physics of rigid bodies; Stable stacking; Gravity; User-defined units; Efficient solving for collisions/contacts; Sliding friction; Boxes, circles, and polygons; Several joint types: distance, revolute, prismatic, pulley, gear, mouse; Sleeping (removes motionless bodies from simulation until touched).

Graphics Tools

Creation of any video game requires the generation of quite a bit of graphics. Backgrounds have to be drawn, sprites rendered, and animations of some sprites created. Many tools are available to manage computer graphics, and the professional tools are incredibly sophisticated. If you are a graphic designer and know how to use Adobe Illustrator or other professional tools, you can safely skip this section.

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值