Explain what direction x goes, y goes, and z goes
x = left and right
y = up and down
z = forward and backward
What do functions do?
a function is a section of a program that does a certain task. they make ur object do something
Given the picture, what object are we in?
View Picture: https://ibb.co/wY5kBmy
We are in the circle object.
Explain each operator:
==
>=
<
<=
>
!=
== is equal equal to
>= is greater than or equal to
< is less than
<= is less than or equal to
> is greater than
!= is not equal to
True or False: In coding, Banana and BanAna are the same
False
Given the statement below, which part is the object, function, and parameter?
Statement: star.spin(120);
spin is the function
star is the object
120 is the parameter
What does writing code in Update Every Frame do? What does writing code in Initialize when scene starts do?
Update Every Frame = repeat whatever code is inside of it every second forever.
Initialize when Scene Starts = when you press the play button or stop the game
Find and fix the mistakes in the following code:
var pos == getpointerpos
Var desiredX == pos.x -12
var pos = getPointerPos;
var desiredX = pos.x -12;
What goes in the blank?
if(_____){
do something
}
a condition which is a true/false statement. if the statement is true the if statement will work. if it is false it will not work.
Explain what direction each of the follow code moves in? (Hint: each one moves either up, down, left, or right)
1) $this.moveX(100);
2) $this.moveX(-100);
3) $this.moveY(-100);
4) $this.moveY(100);
1) right
2) left
3) up
4) down
What does rectangle.moveX(100) do?
moves the rectangle object to the right at the speed of 100
When do you use $this?
a) Inside the object we are using.
b) Calling another variable inside a new object
c) Our x and y coordinates match (600,800)
d) We don’t need to use $this.
a.
Fill in the blank.
if ( $this.x__ >= 750 ) __
__this.speedX(-$this__speedX())__
}
if ( $this.x() >= 750 ) {
$this.speedX(-$this.speedX());
}
== gives a true or false value
= is to assign a value
What does rectangle.x(100) do?
moves the rectangle x position to be 100.
Clone the rectangle object.
rectangle.clone()
Explain what $this is.
$this is the name of the object that you are in.
Give whether the statement is true or false.
1) 1 < 1
2) 3 >= 2
3) 4 != 5
4) 4 == 6
1) False
2) True
3) True
4) False
var spacePressed = isKeyPressed(Keys.space)
Explain the difference between rectangle.x(100) and rectangle.moveX(100)
What is the difference between $this.x() and $this.x(100)?
$this.x() gives you the x position of the $this object
$this.x(100) changes the x position of the $this object to be 100.
When should you write $this.spin(100) vs star.spin(100);
$this only works when you are inside of the object you want to spin. So if I want to spin the star I need to be in the star object before $this.spin(100) will work. You can write star.spin(100) anytime you want.
Write the follow sentence in code format.
If the rectangle's y position is greater than 600 then set the rectangle's position to 0.
rectangle.y(0)
}
explain the steps needed to add a score into the game
1) make a variable to keep track of the score
2) add to the score if a certain thing happens
3) change the text to reflect the score