Your SlideShare is downloading. ×
0
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Intro to gml
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Intro to gml

890

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
890
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×