GameMaker Game Programming with GML


GameMaker Game Programming with GML
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Write and utilize scripts to help organize and speed up your game production workflow
  • Display important user interface components such as score, health, and lives
  • Play sound effects and music, and create particle effects to add some spice to your projects
  • Learn how to script common game features: artificial intelligence, collision, reading input, and player feedback
  • Build your own example match-three puzzle and platform games

Book Details

Language : English
Paperback : 350 pages [ 235mm x 191mm ]
Release Date : April 2014
ISBN : 1783559446
ISBN 13 : 9781783559442
Author(s) : Matthew DeLucas
Topics and Technologies : All Books, Game Development


Table of Contents

Preface
Chapter 1: Getting Started – An Introduction to GML
Chapter 2: Random Organization – Creating a Puzzle Game
Chapter 3: So How Do I Play? – Adding Player Interaction
Chapter 4: Juicy Feedback – Aural and Visual Effects
Chapter 5: Solving the Puzzle – Finishing Touches to the Puzzle Game
Chapter 6: Finite State Machines – Starting the 2D Platformer
Chapter 7: It's in the Name – Platforms and Collisions
Chapter 8: Setting the Stage – Views, Backgrounds, and Tiles
Chapter 9: Breaking Vlad – Pickups, Hazards, and Enemies
Chapter 10: GOAL – Timelines and Feedback Review
Index
  • Chapter 1: Getting Started – An Introduction to GML
    • Creating GML scripts
      • Creating GML scripts within an event
      • Creating scripts as resources
      • Scripting a room's creation code
    • Understanding parts of GML scripts
      • Programs
        • snake_case
      • Variables
        • Variable prefixes
        • Variable scope
      • Functions and accessing script resources
        • Arguments
      • Expressions
        • Expression symbols
      • Conditional statements
        • If, else, and switch
        • repeat, while, do, and for
        • break, continue, and return
      • Arrays
        • Two-dimensional arrays
      • Commenting
      • Errors
    • Pushing your buttons
      • Creating the project
      • Gathering resources
        • Sprites – spr_button
        • Objects – obj_button
        • Room – rm_main
      • The events of obj_button
        • The Create event
        • The Left Button event
        • The Left Pressed event
        • The Mouse Enter event
        • The Mouse Leave event
        • The Global left release event
      • The Draw GUI event
        • Scripts – scr_create_button
        • scr_random_position
      • Creating buttons using scripts
        • Scripting room creation code
        • Creating scr_random_position
      • Exporting and importing the button
    • Summary
  • Chapter 2: Random Organization – Creating a Puzzle Game
    • Understanding sprite variables and functions
      • Positioning and origin
        • Layering with depth
      • Rotating
      • Scaling
      • Working with frames and color
    • Setting up the puzzle game
      • Sprites – spr_grid
        • spr_pieces
        • Objects – obj_grid_manager
        • obj_grid_block and obj_puzzle_piece
        • Room – rm_gameplay
        • Scripts
    • Aligning the pieces of the puzzle game to a grid
      • The Create event of obj_grid_manager
      • scr_create_in_grid
    • Understanding and utilizing randomization
      • Random functions
      • Randomizing the board
    • Checking pieces
      • scr_get_puzzle_piece
      • scr_check_adjacent
      • scr_check_board
    • Running it all together
    • Summary
  • Chapter 3: So How Do I Play? – Adding Player Interaction
    • Designing 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 mouse button
        • Releasing the left mouse button globally
        • The Mouse Leave event
      • Swapping pieces
      • obj_puzzle_piece
        • scr_swap_pieces
      • Updating scr_check_board
    • Updating organization with scr_reorganize_board
    • Integrating keyboard input
      • Introducing keyboard functions, variables, and events
      • Integrating the Keyboard event updates
        • Utilizing the press <any key> event
        • Implementing the release <any key> event
    • Summary
  • Chapter 4: Juicy Feedback – Aural and Visual Effects
    • Introducing alarms
      • Arming the puzzle game's alarms
      • Setting up the first alarm
      • Are pieces shifting?
        • Applying is_shifting_pieces
      • Determining where pieces should move
        • Setting the Alarm 0 event of obj_puzzle_piece
        • Making pieces fall with Alarm 1 in obj_puzzle_piece
      • Setting the alarms
        • Updating scr_swap_pieces
        • Updating scr_check_board
        • Updating scr_reorganize_board
    • Hiding the pin drop – adding audio
    • Creating sound resources
      • Gathering audio resources
      • Introducing audio functions
      • Playing puzzling sounds
        • Swapping sounds in scr_swap_pieces
        • Playing the pop sound in scr_reorganize_board
        • Fading in the music with obj_grid_manager
    • Visualizing effects with particles
      • Managing a particle system
      • Emitting particles
        • Shaping and distributing within emitters
      • Creating different particle types
        • Shaping particle types
      • Particle-specific functions
    • Integrating particles
      • obj_particle_manager
        • The Create event
        • The Destroy event
        • Placing obj_particle_manager
      • Creating bursts within scr_reorganize_board
    • Summary
  • Chapter 5: Solving the Puzzle – Finishing Touches to the Puzzle Game
    • Drawing and graphical user interface
      • Understanding draw functions
        • Drawing rectangles
        • Setting color and alpha
      • Drawing circles and ellipses
        • Setting a circle's precision
      • Drawing points, lines, and arrows
        • Drawing text
        • Setting font and text alignment
      • Drawing sprites
        • Tiling sprites
      • Establishing the drawing order
    • Gathering resources for creating the main menu
      • Creating obj_main_menu
      • Building a new room – rm_main_menu
      • Creating fonts – fnt_title and fnt_main
        • Creating the fonts
    • Scripting obj_main_menu
      • The Create event
        • Utilizing div and mod
      • Drawing the menu
      • The Global Left Button event
      • The press <any key> event
      • The Global Left Release event
      • The release <any key> event
        • event_perform
      • scr_on_menu_button_pressed
    • Changing obj_grid_manager
    • Integrating score and time
      • Scoring and combos
      • The Create event of obj_grid_manager
      • Earning points in scr_reorganize_board
      • Drawing UI in obj_grid_manager
      • Timing and game over
      • Adding new variables to the Create event of obj_grid_manager
      • Using Alarm 1 and Alarm 2 in obj_grid_manager
        • Alarm 1
        • Alarm 2
      • Drawing the timer
    • Summary
  • Chapter 6: Finite State Machines – Starting the 2D Platformer
    • Introducing finite state machines
    • Gathering resources for the platformer
      • Establishing Lil' Vlad's sprites
        • The standing sprite – spr_vlad_idle
        • The walking sprite – spr_vlad_walk
        • The jumping sprite – spr_vlad_jump
      • Jumping with sound – snd_jump
      • Creating a new object resource – obj_vlad
        • Utilizing the User defined events
      • Placing Vlad in a room – rm_level1
    • Defining Vlad's state constants
    • Starting Vlad's events and scripts – walking
      • The Create event
      • The Step event
      • Standing still – the User Defined 0 event
      • Walk this way – the User Defined 1 event
      • Adding new variables for jumping
      • Using up to jump – the Step event update
      • Falling state – the User Defined 2 event
      • Looping the jump – the Animation End event
    • Summary
  • Chapter 7: It's in the Name – Platforms and Collisions
    • Collision – a crash course
      • Creating masks for collision
      • Working with placement and movement functions
        • Testing placement
        • Movement functions
    • Gathering resources to build platforms
      • Sprites – spr_basic_platform and spr_solid_platform
      • Objects – obj_basic_platform and obj_solid_platform
        • Solidifying objects
    • Populating the room
    • Working with Collision events
      • Updating the Create event of obj_vlad
      • The Collision events of obj_vlad
      • Creating the script resource scr_test_collision
      • Updating the Step event
    • Moving platforms with paths
      • Creating path resources
      • Utilizing the path_start function
      • Gathering resources for the path creation
      • The spr_moving_platform sprite
      • obj_moving_platform
      • pth_horizontal and pth_vertical_ellipse
    • Integrating the moving platforms
      • Creating instances of obj_moving_platform
      • Interacting with obj_moving_platform
        • Creating a new variable – current_platform
        • Updating to the User Defined 2 event
        • scr_test_collision and current_platform
        • Using the Step End event
      • Drawing a path
    • Preventing Vlad from leaving
      • Defining global.room_left and global.room_right
      • Updating the End Step event
    • Knowing the design ahead of time (when possible)
    • Summary
  • Chapter 8: Setting the Stage – Views, Backgrounds, and Tiles
    • Expanding the room – views
      • Setting the view
    • Adjusting view parameters
    • 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
        • Moving the background in the End Step event of obj_camera
    • Introducing tiles
      • Creating tiles
      • Building resources for tiles
        • Tiling with bg_tiles_main
      • Applying tiles
      • Utilizing tile_add and other tile functions
      • Placing tiles with scripts – scr_define_tiles
      • Using scr_define_tiles
      • Drawing tiles in obj_moving_platform
    • Summary
  • Chapter 9: Breaking Vlad – Pickups, Hazards, and Enemies
    • Tracking health with Draw and Draw GUI
      • Displaying UI with the Draw and Draw GUI events
        • Creating a new font – fnt_score_text
        • Setting up the Draw GUI event
        • Displaying health with the Draw event
        • Updating the Create event
        • Arming the Alarm 0 event in obj_vlad
    • Working with pickups
      • Gathering resources to create pickups
        • Initializing sprite resources for pickups
        • Pickup object resources
        • Script resource – scr_collect_pickup
        • Colliding with obj_vlad
    • Dying from hazards
      • Establishing a death state
        • Setting up two new events – User Defined 3 and Alarm 1
      • Gathering resources for hazards
        • Creating the sprite and object resources
        • Scripting scr_damage_vlad
      • Falling off the screen into the abyss
    • Fighting the player with enemies
      • Enemy 1 – mutant garlic
        • Gathering resources for garlic
        • Sprite resource – spr_enemy_garlic
        • Object resource – obj_enemy_garlic
        • Scripting the Create event of obj_enemy_garlic
        • Making garlic move with the Step event
        • Reacting upon collision with scr_collide_enemy
        • Colliding with the player – the Collision event of obj_vlad
      • Enemy 2 – the flying book
        • Gathering resources to create the flying book
        • The sprite resource – spr_enemy_book
        • The object resource – obj_enemy_book
        • Initializing the Create event of obj_enemy_book
        • Anthropomorphizing the book in the Step event
    • Summary
  • Chapter 10: GOAL – Timelines and Feedback Review
    • GOAL!
      • Gathering resources for creating the goal
        • Sprite resource – spr_goal_door
        • Object resource – obj_goal_door
    • Introducing timelines
      • Using timelines
    • Gathering resources for integrating the timeline
      • Font resource – fnt_large_text
      • Creating and updating events for obj_goal_door
        • Using the Animation End event
        • Drawing congratulatory text with the Draw GUI event
      • Deactivating objects with scr_deactive_instances and the Draw event
        • Freezing instances with scr_deactivate_instances
        • Drawing deactivated instances
    • Creating and applying the timeline
      • Step 0
      • Step 15
      • Step 90
      • Applying tm_finish_level
    • Reviewing polish, feedback, and juiciness
      • Gathering resources to play sounds
      • Playing music with scr_play_music
      • Reviewing the obj_particle_manager object
      • Giving feedback with pickups
    • Providing feedback when Vlad is damaged
    • Extending the enemy death sequence
      • Updating scr_collide_enemy and Step events for enemies
      • Creating tm_enemy_death
        • Step 0
        • Step 5
        • Step 25
        • Step 30
    • Summary
    • In closing...

