You are on page 1of 30

The Math and Science within GameSalads Pong Game

Size

Steps 4, 14, 17, 27, 37, 41,46, and 50


! Size: You can specify the size of the actor. If you are planning to use an image, type in the size of the image. Dont forget the tip about the size (make it divisible by 4!)
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

! Width: the distance from side to side


http://www.mathsisfun.com/definitions/width.html

! Height: the vertical distance from top to bottom


http://www.mathsisfun.com/definitions/height.html

Density

Steps 4, 14, 27, 37, and 41


! ! Density: a measure of how much matter is in a certain volume
http://www.mathsisfun.com/definitions/density.html

Density attribute: Located under Physics, density represents the heaviness of an actor. The way GameSalad implements density is very close to real life. According to the GameSalad support, the units in GameSalad equal standard density in kilograms per cubic meter.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

Example: Think of a bowling alley. If you throw a bowling ball at a bowling pin, the light pins simply ricochets off the heavier bowling ball. If you want your actors to behave the same way, the bowling ball actor would have a much higher value for Density. Something like 1000 for the bowling ball, and 10 for the bowling pins, could create a believable effect.
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Friction

Steps 4 and 14
! ! Friction: the rubbing of one object or surface against another
http://www.thefreedictionary.com/friction

Friction attribute: Located under Physics, this attribute is used to simulate friction, which is the force resulting from the contact of two materials. The lower the value of friction, the softer it will simulate the reaction. A value of 0 will simulate ice.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

Example: If you want to create an ice-like surface, give the ground a low number for Friction. If you want the actor to run across sand, give a high number for Friction.
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Direction (Move)

Steps 6 and 10
! Direction: where something is pointing
http://www.mathsisfun.com/definitions/direction.html

! Direction setting: You can either enter a value in degrees or mathematical equation to define the direction that actor will take.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

! Example: 0 will have an actor move to the East (Right) of his point of reference for the movement.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

Other Move Settings:


! Relative to: This defines the point of reference for the movement. You have two choices: the actor itself or the scene.
! If you put 0 relative to the scene, the actor will move to the right of the scene. ! If you put 0 relative to the actor, the actor will move to his right, which could be left of the scene if the actor is upside down.

Move Type: You can choose between additive or stacked.


! ! Additive will sum up the speed and direction of other Move or Move To behaviors Stacked will only apply the speed and direction of the most recent Move or Move To behaviors

Speed: You can either put a value or open the Equation Editor by clicking the little box with the e on it to the right of the value box and entering a mathematical equation to define the speed of the movement.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

Position X (Constrain)

Steps 11 and 15
! Constraint: limitation or restriction
http://dictionary.reference.com/browse/constraint

! Constrain Attribute: Unlike the Change Attribute behavior, this behavior continuously updates the value of one attribute to that of another.
Game design engine, make games for iphone & android GameSalad. (2013). GameSalad. Retrieved March 8, 2013, from http://gamesalad.com

! Example: In our Pong game, our Racket Player actors X positions will be continuously constrained to that of their specific X value we gave themthis way our Rackets will only move along the y-axis, NOT the x-axis.

Boolean

Step 18
! Boolean attribute: it is a true/false attribute. To save a little bit of time, you can substitute true and false with 1 and 0, respectively. GameSalad will automatically associate 0 to false and 1 to true.
Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress.

! It is simply: False = 0 !

and

True =1

Example: You could make a mute button. If you want the sound to play, set your custom attribute to True. If you want the sound off, set the attribute to False. The game rules could then act accordingly. When a Boolean attribute is listed in the Attributes tab on the Inspector, it can be seen with a check box in the Value column. When that check box is checked, it means it is set to True. If it is unchecked, then it is false.
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Velocity

Steps 21 and 22
! Velocity: distance travelled per unit time in a given direction
http://dictionary.kids.net.au/word/velocity

! Change Velocity attribute: this will move an actor in a direction, but it is a one-time actionit is NOT constant. If the actors Drag is greater than zero, eventually the actors velocity will cease (stop). Bumping into a wall or another actor can also change the velocity. This behavior is good for a one-time hit, like an explosion. It is also useful for when actors are first launched into an active scene, like a pinball hit by a plunger.
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Random (Change Velocity)

