AdvancED Game Design with Flash ppt

809 930 0
AdvancED Game Design with Flash ppt

Đ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

REX VAN DER SPUY AdvancED Game Design with Flash All the essential techniques that every game designer should know. Physics for games, pathfinding, game structure with the MVC design pattern, tile-based games, vector math, and advanced collision detection strategies. AS3.0 Code compatible with Flash CS3 – CS5, Flash Builder, and the open-source Flex SDK. Download from Wow! eBook <www.wowebook.com> AdvancED Game Design with Flash Rex van der Spuy AdvancED Game Design with Flash AdvancED Game Design with Flash Copyright © 2010 by Rex van der Spuy All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2739-7 ISBN-13 (electronic): 978-1-4302-2740-3 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logos, or image we use the names, logos, or images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. Distributed to the book trade worldwide by Springer Science+Business Media LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. For information on translations, please e-mail rights@apress.com or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section. Credits President and Publisher: Paul Manning Lead Editor: Ben Renow-Clarke Technical Reviewer: Joshua Freeney Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Kelly Moritz Copy Editor: Marilyn Smith Compositor: Lynn L’Heureux Indexer: Brenda Miller Artist: April Milne Cover Designer: Bruce Tang For Mom and Jim, for all your love and support iv Contents at a Glance About the Author xiii About the Technical Reviewer xiv About the Cover Image Designer xv Acknowledgments xi Introduction xvii Chapter 1: Modeling Game Data 1 Chapter 2: Vectors: Ghosts in the Machine 67 Chapter 3: Collisions Between Circles 161 Chapter 4: Collisions Between Polygons 223 Chapter 5: Pixel-Perfect Collision and Destructible Environments 305 Chapter 6: Explosions, Blitting, and Optimization 367 Chapter 7: Make It Fun! Sound, Music, and AI 445 Chapter 8: Tile-Based Game Design 503 Chapter 9: Pathfinding 623 Chapter 10: XML and External Data 691 Index 749 v Contents About the Author xiii About the Technical Reviewer xiv About the Cover Image Designer xv Acknowledgments xi Introduction xvii Chapter 1: Modeling Game Data 1 Verlet integration 2 The problem with Euler integration 3 Understanding Verlet integration 4 Using Verlet integration 5 Using the main application class 13 Onward to Planet X! 18 Introducing the Model-View-Controller Pattern 22 Understanding MVC 23 MVC in action 25 MVC your way 30 An MVC player and map view example 32 Verlet + MVC + physics = fun! 44 A crash course in the drawing API 49 Drawing lines 50 Drawing squares 50 Drawing circles 52 Adding filters 53 Gradient fills 54 Complex shapes 57 Introducing interfaces 64 Summary 66 CONTENTS vi Chapter 2: Vectors: Ghosts in the Machine 67 What are vectors? 68 Vector characteristics 69 Calculating the angle 73 Vector normals 75 Normalizing vectors 78 Using and viewing vectors 80 Creating the vector model 80 Creating the vector view 87 Let’s see what those vectors look like! 87 Adding and subtracting vectors 94 Scaling vectors 96 Gravity in action 100 Real gravity 105 Projecting vectors 105 Are the vectors pointing in the same direction? 107 Projection in action 110 Using vector projection for environmental boundaries 113 Intersection 115 Finding the intersection point 116 Intersection in action 118 Collision and bounce 121 Collision on one side of the line 121 Resolving the collision 129 Bounce 135 Momentum 138 Solid objects 139 Collision on both sides of the line 141 Bounce, friction, and gravity 146 A crash course in embedding assets 151 Embedding fonts 151 Embedding images 152 Important vector formulas 155 Summary 160 CONTENTS vii Chapter 3: Collisions Between Circles 161 Abstract classes 162 Understanding abstract and concrete classes 162 Creating and implementing abstract classes 166 Keyboard and mouse control 176 Collision-handling basics 181 Collisions between moving and stationary circles 181 Collision between a circle and a line 187 Collision between moving circles 202 Multiple-object collision 211 Fast-moving circles 215 Summary 221 Chapter 4: Collisions Between Polygons 223 The separating axis theorem 224 Understanding SAT 224 Using SAT 225 Rectangle collisions 237 Rectangle collision handling in action 238 Bounce and friction 242 Triangle collisions 244 SAT with triangles—the wrong way 246 SAT with triangles—the right way 247 Triangle collision handling in action 250 Triangle collision wrap-up 261 Oriented bounding box collisions 262 Polygon and circle collisions 267 Circle and square collisions 268 Circle and triangle collisions 276 Left-facing triangles 282 Case studies 283 Case study 1: Polygon environment 283 Case study 2: Block Game 286 Multilevel games 301 Summary 303 CONTENTS viii Chapter 5: Pixel-Perfect Collision and Destructible Environments 305 Vector vs. bitmap graphics 306 Using bitmaps 308 Bitmap collisions 309 Checking for a collision 310 The problems with bitmap collision 314 Finding the collision boundary 315 Bitmap collision-detection strategies 320 Convex shapes 321 Surfaces 328 Concave shapes 330 Adding objects to scrolling environments 344 Using two-dimensional arrays 345 Creating and adding the objects 349 Scrolling the objects 350 Building a rotating gun turret 351 Drawing and rotating the cannon 352 Firing bullets 355 Moving and removing bullets 356 Destroying things! 357 Bitmap collision using points 359 Erasing the bitmap 360 Jagged rocks 362 Summary 365 Chapter 6: Explosions, Blitting, and Optimization 367 A simple particle explosion 368 Using timer events for animation 369 Creating the Explosion class 371 A more realistic explosion 378 Taking a snapshot 379 Slicing and dicing 384 Starburst explosions 396 Fast particle explosions 401 Introducing bit-block transfer 401 Basic blitting 404 [...]... you need to know AdvancED Game Design with Flash is a direct follow-up of my book Foundation Game Design with Flash (friends of ED, 2009) If you’ve read that book, and have had a bit of practical experience making some of your own games, you have all the skills and knowledge you need to enjoy the fun we’re going to have in this book If you haven’t read Foundation Game Design with Flash, but have a... 745 Online multiplayer games 746 Further reading 747 Where to next? 747 Index 749 xii About the Author Rex van der Spuy, author of Foundation Game Design with Flash, is a freelance interactive media designer specializing in Flash game design, interface design, and ActionScript programming Rex programmed his first adventure game at 10 years’ old... working examples, and game prototypes you can use in your own projects By the end of the book, you’ll be able to apply these skills to any game idea you might have There’s little that you won’t be able to approach with confidence “Hey, where’s the 3D?” Like Foundation Game Design with Flash, this book strategically omits discussing 3D games The reason is depth (pun intended!) 2D game design is itself such... was his vision for Foundation Game Design and AdvancED Game Design to be two books, and they exist thanks to his consistent vision and encouragement over the two years that it took to write them xvi Introduction Game design is unquestionably one of the most interesting and complex challenges that a programmer can take on If you’ve ever tackled the design of even a simple game, you’ll know that the questions... far better prepared for 3D games if you have a comprehensive understanding of 2D 2D and 3D game design share the same fundamentals, but it’s far easier to learn the craft of game design without the extra layers of complexity you would need to tackle to simultaneously learn a 3D engine At the end of this book, you’ll be a great game designer—in any dimension—and you’ll find 3D games a snap to develop when... the game data 489 New enemy AI techniques 491 Managing game states 498 Now make your own game! 500 Summary 501 Chapter 8: Tile-Based Game Design 503 Tile-based game advantages 504 Building the game world 505 Making tiles 505 Making a map 508 Describing the map with. .. teaches Flash game development classes focused on rapid agile production with maximum reusability He likes board games, camping, sleeping in, and anything LEGO xiv About the Cover Image Designer Bruce Tang is a freelance web designer, visual programmer, and author from Hong Kong His main creative interest is generating stunning visual effects using Flash or Processing Bruce has been an avid Flash user... create game objects using library instances Flash Builder 4: Flash Builder (formerly Flex Builder) is optimized for AS3.0 programming It doesn’t allow you to create game objects visually—there are no drawing tools and no library But it’s probably the best pure-code AS3.0 editor available Flash Builder is free for students If you don’t need or want all the bells and whistles of Flash Professional or Flash. .. modified Saving, loading, and sharing game data Streamlining your game design management and performance by using a tile-based model Pathfinding so that game objects can navigate their way around complex environments This is a classic education in making video games and a compendium of all the important techniques you’ll need to know to flourish as a professional game designer Labyrinthine complexities?... control it gives you over your game environment Things you need to have An integrated development environment (IDE) is the tool that you use to make Flash games Adobe has two commercial IDEs, and you’ve probably already used at least one of them: Flash Professional (also known as Flash CS3, CS4, or CS5): A big advantage to using the Flash IDE is that you can draw your game objects using its drawing . <www.wowebook.com> AdvancED Game Design with Flash Rex van der Spuy AdvancED Game Design with Flash AdvancED Game Design with Flash Copyright © 2010 by Rex van der. SPUY AdvancED Game Design with Flash All the essential techniques that every game designer should know. Physics for games, pathfinding, game structure with the MVC design pattern, tile-based games,. Minotaur. You have this book. Things you need to know AdvancED Game Design with Flash is a direct follow-up of my book Foundation Game Design with Flash (friends of ED, 2009). If you’ve read that

Ngày đăng: 28/03/2014, 23:20

Từ khóa liên quan

Mục lục

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • About the Cover Image Designer

  • Acknowledgments

  • Introduction

    • Things you need to know

    • What about math?

    • Things you need to have

    • Organizing the project folder

      • FLAs and metadata for Flash Professional

      • Using the class library

        • Setting the path to the class library

        • Packages and namespaces

        • Using SWC Files

        • Testing the class library installation

        • Code format conventions

        • Public properties or getters and setters?

        • Modeling Game Data

          • The problem with Euler integration

          • Understanding Verlet integration

          • Using Verlet integration

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

  • Đang cập nhật ...

Tài liệu liên quan