SlideShare a Scribd company logo
1 of 14
Intro to GML Game Maker Language
GML Interpreted programming language that you can use to substantially enhance the games you create using Game Maker Supplement Extend Replace Actions Interpreted Programming Language Scripts are interpreted and compiled just before they are executed
Game Maker Scripts Menu Import Scripts Export Scripts Show Built-In Variables – Global/local variables Show Built-In Functions – Game Maker’s functions Show Extension functions – through extension pkgs Show Constants  Show Resource Names – resources defined in your app Search in Scripts – matching strings Check Resource Names – look for resource name conflicts Check All Scripts – syntax check
Game Maker Scripts Editor Accessed through the Script Properties Window Create scripts by typing the window Auto color-coded Assists in writing code Smart tabs automatically indent statements
Syntax Scripts are made up of one ore more GML code statements embedded within an opening bracket and closing bracket {  } All code statements should end with a semi-colon ;
Adding a script {//set the drawing colordraw_set_color(c_black);//draw a filled rectangledraw_rectangle(50,50,590,430,false);//set the drawing colordraw_set_color(c_yellow);//draw textdraw_text(210,200,"Hello World");} Then assign an object to execute a script May also be created as code if only used once
Executing GML Code to Rooms Can execute code when rooms are created Open a room and click on its settings tab Button at the bottom of the tab labeled Creation Code Code for the room will be executed once (and  only once) when the room is created
GML Scripting Data types Integer – any whole number positive or negative, as well as 0 Real – Numbers that include decimal points String – Set of characters embedded within single or double quotations
Variables Variable – pointer to a location in memory where data is stored Variable names must begin with a letter Letters, numbers, underscores No blanks No game maker language key words or names of defined resources To assign a value to a variable, use the “=“ Name = “Tracy”;
Special Variables X – coordinate for a given object y – “ “ Direction Speed Hspeed Vspeed Solid Sprite_height Sprite_width
Constants A constant is a value whose value is known at design time and does not change during the execution of the game Colors, for example (c_black, c_blue, c_green) Click on “show constants” on the scripts menu Constants cannot be “accidentally” changed, are self-documenting, and typically require less memory
Arrays An array is an indexed list of data that is stored and managed as a collection, preserving the value of the variable and its relationship with other variables One dimensional and two dimensional Arrayname[indices] Ex:  {names[0]=“Captain Jack”;names[1]=“Mad Hatter”;names[2]=“Willy Wonka”;}
Setting up a Loop Set up a loop For(i=0; I<3; i=i+1) {draw_text(x,y,names[i]);     y = y+20} Executes the script three times Can be used to list each item in an array
The IF statement The if statement is used to evaluate an expression and then initate an action if that expression evaluates as true. If (expression){    statements;} Example (if statement as part of a guessing game:if(secretnumber=real(userGuess)) show_message(“You Guessed It”); If statements can be nested

More Related Content

Similar to Intro to gml

C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
Abhinav Vatsa
 
Background This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docxBackground This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docx
rosemaryralphs52525
 
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
MaciasWinter 2020ENG 107Project #2A Year in Gami.docxMaciasWinter 2020ENG 107Project #2A Year in Gami.docx
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
croysierkathey
 
Sterling Integrator Map Editor
Sterling Integrator Map EditorSterling Integrator Map Editor
Sterling Integrator Map Editor
Jeyhind M
 
Jason yousef ssis expressions - no notes
Jason yousef   ssis expressions - no notesJason yousef   ssis expressions - no notes
Jason yousef ssis expressions - no notes
jasonyousef
 

Similar to Intro to gml (20)

unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
C
CC
C
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
Language processors
Language processorsLanguage processors
Language processors
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
Background This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docxBackground This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docx
 
Visual Basic Fundamentals
Visual Basic FundamentalsVisual Basic Fundamentals
Visual Basic Fundamentals
 
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
MaciasWinter 2020ENG 107Project #2A Year in Gami.docxMaciasWinter 2020ENG 107Project #2A Year in Gami.docx
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
Sterling Integrator Map Editor
Sterling Integrator Map EditorSterling Integrator Map Editor
Sterling Integrator Map Editor
 
C programming tutorial
C programming tutorialC programming tutorial
C programming tutorial
 
5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt5-Lec - Datatypes.ppt
5-Lec - Datatypes.ppt
 
Lecture 01 2017
Lecture 01 2017Lecture 01 2017
Lecture 01 2017
 
Cpu
CpuCpu
Cpu
 
C presentation book
C presentation bookC presentation book
C presentation book
 
1. overview of c
1. overview of c1. overview of c
1. overview of c
 
Jason yousef ssis expressions - no notes
Jason yousef   ssis expressions - no notesJason yousef   ssis expressions - no notes
Jason yousef ssis expressions - no notes
 
Javascript
JavascriptJavascript
Javascript
 
The Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s PerspectiveThe Next Mainstream Programming Language: A Game Developer’s Perspective
The Next Mainstream Programming Language: A Game Developer’s Perspective
 

More from Chaffey College (20)

Strings Objects Variables
Strings Objects VariablesStrings Objects Variables
Strings Objects Variables
 
Ruby Chapter 2
Ruby Chapter 2Ruby Chapter 2
Ruby Chapter 2
 
Social networks and games
Social networks and gamesSocial networks and games
Social networks and games
 
Serious games
Serious gamesSerious games
Serious games
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
The games factory 2 alien wars
The games factory 2 alien warsThe games factory 2 alien wars
The games factory 2 alien wars
 
Target markets
Target marketsTarget markets
Target markets
 
Ch 8 introduction to data structures
Ch 8 introduction to data structuresCh 8 introduction to data structures
Ch 8 introduction to data structures
 
Ch 8 data structures in alice
Ch 8  data structures in aliceCh 8  data structures in alice
Ch 8 data structures in alice
 
Ch 7 recursion
Ch 7 recursionCh 7 recursion
Ch 7 recursion
 
Power point unit d
Power point unit dPower point unit d
Power point unit d
 
Power point unit c
Power point unit cPower point unit c
Power point unit c
 
Power point unit b
Power point unit bPower point unit b
Power point unit b
 
Power point unit a
Power point unit aPower point unit a
Power point unit a
 
Gamegraphics
GamegraphicsGamegraphics
Gamegraphics
 
Gamesound
GamesoundGamesound
Gamesound
 
Ch 6 text and sound in alice
Ch 6 text and sound in aliceCh 6 text and sound in alice
Ch 6 text and sound in alice
 
Ch 5 boolean logic
Ch 5 boolean logicCh 5 boolean logic
Ch 5 boolean logic
 

Intro to gml

  • 1. Intro to GML Game Maker Language
  • 2. GML Interpreted programming language that you can use to substantially enhance the games you create using Game Maker Supplement Extend Replace Actions Interpreted Programming Language Scripts are interpreted and compiled just before they are executed
  • 3. Game Maker Scripts Menu Import Scripts Export Scripts Show Built-In Variables – Global/local variables Show Built-In Functions – Game Maker’s functions Show Extension functions – through extension pkgs Show Constants Show Resource Names – resources defined in your app Search in Scripts – matching strings Check Resource Names – look for resource name conflicts Check All Scripts – syntax check
  • 4. Game Maker Scripts Editor Accessed through the Script Properties Window Create scripts by typing the window Auto color-coded Assists in writing code Smart tabs automatically indent statements
  • 5. Syntax Scripts are made up of one ore more GML code statements embedded within an opening bracket and closing bracket { } All code statements should end with a semi-colon ;
  • 6. Adding a script {//set the drawing colordraw_set_color(c_black);//draw a filled rectangledraw_rectangle(50,50,590,430,false);//set the drawing colordraw_set_color(c_yellow);//draw textdraw_text(210,200,"Hello World");} Then assign an object to execute a script May also be created as code if only used once
  • 7. Executing GML Code to Rooms Can execute code when rooms are created Open a room and click on its settings tab Button at the bottom of the tab labeled Creation Code Code for the room will be executed once (and only once) when the room is created
  • 8. GML Scripting Data types Integer – any whole number positive or negative, as well as 0 Real – Numbers that include decimal points String – Set of characters embedded within single or double quotations
  • 9. Variables Variable – pointer to a location in memory where data is stored Variable names must begin with a letter Letters, numbers, underscores No blanks No game maker language key words or names of defined resources To assign a value to a variable, use the “=“ Name = “Tracy”;
  • 10. Special Variables X – coordinate for a given object y – “ “ Direction Speed Hspeed Vspeed Solid Sprite_height Sprite_width
  • 11. Constants A constant is a value whose value is known at design time and does not change during the execution of the game Colors, for example (c_black, c_blue, c_green) Click on “show constants” on the scripts menu Constants cannot be “accidentally” changed, are self-documenting, and typically require less memory
  • 12. Arrays An array is an indexed list of data that is stored and managed as a collection, preserving the value of the variable and its relationship with other variables One dimensional and two dimensional Arrayname[indices] Ex: {names[0]=“Captain Jack”;names[1]=“Mad Hatter”;names[2]=“Willy Wonka”;}
  • 13. Setting up a Loop Set up a loop For(i=0; I<3; i=i+1) {draw_text(x,y,names[i]); y = y+20} Executes the script three times Can be used to list each item in an array
  • 14. The IF statement The if statement is used to evaluate an expression and then initate an action if that expression evaluates as true. If (expression){ statements;} Example (if statement as part of a guessing game:if(secretnumber=real(userGuess)) show_message(“You Guessed It”); If statements can be nested