Steps 21 and 22
! Random: without order; not able to be predicted; happening by chance
http://www.mathsisfun.com/definitions/random.html

! Random attribute: This allows you to generate a random integer. The range of the random number is determined by the values within the parentheses. ! Examples:
! A coin toss would be random (1,2) ! A six-sided die would be random (1,6)
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Minimum and Maximum (Velocity and Random)

Steps 21 and 22
! Min (minimum): the smallest value
http://www.mathsisfun.com/definitions/minimum.html

! Max (maximum): the largest value


http://www.mathsisfun.com/definitions/maximum.html

! Random (min, max):


! Min: this function will return the smaller of two numbers and this function is useful if you do not want a value above a certain point
! Example: min(1,5) would be 1

Max: this function will return the larger of two numbers and this function is useful if you do not want a value below a certain point
! Example: max(1,5) would be 5
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Racket Player 1 and Racket Player 2

Integer

Steps 34 and 35
! Integer: a number with no fractional part: includes the counting numbers {1, 2 ,3...}, zero {0}, and the negative of the counting numbers {-1, -2, -3}
http://www.mathsisfun.com/definitions/integer.html

Integer attribute: This attribute type is for whole numbers, both positive and negative.
! Examples: -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

! Integer attribute type will round a number.


! Examples:
! 1.5 becomes 2 ! 20.4 becomes 20
Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

Remember, .0 to .4 rounds DOWN; .5 to .9 rounds UP

Scoring (an algebraic expression)

Steps 40 and 44
! Left Winning Zone:
! When the Ball CROSSES the LEFT Winning Zone (passes Racket Player 1), ONE point is added to Player 2s score ! Algebraic Formula: P2Score + 1 ! X + 1 where X is Player 2s current score and +1 is added for each point Player 2 gets ! Examples of P2Score +1:
! 0+1 ! 5+1 P2Score = 1 P2Score = 6

Right Winning Zone:


! When the Ball CROSSES the RIGHT Winning Zone (passes Racket Player 2), ONE point is added to Player 1s score ! Algebraic Formula: P1Score + 1 ! X + 1 where X is Player 1s current score and +1 is added for each point Player 1 gets ! Examples of P1Score +1:
! 0+1 ! 5+1 P1Score = 1 P Score = 6

Real (numbers)

Step 70
Real (numbers): ! the type of number we normally use (positive or negative, large or small, whole numbers or decimal numbers) they are called "Real Numbers" because they are not Imaginary Numbers. ! Examples:
! ! ! ! 1 15.82 -0.1
http://www.mathsisfun.com/definitions/realnumbers.html

Real attribute: ! this attribute is for numbers with decimal places; these numbers can be positive or negative; this is the least restrictive attribute option for numbers ! Examples:
! 23.456 ! -1337 ! 0

Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

and

Step 73
! means GREATER THAN OR EQUAL to ! means LESS THAN OR EQUAL to ! Examples from our Pong Game (these are used in our game to help Racket Player 2 PREDICT WHERE it should MOVE DEPENDING on the DIRECTION that the Ball is moving): ! X0
! If the Ball is positioned where X IS GREATER THAN 0 OR X=0, then Racket Player 2 will predict where to move to.

! X 240
! If the Ball is positioned where X IS GREATER THAN 240 OR X=240, then Racket Player 2 will predict where to move to.

! X 300
! If the Ball is positioned where X IS LESS THAN 300 OR X=300, then Racket Player 2 will predict where to move to.

Credits:
! Game design engine, make games for iphone & android - gamesalad. (2013). GameSalad. Retrieved March 8, 2013, from http://gamesalad.com ! Garofalo, M. (2010). Unofficial gamesalad textbook. New York: Photics.

! Guerineau, D. (2012). Learn gamesalad for ios: Game development for iphone, ipad, and html5. New York: Apress. ! Illustrated Mathematics Dictionary. (2012). Math is fun Maths resources. Retrieved March 19, 2013, from http://www.mathsisfun.com/definitions/index.html ! Kids.Net.Au. (2010). Dictionary. Kids.Net.Au. Retrieved March 7, 2013, from http://dictionary.kids.net.au/

You might also like