Thursday, March 9, 2017

Collision & Reflection

Collision: when an object makes contact with another object or collides with another object.
Reflection: when an object bounces back to you after it collides with another object.
Pong has been using that with the paddles reflecting the ball towards the other paddle. and when the ball collides with the paddle.

Wednesday, March 1, 2017

Objects Bouncing and Reflecting in Games

if (bouncer_x < 0 || bouncer_x > 640 - 32) {
//flip the x direction
bouncer_dx = -bouncer_dx;
}

if (bouncer_y < 0 || bouncer_y > 480 - 32) {

bouncer_dy = -bouncer_dy;

}

if (bouncer2_x < 0 || bouncer2_x > 640 - 32) {
bouncer2_dx = -bouncer2_dx;

}
if (bouncer2_y < 0 || bouncer2_y > 480 - 32) {
bouncer2_dy = -bouncer2_dy;
}

//really important code!
//move the box in a diagonal
bouncer_x += bouncer_dx;
bouncer_y += bouncer_dy;
bouncer2_x += bouncer2_dx;
bouncer2_y += bouncer2_dy;

//if an event happened, you better redraw
redraw = true;
}

//////////////////////////////////////////////////////////////////
//kill program if the user clicks the exit button
else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
}

//if you were supposed to redraw but there wasn't an event, don't redraw
if (redraw && al_is_event_queue_empty(event_queue)) {
redraw = false;
}
al_clear_to_color(al_map_rgb(0, 0, 0));

the code tells the object in this case "bouncer" to only bounce after he has hit one of the corners or walls. this basically describes the outer walls and edges of the walls in your "game" with words and out of words a program is created. like the code is describing to the program what to create.

Wednesday, February 15, 2017

Binary Bae Name


01101101, 
01100101,

01101100,

01100001,

01101110,
01101001,

01100101,

01101101,

01100101,
01100100,

01101001,
01101110,

01100001,






01101001,
01110011,
01101101,
01111001,

01100010 
01100001
01100010

01111001





Wednesday, February 8, 2017

For Loops Boi


for loops:
1. you need int main like any program (int main(){})
2. the numbers and how many times you want it to repeat (for (int i = 0; i < 200; i++)
3.  the cout or anything you want to be repeated (cout << "I'M BATMAN!" << endl;)

Why? I Have No Clue

yes

Tuesday, January 17, 2017

Variables 1/17/2017

Bool: stores true and false statements.
Char: stores letters.
int: can hold smaller numbers
float: can hold bigger numbers.

Favorite Video Game


My favorite video game right now is Battlefield 1 because it is action packed and i bought the season pass so i can't put that money to waste.i am also a big World War nerd, and this game is about World War 1. it is entertaining and the sequel to my favorite shooter franchise of all time (battlefield).