1. Trang chủ
  2. » Công Nghệ Thông Tin

gamemaker game programming with gml

351 3,4K 1

Đ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

Thông tin cơ bản

Định dạng
Số trang 351
Dung lượng 17,98 MB

Nội dung

www.it-ebooks.info GameMaker Game Programming with GML Learn GameMaker Language programming concepts and script integration with GameMaker: Studio through hands-on, playable examples Matthew DeLucas BIRMINGHAM - MUMBAI www.it-ebooks.info GameMaker Game Programming with GML Copyright © 2014 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: April 2014 Production Reference: 2070514 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78355-944-2 www.packtpub.com Cover Image by Matthew DeLucas (mattrified@gmail.com) www.it-ebooks.info Credits Author Matthew DeLucas Reviewers Ronny Nilsson Chris Sanyk Chris Watts Commissioning Editor Edward Gordon Acquisition Editors Edward Gordon Richard Harvey Luke Presland Content Development Editor Dayan Hyames Technical Editor Veena Pagare Copy Editors Tanvi Gaitonde Insiya Morbiwala Aditya Nair Project Coordinator Mary Alex Proofreaders Stephen Copestake Maria Gould Ameesha Green Linda Morris Indexer Mariammal Chettiyar Production Coordinator Melwyn D'sa Cover Work Melwyn D'sa www.it-ebooks.info About the Author Matthew DeLucas has been a gameplay engineer with Schell Games in Pittsburgh, Pennsylvania for over ve years. He has worked on a wide range of interactive projects for PC, Web, mobiles, and consoles. Matt has also released independent projects for PC and Xbox 360, such as Convextrix, a puzzle game, and Battle High, which is a ghting game series. Being a programmer and designer, Matthew has also participated in almost every ofcial, 48-hour Global Game Jam, managing to help his team achieve success while experimenting with new ideas. Matthew began his programming career in GameMaker: Studio and has become procient with additional game engines, such as Gamebryo and Unity3D, and scripting languages such as C#, Python, Lua, and MaxScript for 3DS Max. Often, he chronicles his experiences with game production on his blog at www.mattrifiedgames.blogspot.com. Matthew has had a desire to work in the game industry ever since he was young, and he enjoys all of the facets of game production—programming, design, and art. His favorite genres include platformer, puzzles, racing, and ghting games, all of which inuence his designs. I wish I could list everyone I am thankful to for helping me complete this book; however, I don't think you, the reader, whom I am also thankful to, would appreciate pages of acknowledgments. Instead, I'd like to simply thank the teachers who inspired me, the friends and co-workers who give me the condence and drive to nish this book, and most importantly, my family, for supporting me and my choice to pursue a career in the gaming industry. www.it-ebooks.info About the Reviewers Ronny Nilsson is an independent game developer with degrees in both interaction and game design. His master's degree project focused on ethical gameplay design and how it can be operationalized into an actual game. His interest in games is deep rooted, ever since his rst encounter with Mario, and has always been present even when he was studying. While primarily being a designer, he also enjoys developing, especially mechanics and prototypes. Residing in Malmö, close to Copenhagen, Ronny lives in an area where the game industry is booming; both independent and multinational game companies are expanding. Still waiting for his own rst wide release, he is currently working on both commercial and experimental games in an attempt to nd playful and unique gameplays. www.it-ebooks.info Chris Sanyk , by day, is an IT professional with over 15 years of experience, and an indie game developer by night. Inspired by the Atari 2600 as a young child, he rst started designing videogames at the age of six, and has been using GameMaker since 2010. He is an active member of the Cleveland Game Developers, Central Ohio Game Developers, and International Game Developers Association, and a regular participant in game jams such as Ludum Dare and Global Game Jam. He has been using GameMaker since 2010, and blogs and releases his projects on his website, csanyk.com. Chris co-authored Wireless Reconnaissance in Penetration Testing, with Matthew Neely and Alex Hammerstone, for Syngress. He has been a technical reviewer for the book HTML5 Game Development with GameMaker, by Jason Elliott, Packt Publishing. I'd like to thank everyone in the game development community for making the scene what it is, especially my friends and colleagues in the Ohio area: Mike Substelny, Ian Schreiber, Mike Geig, Sam Marcus, Steve Felix, Justin Demetroff, Matt Perrin, Jarryd Huntley, Brian Gessler, Eagan Rackley, Ian Faleer, Jeremy Handel, and everyone else. www.it-ebooks.info Chris Watts is a student at the University of Southampton, studying a three-year Bachelor of Science degree course in Computer Science. He rst took interest in computer systems at the age of four as a result of receiving a primitive computer from his grandparents and has followed the interest ever since. Chris has had a very inquisitive mind from a young age and was often found disassembling toys, getting his hand stuck in VCR machines, pulling every lever and pressing every button (much to his parents' dismay) in the quest to learn how everything works. Today, Chris contributes to open source projects and invents new scripts and programs to make life easier in the digital world. He is experienced in working with over 15 programming languages and has interests in electronics, web security, design, photography, and video production. He also offers computer/mobile repair services and web design/development services, and gives tuitions in computers to the elderly during his spare time. Chris' ambition is to make an impact in the technology world, solving problems such as interfacing with portable devices and mass adoption of cloud services. I would like to thank, in particular, my grandmother Susan for dooming me to the domain of computers, my parents for repairing my trail of destruction around the house, and all my friends for putting up with my nerdy nature. It's all very much appreciated. www.it-ebooks.info www.PacktPub.com Support les, eBooks, discount offers and more You might want to visit www.PacktPub.com for support les and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub les available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Getting Started – An Introduction to GML 7 Creating GML scripts 7 Creating GML scripts within an event 8 Creating scripts as resources 8 Scripting a room's creation code 9 Understanding parts of GML scripts 9 Programs 10 snake_case 11 Variables 11 Variable prexes 11 Variable scope 12 Functions and accessing script resources 14 Arguments 15 Expressions 16 Expression symbols 16 Conditional statements 18 if, else, and switch 18 repeat, while, do, and for 20 break, continue, and return 23 Arrays 24 Two-dimensional arrays 25 Commenting 26 Errors 27 Pushing your buttons 28 Creating the project 28 Gathering resources 29 Sprites – spr_button 30 Objects – obj_button 32 Room – rm_main 32 www.it-ebooks.info [...]... Started – An Introduction to GML GML or GameMaker Language is a great tool for expanding the already vast variety of tools provided by GameMaker: Studio GML scripts allow users to write their own code, creating an organized codebase that is easier to modify and debug than GameMaker: Studio's built-in drag-and-drop functionality Before exploring GML' s use in creating actual games, this chapter will go... of software needed for this book is GameMaker: Studio, which can be downloaded at https://www.yoyogames.com/studio This software will only run on Microsoft Windows systems The older version of GameMaker can be downloaded for Mac, but some of the code may not compile in these older versions The projects in this book were made using version 1.2.1279 of GameMaker, with the studio license, which is free,... this text GameMaker: Studio is just one of many game engines; likewise, GameMaker Language is just one of many programming languages out there Learning these tools should not be the end of one's journey into the vast topic of game development, but instead another stone in a strong foundation, even if it is the first one What this book covers Chapter 1, Getting Started – An Introduction to GML, introduces... used in the creation of a modular button Creating GML scripts Before diving into any actual code, the various places in which scripts can appear in GameMaker as well as the reasoning behind placing scripts in one area versus another should be addressed www.it-ebooks.info Getting Started – An Introduction to GML Creating GML scripts within an event Within an object, each event added can either contain... syntax of GameMaker Language (GML) These topics will be expanded by creating a simple button Chapter 2, Random Organization – Creating a Puzzle Game, discusses sprite resources and randomization A grid of puzzle pieces is created, which acts as the base for a puzzle game project Chapter 3, So How Do I Play? – Adding Player Interaction, teaches us how to add player interaction to the puzzle game using... – Creating a Puzzle Game Understanding sprite variables and functions Positioning and origin Layering with depth 45 46 46 46 Rotating 47 Scaling 48 Working with frames and color 48 Setting up the puzzle game 50 Sprites – spr_grid 50 spr_pieces 50 Objects – obj_grid_manager 51 obj_grid_block and obj_puzzle_piece 52 Room – rm_gameplay 52 Scripts 52 Aligning the pieces of the puzzle game to a grid 53 The... 234 237 Table of Contents Preparing the game for obj_camera The Create event The End Step event Adding the camera with Creation Code Setting the environment – backgrounds Introducing background variables Creating background resources Preparing the game for background resources Building an atmosphere with bg_main Utilizing the background Setting a background index with bg_index Scripting scr_inverse_lerp... of GML scripts GML scripts are made up of many different parts The following section will go over these different parts and their syntax, formatting, and usage [9] www.it-ebooks.info Getting Started – An Introduction to GML Programs A program is a set of instructions that are followed in a specific order One way to think of it is that every script written in GML is essentially a program Programs in GML. .. by themselves or by other game objects and are the most common variables in GML • Local: Local variables are those that exist only within a function or script They are declared using the var keyword and can be accessed only within the scripts in which they've been created • Global: A variable that is global can be accessed by any object through scripting It belongs to the game and not an individual... player interaction Reading input with the mouse Understanding mouse variables and functions Working with touch devices Creating resources to integrate mouse input into the puzzle game Adding new events to obj_grid_manager The Create event Updating spr_grid and obj_grid_block Adding new frames to spr_grid Implementing the Mouse events for obj_grid_block Entering the grid with the mouse Pressing the left . www.it-ebooks.info GameMaker Game Programming with GML Learn GameMaker Language programming concepts and script integration with GameMaker: Studio through hands-on, playable. success while experimenting with new ideas. Matthew began his programming career in GameMaker: Studio and has become procient with additional game engines, such as Gamebryo and Unity3D, and. hands-on, playable examples Matthew DeLucas BIRMINGHAM - MUMBAI www.it-ebooks.info GameMaker Game Programming with GML Copyright © 2014 Packt Publishing All rights reserved. No part of this book

Ngày đăng: 01/08/2014, 17:15

TỪ KHÓA LIÊN QUAN