1 / 12

Game Maker Tutorials 1

Game Maker Tutorials 1. Variables and Simple Controls. Content. GML (game maker language) Variables Relative and Not Relative IF statements IF ELSE statements. Variable. What is it? Location in memory with a variable _______ Programs use it to _______ information

halia
Download Presentation

Game Maker Tutorials 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Game Maker Tutorials 1 Variables and Simple Controls

  2. Content • GML (game maker language) • Variables • Relative and Not Relative • IF statements • IF ELSE statements

  3. Variable • What is it? • Location in memory with a variable _______ • Programs use it to _______ information • Why do we need it? • To keep track of things • ________________ • _____________

  4. How to create variable in GM? • In the _________ tab • The square symbol ______ • Click and the screen appears

  5. Creating a variable • Lets create a variable to hold the amount of keys we have • We need to give it a name, But lets make it global E.g. global.keys We set the value to say… 6 • Now we have create a location in memory named “keys” and stored 6 in it. • _______________________ • _____ just means it is accessible by all objects in the game.

  6. How do we increment instead? • We tick the Relative box With “Relative” meansadd 6 to the original This is an ______ This is an _________ _______________ ______________________

  7. If Statement • Used to make decisions • e.g. Lets look at some code global.keys = 6 //increment or set? If global.keys > 0 //variable check { global.keys = global.keys – 1 //decrement } To do a if statement you use _________ symbols Since we want to check a variable we use

  8. How to do in GM? If global.keys > 0 { global.keys = global.keys – 1 }

  9. Setting up your IF statement If global.keys > 0 = equals > < >= <= less than and equal

  10. IF statement global.keys = 0 ; //_______________ If global.keys > 0 //______________ { global.keys = global.keys – 1 ; //____________ } • What will happen now?

  11. IF Else Statement global.keys= 0 //set to zero if global.keys > 0 //variable check { global.keys = global.keys – 1; //decrement } else { draw_text(x,y, “you got no keys); } • ___________________________________

  12. Having MORE Else Test element: global.keys if global.keys < 0 // below but not equal to { draw_text(x,y, 'no keys'); } else if global.keys =1 //checks a single number { draw_text(x,y, 'happy'); } else if global.keys >= 3 and global.keys < 6 //handles a range { draw_text(x,y, 'coolness'); } else if global.keys >= 7 //greater and equal to { draw_text(x,y, 'awesomeness'); } else { draw_text(x,y, 'joy'); }

More Related