Using Game Maker 8: GML Scripting

Similar documents
CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

Computer Programming in MATLAB

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

The Graphing Calculator

Basic types and definitions. Chapter 3 of Thompson

Secondary Math 3- Honors. 7-4 Inverse Trigonometric Functions

The Very Basics of the R Interpreter

C Functions. 5.2 Program Modules in C

1. The Pythagorean Theorem

Maths Functions User Manual

Basic stuff -- assignments, arithmetic and functions

Function f. Function f -1

Single row numeric functions

MTH 120 Fall 2007 Essex County College Division of Mathematics Handout Version 6 1 October 3, 2007

Excel Tool: Calculations with Data Sets

JUN / 04 VERSION 7.0

Macro B Reference Guide

FORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name]

Albertson AP Calculus AB AP CALCULUS AB SUMMER PACKET DUE DATE: The beginning of class on the last class day of the first week of school.

MYSQL NUMERIC FUNCTIONS

1001ICT Introduction To Programming Lecture Notes

Lecture 2 FORTRAN Basics. Lubna Ahmed

What did we talk about last time? Examples switch statements

A Quick Review of Trigonometry

Introduction to Programming

By the end of this section of the practical, the students should be able to:

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson)

Fixed point algorithmic math package user s guide By David Bishop

Class #15: Experiment Introduction to Matlab

C++, How to Program. Spring 2016 CISC1600 Yanjun Li 1

6-1 (Function). (Function) !*+!"#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x

Sum and Difference Identities. Cosine Sum and Difference Identities: cos A B. does NOT equal cos A. Cosine of a Sum or Difference. cos B.

Graphing Trigonometric Functions: Day 1

10 Using the PCFL Editor In this chapter

Trigonometric Functions. Copyright Cengage Learning. All rights reserved.

Functions. Systems Programming Concepts

Methods: A Deeper Look

The Expressions plugin PRINTED MANUAL

Introduction to Programming with RAPTOR

Product Price Formula extension for Magento2. User Guide

Command Description Example. Avatar s movement. Avatar moves forward as many steps as the number value. Avatar moves backward as many

Lab 1 Intro to MATLAB and FreeMat

What did we talk about last time? Math methods boolean operations char operations

Math 2250 MATLAB TUTORIAL Fall 2005

Introduction to Matlab

4.7a Trig Inverses.notebook September 18, 2014

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

POLYMATH POLYMATH. for IBM and Compatible Personal Computers. for IBM and Compatible Personal Computers

CT 229 Java Syntax Continued

Section 4.1: Introduction to Trigonometry

: Find the values of the six trigonometric functions for θ. Special Right Triangles:

An Introduction to Maple This lab is adapted from a lab created by Bob Milnikel.

4.7 Inverse Trigonometric Functions

Data Types and Basic Calculation

Functions and an Introduction to Recursion Pearson Education, Inc. All rights reserved.

Methods CSC 121 Fall 2014 Howard Rosenthal

The Expressions plugin PRINTED MANUAL

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design

PIV Programming. Today s Contents: 1. Matlab Programming 2. An example of PIV in Matlab code 3. EDPIV 4. PIV plugin for ImageJ 5.

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from

Bil 104 Intiroduction To Scientific And Engineering Computing. Lecture 5. Playing with Data Modifiers and Math Functions Getting Controls

Green Globs And Graphing Equations

5.5 Multiple-Angle and Product-to-Sum Formulas

Variable Definition and Statement Suppression You can create your own variables, and assign them values using = >> a = a = 3.

Fall Semester (081) Dr. El-Sayed El-Alfy Computer Science Department King Fahd University of Petroleum and Minerals

Python Programming: An Introduction to Computer Science

Graphics. Graphics. Graphics

Math General Angles, Radian Measure, measures of arcs and sectors

Downloaded from Chapter 2. Functions

Math 26: Fall (part 1) The Unit Circle: Cosine and Sine (Evaluating Cosine and Sine, and The Pythagorean Identity)

Review of Sine, Cosine, and Tangent for Right Triangle

Foundations of Math II

Dr Richard Greenaway

Chapter 3 - Functions

MaSH Environment nxt. Contents

UNIT 2 RIGHT TRIANGLE TRIGONOMETRY Lesson 2: Applying Trigonometric Ratios Instruction

ECET 264 C Programming Language with Applications

Customizing Built In Formulas

