SlideShare a Scribd company logo
Intro to GMLGame Maker Language
GMLInterpreted programming language that you can use to substantially enhance the games you create using Game MakerSupplementExtendReplace ActionsInterpreted Programming LanguageScripts are interpreted and compiled just before they are executed
Game Maker Scripts MenuImport ScriptsExport ScriptsShow Built-In Variables – Global/local variablesShow Built-In Functions – Game Maker’s functionsShow Extension functions – through extension pkgsShow Constants Show Resource Names – resources defined in your appSearch in Scripts – matching stringsCheck Resource Names – look for resource name conflictsCheck All Scripts – syntax check
Game Maker Scripts EditorAccessed through the Script Properties WindowCreate scripts by typing the windowAuto color-codedAssists in writing codeSmart tabs automatically indent statements
SyntaxScripts 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 scriptMay also be created as code if only used once
Executing GML Code to RoomsCan execute code when rooms are createdOpen a room and click on its settings tabButton at the bottom of the tab labeled Creation CodeCode for the room will be executed once (and  only once) when the room is created
GML ScriptingData typesInteger – any whole number positive or negative, as well as 0Real – Numbers that include decimal pointsString – Set of characters embedded within single or double quotations
VariablesVariable – pointer to a location in memory where data is storedVariable names must begin with a letterLetters, numbers, underscoresNo blanksNo game maker language key words or names of defined resourcesTo assign a value to a variable, use the “=“Name = “Tracy”;
Special VariablesX – coordinate for a given objecty – “ “DirectionSpeedHspeedVspeedSolidSprite_heightSprite_width
ConstantsA constant is a value whose value is known at design time and does not change during the execution of the gameColors, for example (c_black, c_blue, c_green)Click on “show constants” on the scripts menuConstants cannot be “accidentally” changed, are self-documenting, and typically require less memory
ArraysAn 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 variablesOne dimensional and two dimensionalArrayname[indices]Ex:  {names[0]=“Captain Jack”;names[1]=“Mad Hatter”;names[2]=“Willy Wonka”;}
Setting up a LoopSet up a loopFor(i=0; I<3; i=i+1) {draw_text(x,y,names[i]);     y = y+20}Executes the script three timesCan be used to list each item in an array
The IF statementThe 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

PPT
Oficina de Jogos Educativos
PDF
Basics of R programming for analytics [Autosaved] (1).pdf
PPTX
Unit 2- Module 2.pptx
PDF
C programming introduction for beginners.pdf
PDF
Keywords, identifiers ,datatypes in C++
PPTX
Designing Optimized Symbols for InduSoft Web Studio Projects
PPT
Visula C# Programming Lecture 2
ODP
C prog ppt
Oficina de Jogos Educativos
Basics of R programming for analytics [Autosaved] (1).pdf
Unit 2- Module 2.pptx
C programming introduction for beginners.pdf
Keywords, identifiers ,datatypes in C++
Designing Optimized Symbols for InduSoft Web Studio Projects
Visula C# Programming Lecture 2
C prog ppt

Similar to Intro to gml (20)

PPTX
C Program basic concepts using c knoweledge
PPTX
Scripting in InduSoft Web Studio
PPTX
C language ppt
PPTX
unit 1 (1).pptx
PPTX
ODP
CProgrammingTutorial
PPT
C the basic concepts
PDF
Language processors
PPTX
C programming Training in Ambala ! Batra Computer Centre
DOCX
Background This course is all about data visualization. However, we.docx
PPTX
Visual Basic Fundamentals
DOCX
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
PDF
C++ Pointers , Basic to advanced Concept
PPTX
Lesson 4 Basic Programming Constructs.pptx
PPTX
C++ lecture 01
PPTX
Sterling Integrator Map Editor
DOCX
C programming tutorial
PPT
5-Lec - Datatypes.ppt
PPTX
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
PPTX
overview of c, history, structure, data types, tokens in c, constants, variab...
C Program basic concepts using c knoweledge
Scripting in InduSoft Web Studio
C language ppt
unit 1 (1).pptx
CProgrammingTutorial
C the basic concepts
Language processors
C programming Training in Ambala ! Batra Computer Centre
Background This course is all about data visualization. However, we.docx
Visual Basic Fundamentals
MaciasWinter 2020ENG 107Project #2A Year in Gami.docx
C++ Pointers , Basic to advanced Concept
Lesson 4 Basic Programming Constructs.pptx
C++ lecture 01
Sterling Integrator Map Editor
C programming tutorial
5-Lec - Datatypes.ppt
C++ Introduction to basic C++ IN THIS YOU WOULD KHOW ABOUT BASIC C++
overview of c, history, structure, data types, tokens in c, constants, variab...
Ad