Matthew DeLucas

Matthew DeLucas has been a gameplay engineer with Schell Games in Pittsburgh, Pennsylvania for over five 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 fighting game series. Being a programmer and designer, Matthew has also participated in almost every official, 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 proficient 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 fighting games, all of which influence his designs.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 15 May 2014

Due to word formatting, some comments were moved to next line. Also, the minus signs are turned into dash. It is advisable that the readers use the code files instead of copy-pasting the code from the e-book.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

GameMaker Game Programming with GML +    PhoneGap 3.x Mobile Application Development Hotshot =
50% Off
the second eBook
Price for both: $41.55

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Create script resources as well as custom scripts for events
  • Learn how to import, compress, and play sound effects and background music
  • Build particle effect systems to give games a little extra flare
  • Track and display user interface elements such as health and scoring
  • Program and interact with simple yet challenging artificial intelligence
  • Read player input from a variety of sources
  • Utilize alarms to create a clean series of events
  • Establish a finite state machine to track a character's current state
  • Complete easy and fun games from start to finish

In Detail

GameMaker: Studio is a popular game engine used to publish games to a variety of platforms. Although GameMaker: Studio's drag-and-drop functionality makes creating games simple and fast, utilizing scripts can really help organize and speed up GameMaker's workflow exponentially.

This hands-on guide will help you build a strong foundation in programming in GameMaker Language by taking you through several example games. Knowledge gained by the end of the book can be applied so you can build your own line of exciting games.

Approach

A step-by-step approach to build your knowledge, starting from a simple "hello world" to discovering arrays, classes, and so on. Each learning point is explained in a practical way, carrying out tasks within the GameMaker development environment.

Who this book is for

If you are a GameMaker: Studio developer, having little experience with writing scripts and are looking to expand that skill set, this is the book for you. It is assumed that you can already navigate GameMaker: Studio to some degree. Because this book focuses on the scripting and integration of scripts to aid in the production of a game, instead of game design, it would also be useful for you to have access (or have the ability) to create the visual and audio assets that are presented in the examples throughout this book.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software