400 : Finishing Level 2

Balthazar:

For level 2, we'll be adding one more monster.

falco1.png

Copy the following files into your project:

Balthazar:

We'll also be adding a lot of new platforms. Some of them will require new images.

block-red.png

candycane.png

post.png

Copy the following files into your project:

function init_level2() { var level = {}; level.name = "Level 2"; init_level_defaults(level); level.player_start_x = 20; level.player_start_y = 260; level.player_start_y = 70; // Create the platforms. add_default_platforms(level); var platform_data = [ // [x, y, width, height, pattern] [200, 20, 20, 4, "#ffffff"], [200, 24, 20, 96, "candycane"], [0, 120, 140, 20, "block"], [220, 110, 80, 10, "dirt"], [180, 120, 120, 20, "block"], [280, 140, 20, 20, "block"], [40, 190, 200, 10, "dirt"], [40, 230, 170, 10, "dirt"], [40, 240, 20, 40, "block"], [40, 280, 80, 20, "block"], [40, 300, 20, 20, "block"], [100, 300, 20, 20, "block"], [200, 300, 20, 20, "block"], [280, 244, 20, 112, "candycane"], [280, 240, 20, 4, "#804000"], [280, 356, 20, 4, "#804000"], [440, 164, 20, 112, "candycane"], [440, 160, 20, 4, "#804000"], [440, 276, 20, 4, "#804000"], [530, 310, 20, 20, "block-red"], [480, 260, 20, 20, "block-red"], [530, 210, 20, 20, "block-red"], [480, 160, 20, 20, "block-red"], [530, 110, 20, 20, "block-red"], [460, 60, 10, 10, "post"], [360, 80, 10, 10, "post"], [370, 80, 10, 10, "post"], ]; add_platforms(level, platform_data); // Create the monsters. var monster_data = [ // [x, y, width, height, min_x, max_x, move_x, image] [380, 180, 40, 24, 330, 410, 0.5, "falco1"], [70, 190, 28, 26, 50, 230, -0.5, "rufus"], [400, 360, 26, 28, 320, 515, 1.0, "prescott"], [100, 360, 20, 24, 30, 270, -1.0, "vlad"], ]; add_monsters(level, monster_data); // The items. var item_data = [ // [x, y, width, height, type, image] [250, 360, 18, 20, "key", "key"], [80, 272, 18, 20, "key", "key"], [55, 230, 16, 23, "potion", "potion"], [20, 280, 20, 20, "coin", "coin"], [420, 230, 20, 20, "coin", "coin"], [320, 140, 20, 20, "coin", "coin"], ]; add_items(level, item_data); level.goal = create_goal(500, 360, 3); level.goal = create_goal(260, 110, 3); _levels.push(level); }

Congratulations! You've earned the Level II badge!

GOTO 410