售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Creative Greenfoot
Table of Contents
Creative Greenfoot
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
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. Let's Dive Right in…
The Avoider Game tutorial
Basic game elements
Creating a scenario
Creating our world
Creating our hero
What have we just done?
Adding our hero
Using the mouse as a game controller
Creating the followMouse function
Breaking down the code
Adding enemies
Enemy code
Creating an army
Unbounding the world
Memory management
Your assignment
Next…
Making it a game
Detecting collisions
Adding a game-over screen
Switching scenes
Adding a "play again" button
Adding an introduction screen
Setting the initial screen
Adding a "play" button
Adding background music
Writing the music code
Analyzing the music code
Stop the music
Your assignment
Next…
Enhancing playability
Game scoring
Adding the Counter class
Increasing the score over time
Adding levels
Increasing spawn rates and enemy speed
Increasing difficulty based on the score
Implementing enemy speed increases
Your assignment
Next…
Summary
2. Animation
Revisiting Avoider Game
Image swapping and movement
Using setImage()
Making enemies less happy
Finding assets
Calling setImage() based on Actor location
Using setLocation()
Creating a star field
A blank slate
The Star class
Creating a moving field
Using parallax
Using GreenfootImage
Timing and synchronization
Delay variables
Hurting the avatar
Random actions
Blinking
Triggered events
Adding eyes
Giving our hero sight
Easing
Power-ups and power-downs
Base class
Linear easing
Exponential easing
Sinusoidal easing
Changes to the Avatar class
Changes to the AvoiderWorld class
Avoider Game
Your assignment
Summary
3. Collision Detection
ZombieInvasion interactive simulation
Dynamically creating actors in ZombieInvasionWorld
Creating obstacles
Creating our main actor framework
Creating an explosion
Test it out
Built-in collision detection methods
Detecting a collision with a single object
isTouching() and removeTouching()
Detecting a collision with multiple objects
Detecting multiple objects in range
Time to test it out
Border-based collision detection methods
Detecting single-object collisions at an offset
Detecting multiple-object collisions at an offset
Hidden-sprite collision detection methods
Challenge
Summary
4. Projectiles
Cupcake Counter
How to play
Implementing Cupcake Counter
The CupcakeWorld class
Enemies
Fountains
Turrets
Rewards
Jumpers
Platforms
Test it out
Your assignment
Launching actors
Gravity and jumping
Bouncing
Particle effects
Bullets and turrets
Your assignment
Challenge
Summary
5. Interactive Application Design and Theory
Meaningful play
Complexity
Goals
User conditioning
Storytelling
Fictional worlds
Narrative descriptors
The interactive entertainment iterative development process
Game pitch and initial design
Prototype
Playtest
Evaluation
Refinement
Benefits
Avoider Game
Avoider Game recap
High-score list
Achievement badges
Player conditioning
Storytelling
Adding a story screen
Changing the score
Adding sound effects
Playtesting
Challenge
Additional readings
Summary
6. Scrolling and Mapped Worlds
Chapter scenario examples
Dynamically generated worlds
Side-scrolling
The Rocket class
The CloudsWorld class
Side-scrolling actors
Clouds
Walls
Try it out
Mapped worlds
Side-scrolling
The HikingWorld class
The Hiker class
The ScrollingActor class
Try it out
2D scrolling
The HikingWorld2D class
The Hiker class
The ScrollingActor class
Try it out
Tile-based worlds
Actors as tiles
The HikingWorld class
The Hiker class
The ScrollingActor class
Tiles
The Lake class
Try it out
Other game sprites
Summary
7. Artificial Intelligence
The MazeWorld scenario
The MazeWorld class
The Hiker class
Scrolling actor
The ScrollingObstacle class
Intelligently behaving actors
The ScrollingEnemy class
Randomness
Spider
Behavior heuristics
The Snake class
A* pathfinding
Overview
Algorithm
The Mouse class
Play test
Summary
8. User Interfaces
UIWorld
The Button class
The TextBox class
The Menu class
Heads-up display
Adding a UI to MazeWorld
Adding menus and buttons
Adding a HUD
Implementing game difficulty settings and HUD controls
Summary
9. Gamepads in Greenfoot
Gamepad overview
Windows setup
Connecting your controller
Greenfoot gamepad software
The Greenfoot Gamepad API
Overview
The GamePad and Direction classes
Avoider Game with Gamepad
Try it out
OS X setup/workarounds
Gamepad mapper software
Exporting games with gamepads
Summary
10. What to Dive into Next…
Build something larger
Share your work
Publishing on Greenfoot.org
Desktop application
Exporting as a web page
Explore other input devices
Learn more Java
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