From f998ef688756e0d9013f42c47ce7fe2e02af0f76 Mon Sep 17 00:00:00 2001 From: jonahkagan Date: Tue, 25 Jan 2011 20:30:06 -0500 Subject: [PATCH] added pause screen buttons --- image_manager.js | 2 ++ in_game_state.js | 27 ++++++++++++++++++++++----- pause_state.js | 32 +++++++++++++++++++++++++++----- rectangle.js | 18 +++++++++++------- test.js | 4 ++-- 5 files changed, 64 insertions(+), 19 deletions(-) diff --git a/image_manager.js b/image_manager.js index 96f06f7..0b73769 100644 --- a/image_manager.js +++ b/image_manager.js @@ -20,6 +20,8 @@ var make_image_manager = function() { screens : { dir : "screens/" }, wall_segments : { dir : "wall_segments/" }, macrophage : {dir : "macrophage_animation/"}, + burst : { dir : "burstingcell_animation/"}, + buttons : { dir : "buttons/"}, // catches all images in images/ other : { dir : "" }, }; diff --git a/in_game_state.js b/in_game_state.js index a28cdfc..8f70672 100644 --- a/in_game_state.js +++ b/in_game_state.js @@ -534,13 +534,13 @@ var in_game_state = function (p, previous_state) { var check_collisions = (function() { // rendering levels to check collisions for: var to_check = [ - ["particle", "particle"], + //["particle", "particle"], ["particle", "cell"], ["particle", "enemy"], ["particle", "multiplier"], - ["cell", "cell"], + //["cell", "cell"], ["cell", "enemy"], - ["enemy", "enemy"], + //["enemy", "enemy"], ["enemy", "b_cell"], ["b_cell", "wall"], ["particle", "wall"], @@ -952,6 +952,11 @@ var in_game_state = function (p, previous_state) { bounce(b, flo); notify("B-cell activated!", BAD_NOTIFICATION_COLOR); } + // trying to avoid getting stuck + if (b.is_outdated()) { + bounce(b, flo); + b.set_target(null); + } }, "wall_segment": function(b, wall) { //console.log("collision"); @@ -989,10 +994,11 @@ var in_game_state = function (p, previous_state) { //else false } else { + console.log("removing "+x.to_string()); offscreen = true; } } - return (!offscreen && (! x.is_dead())); + return (! (offscreen || x.is_dead())); }; for (var i = 0; i < game_objects.length; i++) { game_objects[i] = game_objects[i].filter(filter_fun); @@ -1437,6 +1443,14 @@ var in_game_state = function (p, previous_state) { remove_objs(); update_mutation(); + + /* + // for debugging + var count = 0; + do_to_all_objs(function() { count += 1; }); + console.log(count); + console.log("fr "+p.__frameRate); + */ } }; @@ -1525,7 +1539,10 @@ var in_game_state = function (p, previous_state) { for (var i=0; i