More from Chaffey College (20)

PPT
Strings Objects Variables
PPT
Ruby Chapter 2
PPTX
Social networks and games
PPT
Serious games
PPT
Chapter 05
PPT
Chapter 04
PPT
Chapter 03
PPTX
The games factory 2 alien wars
PPTX
Target markets
PPT
Ch 8 introduction to data structures
PPT
Ch 8 data structures in alice
PPT
Ch 7 recursion
PPT
Power point unit d
PPT
Power point unit c
PPT
Power point unit b
PPT
Power point unit a
PPT
Gamegraphics
PPT
Gamesound
PPT
Ch 6 text and sound in alice
PPT
Ch 5 boolean logic
Strings Objects Variables
Ruby Chapter 2
Social networks and games
Serious games
Chapter 05
Chapter 04
Chapter 03
The games factory 2 alien wars
Target markets
Ch 8 introduction to data structures
Ch 8 data structures in alice
Ch 7 recursion
Power point unit d
Power point unit c
Power point unit b
Power point unit a
Gamegraphics
Gamesound
Ch 6 text and sound in alice
Ch 5 boolean logic
Ad

Intro to gml

  • 1. Intro to GMLGame Maker Language
  • 2. GMLInterpreted programming language that you can use to substantially enhance the games you create using Game MakerSupplementExtendReplace ActionsInterpreted Programming LanguageScripts are interpreted and compiled just before they are executed
  • 3. Game Maker Scripts MenuImport ScriptsExport ScriptsShow Built-In Variables – Global/local variablesShow Built-In Functions – Game Maker’s functionsShow Extension functions – through extension pkgsShow Constants Show Resource Names – resources defined in your appSearch in Scripts – matching stringsCheck Resource Names – look for resource name conflictsCheck All Scripts – syntax check
  • 4. Game Maker Scripts EditorAccessed through the Script Properties WindowCreate scripts by typing the windowAuto color-codedAssists in writing codeSmart tabs automatically indent statements
  • 5. SyntaxScripts 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 scriptMay also be created as code if only used once
  • 7. Executing GML Code to RoomsCan execute code when rooms are createdOpen a room and click on its settings tabButton at the bottom of the tab labeled Creation CodeCode for the room will be executed once (and only once) when the room is created
  • 8. GML ScriptingData typesInteger – any whole number positive or negative, as well as 0Real – Numbers that include decimal pointsString – Set of characters embedded within single or double quotations
  • 9. VariablesVariable – pointer to a location in memory where data is storedVariable names must begin with a letterLetters, numbers, underscoresNo blanksNo game maker language key words or names of defined resourcesTo assign a value to a variable, use the “=“Name = “Tracy”;
  • 10. Special VariablesX – coordinate for a given objecty – “ “DirectionSpeedHspeedVspeedSolidSprite_heightSprite_width
  • 11. ConstantsA constant is a value whose value is known at design time and does not change during the execution of the gameColors, for example (c_black, c_blue, c_green)Click on “show constants” on the scripts menuConstants cannot be “accidentally” changed, are self-documenting, and typically require less memory
  • 12. ArraysAn 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 variablesOne dimensional and two dimensionalArrayname[indices]Ex: {names[0]=“Captain Jack”;names[1]=“Mad Hatter”;names[2]=“Willy Wonka”;}
  • 13. Setting up a LoopSet up a loopFor(i=0; I<3; i=i+1) {draw_text(x,y,names[i]); y = y+20}Executes the script three timesCan be used to list each item in an array
  • 14. The IF statementThe 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