Methods CSC 121 Fall 2016 Howard Rosenthal

JAVASCRIPT BASICS. JavaScript Math Functions. The Math functions helps you to perform mathematical tasks

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

1 Getting started with Processing

MATH 1113 Exam 3 Review. Fall 2017

Scheme Quick Reference

Math Machines: Designing Motions and More MM:DMM Readme (2016)

Graphing Calculator Scientific Calculator Version 2.0

Welcome to Python 3. Some history

MATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano

Functions and Recursion

Computational Physics

MATHEMATICS FOR ENGINEERING TRIGONOMETRY

Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Programming Fundamentals for Engineers Functions. Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. Modular programming.

Part V Appendices c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017

CSE123. Program Design and Modular Programming Functions 1-1

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

How to Design Programs Languages

MATHEMATICAL / NUMERICAL FUNCTIONS

Intrinsic Functions Outline

Midterm Review January 2018 Honors Precalculus/Trigonometry

Transcription:

Using Game Maker 8: GML Scripting Mike Bailey mjb@cs.oregonstate.edu http://cs.oregonstate.edu/~mjb/gamemaker

Scripting using the Game Maker Language (GML) There are two neat things about using GML: 1. It allows your game to do things that the drag-and-drop features can t do by themselves 2. It looks very much like C++ and Java programming!

Scripting User Interface Finish and close this window Un-do Cut Paste Replace a string with another string Check the script for errors Print the code Re-do Copy Search for a string Go to a particular line number Help

Scripts begin with a left curly brace { The Structure of a Script Action Comments begin with a // and go to the end of the line Scripts end with a right curly brace }

Pay Attention to Game Maker s Automatic Color-coding when you Enter a Script this helps epspe prevent e ttypostypos Comment: green Object name: purple Property name: blue If these colors don t come up, then you ve spelled something wrong! Beware: names of things in scripts are all case-sensitive. That is, a A

Implementing a Pause feature with a Script The exclamation point means not. I.e., whatever Paused is now, change it to the other state. The if statement causes something to happen if Paused is true. If it s not, then something else happens. if and else statement bodies are delimited with curly braces. The purpose of this script is to allow the p key to pause the action to let you look at the state of your game. This is nice for development. When pausing, the script it records the current Fire speed and sets the new Fire speed to 0. When un-pausing, the script restores the Fire speed to what it used to be.

Define the Fire Object s Events 1. control Execute Code

Limiting Motion with a Script

Define the Paddle Object s Events 1. control Execute Code

Scripts can be entered as a Resources Create Script This gives you the chance to name the script, so you can use it in multiple objects

Scripts can also be entered as an Execute a Piece of Code Action

General Information Game Maker scripts look very much like programming in C, C++, and Java Scripts must begin with a left curly brace ( { ) and end with a right curly brace ( } ) Statements end with a semi-colon ( ; ) Variable names consist of letters, numbers, and the underscore ( _ ) Variable names must begin with a letter Letters are case-sensitive, that is A a

Functions you can use in Game Maker Scripts abs( f ) Absolute value of a number arccos( c ) Arc whose cosine is c arcsin( s ) Arc whose sine is s arctan( y_over_x ) Arc whose tangent is y_over_x arctan2( y, x ) Arcwhose tangent is y/x, taking signs into account ceil( f ) Next highest whole number cos( f ) Cosine oif r degtorad( d ) Turn d into radians exp( f ) e (2.71828 ) raised to the f power floor( f ) Next lowest whole number frac( f ) Fractional (non whole number) part of f ln( f ) Log to the base e (2.71828 ) of f log2( f ) Log to the base 2 of f log10( f ) Log to the base 10 od f radtodeg( r ) Turn r into degrees random( f ) A random number between 0. and f round( f ) Round f to the nearest whole number sign( f ) The sign of f ( 1. or +1.) sin( r ) The sin of r sqr( f ) The square of f sqrt( f ) The square root of f tan( r ) The tangent of r... and lots more...

General Information You can create conditional execution with an if-else block You can create a loop with a for block for( initial-settings ; keep-going-if-this-is-true ; do-this-in-between-loops )

Note Game Maker s Automatic Color-coding when you Enter a Script this helps epspe prevent e ttypostypos Comments begin with // and are green Object names are purple Property names are blue Special constants t are red Special variables are blue If these colors don t come up, then you ve spelled something wrong! Beware: names of things in scripts are all case-sensitive. That is, a A