售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Learning AndEngine
Table of Contents
Learning AndEngine
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Setting Up an AndEngine Project
Prerequisites
Downloading and installing the required software
Downloading the Android SDK
Installing the Android SDK
Configuring the Eclipse IDE
Getting the AndEngine libraries
Selecting the correct branch
AndEngine repositories
Downloading the sources
Adding AndEngine to the Eclipse IDE
Creating a new application
Creating a simple Android application
Device configuration
Before Honeycomb
Honeycomb until Ice Cream Sandwich
Jelly Bean and later
Running the application
Adding AndEngine
Adding the required projects
Changing the GameActivity to an AndEngine activity
Understanding the activity lifecycle
The BaseGameActivity class
The onCreateEngineOptions method
The onCreateResources method
The onCreateScene method
The onPopulateScene method
Running the application
Understanding resolution policies
FixedResolutionPolicy
FillResolutionPolicy
RelativeResolutionPolicy
RatioResolutionPolicy
CropResolutionPolicy
Summary
2. Game Concept and Assets
The game concept
Identifying the basic entities
Getting the assets
Graphics
Graphic formats
The main character
The enemy
Platform and clouds
Putting it all together
Sounds and music
Audio file formats
Sound effects
Music
Scene diagram
Summary
3. From Assets to Entities
Managing resources
Loading graphics
Bitmap texture format
Texture options
Interpolation
Nearest-neighbor interpolation
Bilinear interpolation
Repeating
Alpha channel settings
Creating the regions
Building the atlas
Texture and alpha bleeding
Texture bleeding
Alpha bleeding
Unloading graphics
Loading sounds and music
Unloading sounds and music
Loading fonts
Unloading fonts
Putting it all together
Entities
Scene
AbstractScene
GameScene
Background
Sprite, tiled sprite, and animated sprite
Main character
Player class
PlayerFactory class
Using the new entity and its factory
Platforms and enemies
Running the code
Summary
4. HUD and Text Display
Fonts and text
Storing the font on a texture
Storing special characters and international alphabets
Characters from European languages
Korean, Chinese, Japanese, and other similar writing systems
Other writing systems
Workaround for unsupported languages
Other limitations of the font texture
Writing text
HUD
Working with toasts
Localization
Debug output
Logging to LogCat from AndEngine
Logging best practices
Summary
5. Basic Interactions
A simple animation
An animated sprite
Entity modifiers
User input
Touchscreen
Touch events
The scene touch listener
The entity touch area
Touch area bindings
Accelerometer
Pausing and resuming the accelerometer
Collision detection
Handling collisions
Collision handlers
The collidesWith method
Using correct threads to perform actions
Summary
6. Physics
The physics engine
Basic terms
Body types
Fixtures
Shapes
Density
Friction
Elasticity
Sensor
The physics world
Forces and impulses
Joints
Adding physics
Adding a physics world
Introducing a collidable entity
Relation between physics bodies and entities
Adding a physics body to the player entity
Adding platforms
Controlling the player character
Changing the gravity vector
Using forces
Using impulses
Setting the velocity directly
Summary
7. Detecting Collisions and Reacting to Events
Collisions
Detecting collisions
The player-platform collision
The player-enemy collision
The Enemy class and EnemyFactory
Adding enemies to the scene
Updating the contact listener
Game events
The chase camera
Adding and removing platforms and enemies
Detecting the player character's death
Score
Wrapping the world around
Restarting the game after a player dies
Showing a message on game over
Restarting the game on tap
Playing sounds on events
Playing the jump sound
Playing the fall sound when the player's character dies
Summary
8. Advanced Physics
The Box2D Debug Draw extension
Adding Debug Draw to our AndEngine project
Using Debug Draw in a game
Assembling bodies from fixtures
Creating an empty body
The head fixture
Creating the torso
Creating the legs
Assembling the body
Collision filtering
Category
The category mask
Example of categories and masks
Group index
Joints
The revolute joint
The distance joint
The prismatic joint
The line joint
The weld joint
The friction joint
The pulley joint
The gear joint
The mouse joint
Implementing a revolute joint
Summary
9. Adding a Menu and Splash Scene
Managing multiple scenes
A splash scene
Updating the resource manager
Creating the scene
The menu scene
The loading scene
The scene manager
Plugging in the SceneManager class
Storing values
Using preferences
Settings
Playing sound according to the settings
High score
Summary
10. Polishing the Game
What is polishing?
Adding music
Life cycle of the media player
Adding animations using entity modifiers
Chaining modifiers
Modifiers
Ease functions
Using the modifier callback hooks
Particle systems
Creating a flying in the clouds effect
Creating a fire and smoke effect
Parallax background
VerticalParallaxEntity
Creating a parallax background
Shaders
Summary
11. Testing, Publishing, and What's Next
Creating a production APK
Testing with the production APK
Testing on multiple devices
Using an emulator
Getting in touch with the community
Publishing the game to the Google Play store
Publishing to the beta stage first
Creating the application
Crash reports
Debugging crashes
Publishing to production
Promotion
Next steps
The first week
The first month
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