Programming - Asset Schedule

Task A3 - Platform Position Save File
Write a text-based program that takes input in the form of any number of Rectangles. Each rectangle represents the position of a platform in a level.

A rectangle must contain a (x1,y1), (x2, y2), length and width in pixels. This represents the platforms top left corner, bottom right corner, length and width.

The program then saves the list of rectangle objects into a text file.

Write a sister program that opens this text file and outputs the list of rectangles with their properties. The output should look like:

Rectangle 1: (1,1) (2,0) Size: 1x1

Rectangle 2: (4,4) (5,0) Size: 1x4

Task B3 - Collision Simulation
Using the full movement and jumping simulation code you have all completed, implement collision detection into the program. Integrate the save/read file system built in Task A3 into your movement simulator by creating a platform position save file with the first program in A3, then integrate the sister program into your simulator to read and load the list of platforms.

Now your movement simulator will know the positions and sizes of existing platforms. When your character's coordinates bump into a platform it should prevent further movement in that direction.

Advanced features such as jumping on platforms are not required, only basic movement of left and right.

Sample Output: 0,0 (Starting position) 

1,0 (Right arrow held) 

2,0 (Right arrow held) 

Collision with Platform 1

2,0 (Right arrow held)

Collision with Platform 1

2,0 (Right arrow held)

Task A2 - Collision
Write pseudo-code to determine the detection of collisions between the character and possible environment like platforms, walls, ceilings. Define the character and objects by 4 coordinate points like (0,0), (40, 0), (0, 50), (40, 50). Assume all objects are bound by a rectangular hitbox.

Part 1: Write pseudo-code for a function that detects a collision between two objects. The input for this function are coordinates of the two hitboxes, and the output is a return value of true (collision) or false (no collision)

Part 2: Improve on this function such that if there is a collision, determine which edges of the two objects are touching. For example, this would identify if the player walked into a wall with his front of the body, or if the player's hit his head on the ceiling.

Task B2 - Projectile Mechanics
Write a short program that simulates projectile trajectory. This program would simulate the following types of projectile movement by calculating its path in coordinate pixels over time: The program should output data like this:
 * Straight Line Projectile - 8 directions. (Think of games like Contra, shooting a bullet Up, Down, diagonal Left Up at 45 degrees, etc)
 * A Lobbed Projectile - A parabola type movement, starting from toss, to the moment it hits the ground
 * Wavey Projectile - Weaving up and down as it moves forward

Projectile Type: Straight Projectile (Right Upwards 45 deg)

(0,0) (1,1) (2,2) (3,3)......

Note: Use any arbitrary velocity for projectiles.

Task C2 - Movement/Jump Simulation
Write a short program that fully simulates the movement of the player character. The program will update the player's pixel position after moving/running or jumping. The equations from Task A1 and B1 (from last week) will be needed to accurately calculate moving and jumping, so grab Team Red and Blue's work for reference.

Sample Output: 0,0 (Starting position) 

1,0 (Right arrow held) 

2.2,0 (Right arrow held) 

2.25, 1.5 (jump sequence) 

2.4, 1.7

2.5, 2.0

2.6, 1.7

2.75, 0 (jump sequence ended)

Note: The framework for this program is basically Task C1 from last week

Physics
Task A and B will involve physics relating to the player's character. Determine the mathematical equation(s) and translate them into pseudo-code. Full programming knowledge is not required, only the math and physics concepts. For example, when the player presses the jump button, what equation will determine how high and long the character will jump (taking into account current velocity, etc).

Task A1 - Jumping Physics
function Jump

{
 * start jumping process
 * loop
 * EQUATION
 * change deltaY value; //Change in vertical position in pixels
 * move player deltaY pixels;
 * }
 * end jumping process
 * end jumping process

}

Determine the equation that governs the player's vertical position during one single jump.

The most important factor to consider is gravity. In games like Mario, the character will slow down as it reaches the peak of the jump, and then pick up speed again as he begins his descent.

The equation should calculate deltaY, the character's vertical change in height (i.e. +5 pixels/sec), over time (in seconds or milliseconds). Think of a parabola, but just a straight upwards jump.

It should be in the form: deltaY = f(t)

Task B1 - Running Physics
Determine the two equations that governs the player's horizontal position while running.

This should be somewhat similar to jumping. In platformer games, acceleration affects the character's run speed. If the player holds down left or right, he will start a run slowly and then reach a maximum speed during his run. When the player eventually stops holding the direction, the character will slow down and then stop, returning to a standing position.

The first equation will calculate deltaX, the horizontal change over time starting from the point the player presses and holds the run key (assume character is moving forward).

The second equation will calculate deltaX again, over time, but starting from the point the player releases the run key while running at maximum speed.

Programming Mechanics
The following tasks require programming knowledge and include more direct game functions. Write the following functions in pseudocode.

Task C1 - Movement Keys
Write a function that takes a keyboard press and calls a function. Assume the keyboard press is either moveLeft, moveRight, Jump, or Attack.

This function only calls these other functions, it does not perform them itself. Remember that keypress functions require C++ keycodes.

Feel free to make this function more robust by including smooth controls that take into account press and release, etc.

Task D - XML (Optional Hard Mode)
Write a function that writes an XML file with any number of dummy attributes. This function can be used to make Save Files for player profiles.

For example, this XML file will contain the player's ID, character level, money, and achievements (array).

For this task, it would be preferred to write an actual program that outputs a sample XML file.