mastering android game development portales 2015 07 01 Lập trình android

498 46 0
mastering android game development portales 2015 07 01 Lập trình android

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

CuuDuongThanCong.com CuuDuongThanCong.com Mastering Android Game Development CuuDuongThanCong.com Table of Contents Mastering Android 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 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 Setting Up the Project The right tool for the right game Do you want to use 3D? Do you want to use physics? Do you want to use Java? Pros of building games with the Android SDK Cons of building games with the Android SDK I want the Android SDK! The project – YASS (Yet Another Space Shooter) CuuDuongThanCong.com Activities and Fragments Project setup Creating the stub project Cleaning up Choosing an orientation Dealing with aspect ratios Game architecture GameEngine and GameObjects Starting a game Stopping a game Managing game objects UpdateThread DrawThread User input Putting everything together Moving forward with the example Handling the back key Honoring the lifecycle Using as much screen as we can Before Android 4.4 – almost fullscreen Android 4.4 and beyond – immersive mode Putting fullscreen together Good practices for game developers Object pools Avoiding enhanced loop syntax in lists Precreating objects Accessing variables directly Being careful with floating points Performance myths – avoid interfaces Summary Managing User Input CuuDuongThanCong.com The InputController base class The Player object Displaying a spaceship Firing bullets The Bullet game object The most basic virtual keypad Limitations and problems Creating a virtual joystick General considerations and improvements Physical controllers Handling MotionEvents Handling KeyEvents Detecting gamepads Sensors and InputControllers Selecting control modes Summary Into the Draw Thread Using GameView The GameView interface StandardGameView SurfaceGameView Updating GameEngine Updating the game layout Improving DrawThread Sprites Updating the spaceship and bullets Adding a frames-per-second (fps) counter Spawning enemies – the GameController Procedural/random Deterministic/static Hybrid approach CuuDuongThanCong.com Our approach The asteroids More on the transformation matrix Occlusion culling Parallax backgrounds Multiple backgrounds Layers Summary Collision Detection Detecting collisions Who can collide? Updating GameEngine Handling collisions Rectangular bodies Adding visual feedback Pros and cons Circular bodies Adding visual feedback Pros and cons Mixed collision detection Adding visual feedback Other options for shapes Optimization Spatial partitioning and QuadTree Duplicated collisions Summary Particle Systems General concepts Particles ParticleSystem Initializers CuuDuongThanCong.com Modifiers Composite GameObjects and GameEngine Making good particle systems One shot Asteroid explosions Spaceship explosions Emitters Asteroid trails The spaceship’s engine Summary Sound FX and Music SoundManager Sound FX How to create sound FXs GameEvents Using SoundPool Playing music Obtaining music MediaPlayer Music and Activity life cycle Enabling and disabling music and sound FX Updating MainMenuFragment Updating SoundManager Disabling system sounds Summary Menus and Dialogs Custom fonts Working with backgrounds The power of XML drawables State list drawables State lists colors CuuDuongThanCong.com Shape drawables The GameFragment Adding a score Adding lives Custom dialogs BaseCustomDialog Quit dialog Pause dialog Game Over dialog Other dialogs Designing for multiple screen sizes Summary The Animation Framework Updating BaseFragment AnimationDrawable Animated sprites Animating views XML versus code Interpolators View animation Animating dialogs Delaying the action in the dialogs to onDismissed Pulsating buttons Property animation ViewPropertyAnimator Moving a spaceship around Animating the main menu Summary Integrating Google Play Services Setting up the developer console Setting up the code CuuDuongThanCong.com Achievements Architecture Unlocking achievements Leaderboards Opening the Play Games UI Other features of Google Play services Events Quests Gifts Saved games Multiplayer games Summary 10 To the Big Screen Project configuration Testing for Android TV Declaring a TV Activity Providing a home screen banner Declaring it as a game Declaring Leanback support Declaring touchscreen capability as not required Reviewing the manifest Showing controller instructions Dealing with overscan Controller-based navigation Dialogs and controllers Beyond this book Summary A API Levels for Android Versions Index CuuDuongThanCong.com L layers about / Layers leaderboards about / Leaderboards Leanback support declaring / Declaring Leanback support Leonids particle system library URL / General concepts CuuDuongThanCong.com M MainMenuFragment updating / Updating MainMenuFragment MediaPlayer / MediaPlayer member variables, BaseCustomDialog mParent / BaseCustomDialog mRootLayout / BaseCustomDialog mRootView / BaseCustomDialog mIsShowing / BaseCustomDialog modifiers about / General concepts, Modifiers MotionEvents handling / Handling MotionEvents multiplayer games URL / Multiplayer games multiple screen sizes designing / Designing for multiple screen sizes music playing / Playing music obtaining / Obtaining music MediaPlayer / MediaPlayer life cycle / Music and Activity life cycle and activity, life cycle / Music and Activity life cycle enabling / Enabling and disabling music and sound FX disabling / Enabling and disabling music and sound FX CuuDuongThanCong.com N navigation bar / Using as much screen as we can CuuDuongThanCong.com O occlusion culling about / Occlusion culling one shot about / One shot asteroid explosion / Asteroid explosions spaceship explosion / Spaceship explosions orientation selecting / Choosing an orientation aspect ratios / Dealing with aspect ratios overscan / Dealing with overscan CuuDuongThanCong.com P parallax backgrounds about / Parallax backgrounds multiple backgrounds / Multiple backgrounds particle about / General concepts particles about / Particles ParticleSystem about / ParticleSystem particle systems about / General concepts creating / Making good particle systems pause dialog about / Pause dialog physical controllers about / Physical controllers MotionEvents, handling / Handling MotionEvents KeyEvents, handling / Handling KeyEvents gamepads, detecting / Detecting gamepads PlacingSpaceship state / Adding lives Player object about / The Player object spaceship, displaying / Displaying a spaceship bullets, firing / Firing bullets Play Games UI opening / Opening the Play Games UI priori / Detecting collisions project setting up / Project setup stub project, creating / Creating the stub project cleaning up / Cleaning up property animation about / Property animation ViewPropertyAnimator / ViewPropertyAnimator spaceship, moving around / Moving a spaceship around main menu, animating / Animating the main menu CuuDuongThanCong.com Q QuadTree about / Spatial partitioning and QuadTree qualifying dimensions / Designing for multiple screen sizes qualifying resources about / Designing for multiple screen sizes smallest width / Designing for multiple screen sizes available screen width / Designing for multiple screen sizes available screen height / Designing for multiple screen sizes quests / Quests quit dialog about / Quit dialog CuuDuongThanCong.com R real-time games URL / Multiplayer games rectangular bodies about / Rectangular bodies visual feedback, adding / Adding visual feedback CuuDuongThanCong.com S tag Width attribute / Shape drawables Color attribute / Shape drawables DashGap/DashWith attribute / Shape drawables saved games URL / Saved games sensors about / Sensors and InputControllers URL / Sensors and InputControllers shape attribute, values rectangle / Shape drawables oval / Shape drawables line / Shape drawables ring / Shape drawables shape drawables about / Shape drawables tag / Shape drawables tag / Shape drawables tag / Shape drawables tag / Shape drawables tag / Shape drawables tag / Shape drawables tag / Shape drawables shape, defining / Shape drawables styles, defining / Shape drawables Sound FX about / Sound FX, Enabling and disabling music and sound FX creating / How to create sound FXs GameEvents / GameEvents SoundPool, using / Using SoundPool SoundManager about / SoundManager updating / Updating SoundManager SoundPool using / Using SoundPool sounds disabling / Disabling system sounds SpawningEnemies state / Adding lives sprites about / Sprites member variables / Sprites drawBitmap method / Sprites CuuDuongThanCong.com spaceship, updating / Updating the spaceship and bullets bullet, updating / Updating the spaceship and bullets state list drawables about / State list drawables colors, defining / State lists colors status bar / Using as much screen as we can StoppingWave state / Adding lives CuuDuongThanCong.com T tools selecting / The right tool for the right game 3D / Do you want to use 3D? physics / Do you want to use physics? Java / Do you want to use Java? CuuDuongThanCong.com U Update thread / UpdateThread CuuDuongThanCong.com V view animation about / Animating views, XML versus code, View animation dialogs, animating / Animating dialogs, Delaying the action in the dialogs to onDismissed buttons, pulsating / Pulsating buttons ViewPropertyAnimator about / ViewPropertyAnimator, Moving a spaceship around virtual joystick about / Creating a virtual joystick improvements / General considerations and improvements virtual keypad about / The most basic virtual keypad limitations / Limitations and problems problems / Limitations and problems CuuDuongThanCong.com W Waiting state / Adding lives CuuDuongThanCong.com X XML versus code / XML versus code XML drawables about / The power of XML drawables CuuDuongThanCong.com Y YASS (Yet Another Space Shooter) / The project – YASS (Yet Another Space Shooter) CuuDuongThanCong.com ... Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 97 8-1 -7 835 5-1 7 7-4 www.packtpub.com CuuDuongThanCong.com CuuDuongThanCong.com Credits Author Raul Portales... Updating the game layout Improving DrawThread Sprites Updating the spaceship and bullets Adding a frames-per-second (fps) counter Spawning enemies – the GameController Procedural/random Deterministic/static... CuuDuongThanCong.com CuuDuongThanCong.com About the Reviewers Sergio Viudes Carbonell is a 32-year-old developer from Elche (Spain) He has loved to play video games since his childhood days (since the ZX Spectrum was around)

Ngày đăng: 29/08/2020, 16:34

Mục lục

  • Mastering Android 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

  • 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

Tài liệu cùng người dùng

Tài liệu liên quan