售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Monkey Game Development
Table of Contents
Monkey Game Development
Credits
About the Author
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
Who this book is for
Conventions
Time for action — heading
What just happened?
Have a go hero — heading
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Monkey—Huh?
Game development for the rest of us
Cross-platform development
Compiler or translator?
The Monkey toolbox
Time for action — installing Monkey
Please welcome… Monk
MSERVER—Monkey's own web server
What just happened?
Let's have a little playtime
Time for action — playing Pirate TriPeaks
What just happened
Time for action — playing Surviball
What just happened?
Playing to have fun, playing to study
So let's go for something big? No!
The alternative
What just happened?
Time for action — read the manual
What just happened ?
The Trans tool and the supported target platforms
HTML5
FLASH
iOS
Android
XNA
GLFW
The Monkey standard modules
Lang
Lists
Map
Math
Random
Set
Stack
Mojo — The 2D framework/modules
App
Audio
Graphics
Input
Monkey is extendable
Your own modules
Native source code
Third-party modules
Your own targets
Your game is easily portable
Summary
2. Getting to Know your Monkey—a Trip to the Zoo
Call the Monk and start praying—the Monkey IDE
Why learn about Monk?
Starting up Monk
Monk's user interface
The toolbar
The code editor area
The info box
Time for action — opening a sample script
What just happened?
Where is my navi?
Time for action — navigating to the Main() function
What just happened?
Save... save... save!
Time for action — saving a script
What just happened?
Projects—bringing in some organization
Time for action — creating a project
What just happened?
The Monkey programming language
Time for action — Monkey's Hello World
What just happened?
Running your first script in a browser
Our first little game... PONGO
Time for action — the basic structure of your game
Pongo's data structure
Time for action — adding some data fields
Time for action — rendering the game field
Time for action — drawing the ball and the paddles
Time for action — player paddle movement
Time for action — moving the enemy paddles
Time for action — moving the ball
Time for action — controlling the ball with the player's paddle
Time for action — letting the enemy paddles fight back
Time for action — acting on the different game modes
What just happened?
Have a go hero — enhancing the computer AI
Exporting your game as an HTML5 website
One more thing... comment your code!
Summary
3. Game #2, Rocket Commander
The game objects
The basic file structure
Time for action — building the basic file structure of the game
What just happened?
Hold that data—RocketCommander's data structure
Time for action — creating the general data structure of the game
What just happened?
Detailing the Update process
Time for action — detailing the Update process
What just happened?
Detailing the Render process
Time for action — detailing the Render event
What just happened?
Enhancing the OnCreate event
Time for action — detailing the OnCreate process
What just happened?
Let's build some cities
Time for action — building some cities
What just happened?
Implementing the city class into the game
Time for action — changing the gameClasses file
What just happened?
Modifying the RocketCommander class
Time for action — spawning some cities in the game
What just happened?
Rendering the ground and the cities
Time for action — rendering the cities
What just happened?
Get the launchers ready!
Time for action — implementing the rocket launchers
What just happened?
Implementing the launcher class into the game
Time for action — changing the gameClasses file again
What just happened?
Modifying the RocketCommander class
Time for action — creating some launchers in the game
What just happened?
Updating the rocket launchers
Time for action — updating the launchers
What just happened?
Enhancing the UpdateMenu method
Time for action — modifying the menu update process
What just happened?
Rendering our precious rocket launchers
Time for action — rendering the launchers
What just happened?
Fire! Blast them to pieces!
Time for action — implementing some rockets
What just happened?
Implementing the rocket class into the game
Time for action — modifying the gameClasses file
What just happened?
Modifying the launcher class
Time for action — modifying the launcher class
What just happened?
Updating the rockets
Time for action — updating the rockets
What just happened?
Rendering our furious rockets
Time for action — rendering the rockets
What just happened?
And it goes BOOM!... Explosions
Time for action — implementing explosions
What just happened?
Implementing the explosion class into the game
Time for action — modifying the gameClasses file
What just happened?
Modifying the rocket class
Time for action — modifying the rocket class
What just happened?
Updating the explosions
Time for action — updating the explosions
What just happened?
Rendering beautiful explosions
Time for action — rendering the explosions
What just happened?
Don't fear the enemy—bombs
Time for action — creating the bomb class
What just happened?
Implementing the bomb class into the game
Time for action — modifying the gameClasses file
What just happened?
Updating bombs
Time for action — updating the bombs
What just happened?
Rendering beautiful bombs
Time for action — rendering the bombs
What just happened?
Creating new bombs and checking for GameOver conditions, or new level conditions
Time for action — modifying the UpdateGame method
What just happened?
Displaying the game score
Time for action — displaying the game score
What just happened?
Summary
4. Game #3, CometCrusher
Using a game framework—the fantomEngine
Game resources
Images
Sounds
Bitmap fonts
The game objects
Layers
Background stars
Comets
The player ship
The shield
Shots
Particles
Game info text
The basic file structure
Time for action — create the main source file and its folders
What just happened?
Open the storage please—the data structure of CometCrusher
Time for action — creating the data structure
What just happened?
First changes to the OnCreate method
Time for action — modifying the OnCreate method
What just happened?
Detailing the Render process
Time for action — detailing the OnRender method
What just happened?
This is a setup—creating the game objects
Group yourself—layers
Time for action — creating some layers
Let them shine—the background stars
Time for action — implementing some stars
What just happened?
The Hero—creating the player ship
Time for action — setting up the player ship
What just happened?
Did you hear that—loading sounds
Time for action — creating a method to load sounds
What just happened?
Did you see that score—the game UI
Time for action — creating some game info text objects
What just happened?
Headlines—adding a title screen
Time for action — adding a title screen
What just happened?
How good are you—the high score list
Time for action — setting up the high score list
What just happened?
Rocks rocks rocks—fill the space with some comets
Time for action — create a comet
What just happened?
Time for action — creating some comets
What just happened?
Mission complete... finalizing the OnCreate process
Time for action — finalizing the OnCreate method
What just happened?
We need help—more methods for the Update process
Loading and showing the high score list
Time for action — loading a high score list
What just happened?
Time for action — showing the high score list
What just happened?
Activating the shield of the player ship
Time for action — the ActivateShield method
What just happened?
Delta time related movement
Time for action — determine the time delta
What just happened?
Updating the game statistic info text objects
Time for action — updating the info text
What just happened?
Starting a new game
Time for action — creating a StartNewGame method
What just happened?
Let the engine glow
Time for action — spawning some engine particle FX
What just happened?
And it goes boom—creating an explosion
Time for action — creating some explosions
What just happened?
Give me that gun—spawning a shot
Time for action — spawning some shots
What just happened?
Save some high scores, will ya!
Time for action — saving the high score list
What just happened?
Finalizing the OnUpdate method
Time for action — finalizing the OnUpdate method
What just happened?
Bring in the action—shaping the engine class
Crack these objects—object collision handling
Time for action — detailing the collision detection
What just happened?
It's about time—acting on timer events
Time for action — detailing the OnObjectTimer method
What just happened?
Everything is under control—object update events
Time for action — detailing the OnObjectUpdate method
What just happened?
Did I win—checking the losing conditions with OnLayerUpdate
Time for action — detailing the OnLayerUpdate method
What just happened?
Have a go hero — adding an enemy ship
One last thing—creating a FLASH game
Summary
5. Game #4, Chain Reaction
Modifying the HTML5 canvas size
Time for action — modifying canvas size
Some development basics
Frameworks/modules
Sprite sheets
Content scaling
Touch input
Suspend and Resume events
Animation
Game resources
Game objects
Layers
Title screen
Game background
Atom tiles
Game info text
The basic app structure
Time for action — creating the main source file and its folders
What just happened?
The data storage
Time for action — creating the data structure
What just happened?
First changes to the OnCreate event
Time for action — first changes to the OnCreate method
What just happened?
Detailing the OnRender event
Time for action — detailing the OnRender method
What just happened?
Setting up the game objects
Sound effects
Time for action — loading the game sound effects
What just happened?
Game layers
Time for action — creating layers for the game
What just happened?
Game screen
Click here — Adding buttons
Time for action — creating buttons
What just happened?
The info text objects
Time for action — creating info text objects
What just happened?
The actual game screen
Time for action — composing the game screen
What just happened?
Title screen
Time for action — creating the title screen
What just happened?
Finalizing the OnCreate event
Time for action — finalizing the OnCreate method
What just happened?
Helper functions for the update process
Creating the atom elements
Collision circle objects
Time for action — creating collision circles
What just happened?
Atom elements
Time for action — creating the atom elements
What just happened?
Starting a new game
Time for action — creating a StartNewGame method
What just happened?
Time-related movement
Time for action — implementing the GetDeltaTime method
What just happened?
Updating the info text objects
Time for action — creating a method to update the text information
What just happened?
Detailing the OnUpdate event
Time for action — finalizing the OnUpdate method
What just happened?
Introducing the OnSuspend event
Time for action — modifying the OnSuspend event
What just happened?
Introducing the OnResume event
Time for action — updating the OnResume method
What just happened?
The heart of the game - the engine class
What are transitions?
Touch me — acting on touch hits
Time for action — enhancing the OnObjectTouch method
What just happened?
The eagle has landed—a transition is finished
Time for action — detailing the OnObjectTransition method
What just happened?
It's about time—timer events
Time for action — acting on timer events
What just happened?
Captain! Collision ahead!—doing collision checks
Time for action — detailing the collision detection
What just happened?
Have a go hero — enhancing Chain Reaction
Creating an Android app
Changing icons
Do a name change
Signing an application for the market
Summary
6. Game #5, Balls Out!
Which frameworks and modules are used?
Game resources
Our lovely game objects
Layers
The title screen
Game background
The ball
Enemies
The ball tiles
The basic app structure
Time for action — creating the basic file structure
What just happened?
Modifying the HTML5 canvas size for testing
Time for action — modifying the HTML5 output
The data storage
Time for action — creating the data structure
What just happened?
First changes to the OnCreate event
Time for action — first changes to the OnCreate method
What just happened?
Detailing the OnRender event
Time for action — detailing the OnRender method
What just happened?
Setting up the game objects
Make some noise—sound effects
Time for action — loading the game sound effects
What just happened?
Lay your head on me—the game layers
Time for action — creating layers for the game
What just happened?
Our beloved play field—the background screen
Buttons—I need more text buttons!
Time for action — creating text buttons
What just happened?
The background screen as usual
Time for action — composing the game screen
What just happened?
Give it a name—the title screen
Time for action — creating the title screen
What just happened?
Finalizing the OnCreate event
Time for action — finalizing the OnCreate method
What just happened?
Helper methods for the update process
Creating the tiles
Time for action — creating the tiles
What just happened?
The main actor—creating the ball
Time for action — creating the ball
What just happened?
Have a go hero — Add more player balls
The bad guys—our beloved enemies
Time for action — creating the enemy class
What just happened?
More helper functions
Spawning an enemy
Time for action — spawning an enemy
What just happened?
Starting a new game
Time for action — creating a StartNewGame method
What just happened?
Bring me up-to-date—detailing the OnUpdate event
Time for action — detailing the OnUpdate method
What just happened?
Eye candy—particle effects
The particle emitter class
Time for action — creating the particle emitter class
What just happened?
The last helper method
Time for action — spawning a particle emitter
What just happened?
The heart of the game—the engine class
Touch me—acting on touch hits
Time for action — enhancing the OnObjectTouch method
What just happened?
Controlling the ball—acting on object update events
Time for action — acting on object update events
What just happened?
What's the situation? Layer update events
Time for action — acting on layer update events
What just happened?
We reached our parking position—a transition is done
Time for action — detailing the OnObjectTransition method
What just happened?
Bump bump—checking for collisions
Time for action — detailing the collision detection
What just happened?
Have a go hero — enhancing a chain reaction
Creating an iOS app
Summary
7. Game #6, At The Docks
Frameworks and modules used
Game resources
The game objects
Layers
The default layer
The title screen
Game screen
Wall tiles
Floor tiles
Target tiles
Crate tiles
The player machine
The basic app structure
Time for action — creating the basic file structure
What just happened?
Modifying the HTML5 canvas size for testing
Time for action — modifying the HTML5 output
What just happened?
The storage for our data
Time for action — creating the data structure
What just happened?
Setting up the game objects
Slice over slice—game layers
Time for action — creating layers for the game
What just happened?
The second-most important part—a title screen
Time for action — creating the title screen
What just happened?
Detailing the OnCreate event
Time for action — finalizing the OnCreate method
What just happened?
Some flexible methods for the update process
Lads and gents… the main actor
Time for action — creating the player
What just happened?
The level maps—loading the tiles
Time for action — loading the level tiles
What just happened?
On your marks—starting a new game
Time for action — creating a StartNewGame method
What just happened?
Bring me up-to-date—detailing the OnUpdate event
Time for action — detailing the OnUpdate method
What just happened?
And action!—the engine class
Move it… object updates
Time for action — updating each object
What just happened?
Push push—checking for collisions
Time for action — detailing collision detection
What just happened?
I can't see it anymore—the transition is finished!
Time for action — detailing the OnLayerTransition method
What just happened?
Have a go hero — enhancing At The Docks
Creating a XNA app
Summary
8. Game #7, Air Dogs 1942
Frameworks and modules used
No silver, no gold, but… our game resources!
The game objects
Layers
The title screen
Game background
The player plane
The enemy plane
Bullets
Clouds
Info text
Smoke particles
Explosions
The basic app structure
Time for action — setting up the basic file structure
What just happened?
Storing data
Time for action — creating the data structure
What just happened?
First changes to the OnCreate event
Time for action — first changes to the OnCreate method
What just happened?
Setting up the game objects
Making some noise… sound effects!
Time for action — loading the game sound effects
What just happened?
Lay your head on me… the game layers
Time for action — creating layers for the game
What just happened?
Over high ground—the background screen
Time for action — composing the background screen
What just happened?
Hope it won't rain—creating the clouds
Time for action — creating the clouds
What just happened?
What is going on?—creating info text objects
Time for action — creating info text objects
What just happened?
What are we playing here?—The title/menu screen
Time for action — creating the title screen
What just happened?
Finalizing the OnCreate event
Time for action — finalizing the OnCreate method
What just happened?
Methods for the update process
The hero—spawning the player plane
Time for action — spawning the player plane
What just happened?
Spawning an enemy
Time for action — spawning an enemy plane
What just happened?
Starting a new game
Time for action — creating a StartNewGame method
What just happened?
Detailing the OnUpdate event
Time for action — detailing the OnUpdate method
What just happened?
Making it look nicer—some particle effects
Emitting smoke
Time for action — emitting the smoke
What just happened?
Boom!—Emitting explosions
Time for action — creating the explosion
What just happened?
Pow!—spawning a shot
Time for action — spawning a shot
What just happened?
The brain—Computer AI (Artificial Intelligence)
Follow him!—creating a brain for the enemy pilot
Time for action — following the player
What just happened?
The heart of the game—the engine class
Time management—acting on object timer events
Time for action — enhancing the OnObjectTimer method
What just happened?
It is gone!—a transition is done
Time for action — detailing the OnObjectTransition method
What just happened?
Controlling the player plane—acting on object update events
Time for action — acting on object update events
What just happened?
Hit it!—handling collision response
Time for action — detailing the collision response
What just happened?
Did I win?—layer update events
Time for action — acting of layer update events
What just happened?
Have a go hero — enhancing the game
Creating a GLFW app
Summary
9. Game #8, Treasure Chest
Frameworks and modules used
Reusing code
The parts of the game... resources
And here they are… the game objects!
Layers
Our precious title screen
A menu screen
The "high-score" screen
A game background
The worthy gems
The gem selector
Particle effects
Preparation… the basic app and project structure
Time for action — creating the basic file structure
What just happened?
Creating 2D arrays
Time for action — creating 2D arrays
What just happened?
Storing information… the data storage
Time for action — creating the data structure
What just happened?
First changes to the OnCreate event
Time for action — first changes to the OnCreate method
What just happened?
About the OnRender event
Setting up the game objects
Klick, bang, swoosh… the sound effects!
Time for action — loading the game sound effects
What just happened?
Lay your head on me…. the game layers
Time for action — creating layers for the game
What just happened?
Our beloved play field—the background screen
Time for action — composing the background screen
What just happened?
Give it a name… the title screen
Time for action — creating the title screen
What just happened?
Game over… creating the "game over" screen
Time for action — creating the "game over" screen
What just happened?
The menu please… creating the menu screen
Buttons … I need more text buttons!
Time for action — creating text buttons
What just happened?
The menu screen
Time for action — creating the menu screen
What just happened?
What is the score?… creating the high-score screen
Time for action — creating the score screen
What just happened?
Layer activation
Time for action — creating the activate layer method
What just happened?
Finalizing the OnCreate event
Time for action — finalizing the OnCreate method
What just happened?
Dealing with the high-score list
Loading and saving the list
Time for action — loading and saving the high-score list
What just happened?
Showing the high-score screen
Time for action — showing the high-score list
What just happened?
Managing the tile map
Getting tile map slot IDs
Time for action — getting tile slot IDs
What just happened?
Setting tile map slot IDs
Time for action — setting a tile slot ID
What just happened?
Check/mark the neighboring tiles
Time for action — checking neighboring horizontal tiles
Time for action — check neighboring vertical tiles
What just happened?
Clearing tiles
Time for action — clearing the tile map
What just happened?
Counting matching tiles
Time for action — counting matching tiles
What just happened?
The precious one… creating a gem
Time for action — creating a gem
What just happened?
Refilling the tile map
Time for action — refilling the tile map
What just happened?
Methods for the update process
Starting a new game
Time for action — creating a StartNewGame method
What just happened?
Give me some information… displaying info
Time for action — updating the text info
What just happened?
Showing the "game over" screen
Time for action — showing the "game over" screen
What just happened?
Showing the menu screen
Time for action — showing the menu
What just happened?
Bring me up-to-date—detailing the OnUpdate event
Time for action — detailing the OnUpdate method
What just happened?
Vroom… vroom—the engine class
Eye candy—particle effects
Time for action — spawning an explosion
What just happened?
Tick tock… acting on object timer events
Time for action — acting on object timer events
What just happened?
Touch me—acting on Touch checks
Time for action — enhancing the OnObjectTouch method
What just happened?
We've reached our parking position… a transition is done
Time for action — detailing the OnObjectTransition method
What's the situation?… layer update events
Time for action — acting on layer update events
What just happened?
Have a go hero — enhancing Treasure Chest
Summary
10. Make Some Money for Bananas
Which markets exist for your game?
iOS
OSX
Android
XNA
HTML5/FLASH
Existing methods of making money
Selling your game at a fixed price
Subscriptions
Advertisement
In-App purchases
Implementing advertising in your app
Which ad providers exist?
Implementing AdMob
iOS
Android
Implementing MobFox in iOS
Signing up at MobFox
Creating the ID for an iOS app in MobFox
Time for action — creating a new MobFox app ID
What just happened?
Implementing MobFox into your XCODE project
Time for action — adding the MobFox framework to the XCODE project
What just happened?
Displaying MobFox ads in the app
Time for action — modifying the code to display ads
What just happened?
Activating real ads
Implementing MobFox in Android
Creating the ID for an Android app in MobFox
Time for action — creating a new MobFox app ID
What just happened?
Implement MobFox into your Android project
Time for action — modifying the project to display ads in Android
What just happened?
Adding a backfill through InMobi
Signing up at InMobi
Create an Android app in InMobi
Time for action — creating an app ID in InMobi
What just happened?
Setting the backfill option in MobFox
Time for action — add a backfill in MobFox
What just happened?
Publishing in the Android market
Create app icons
Change the app label and the package name
Setting the version code and name
Rename the app package
Remove the debug key from the package
Create a private key to sign the app with
Sign the package with your new private key
Zipalign your app package
Publishing in Apple's App Store
Add the app icons
Time for action — adding an icon to the Xcode project
What just happened?
Time for action — setting the product name in the target settings
What just happened?
Set the distribution code signing profile
Time for action — setting the distribution code signing profile
What just happened?
Create a package to submit
Time for action — creating the app package
What just happened?
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