Skip to content

Commit

Permalink
js documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
celeritas17 committed Feb 7, 2014
1 parent 9d7dc91 commit c126c81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/js/snacMan.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,19 @@ $(function(){
/* Click handlers and related functions for prizes */
/////////////////

// Add time to the 'hour glass'
var prize_action1 = function(){
var current_height = parseInt($('#time_bar').css('height'));
var new_height = (current_height < time_height/2) ? current_height + time_height/2 : time_height;
$('#time_bar').css('height', new_height);
};

// Remove one wrong answer from the board (chosen at random)
var prize_action2 = function(){
$('span:contains("' + wrong_answers[Math.floor(Math.random()*wrong_answers.length)] + '")').html('');
};

// Make the bad guy vulnerable for 10 seconds
var prize_action3 = function(){
bad_guy_vulnerable = true;
$('img.bad_guy').attr('src', '/static/assets/img/ufo_blue.jpg');
Expand All @@ -300,6 +303,8 @@ $(function(){
$('#prize' + prize_indices[index]).toggle();
};

// Check if muncher is on a cell with a prize;
// if yes, execute prize action.
var prize_check = function(){
for (var i = 0; i < prize_indices.length; i++){
if (cell == prize_indices[i] && active_prizes[i] === true){
Expand Down
5 changes: 5 additions & 0 deletions static/js/snacMan.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,19 @@ $(function(){
/* Click handlers and related functions for prizes */
/////////////////

// Add time to the 'hour glass'
var prize_action1 = function(){
var current_height = parseInt($('#time_bar').css('height'));
var new_height = (current_height < time_height/2) ? current_height + time_height/2 : time_height;
$('#time_bar').css('height', new_height);
};

// Remove one wrong answer from the board (chosen at random)
var prize_action2 = function(){
$('span:contains("' + wrong_answers[Math.floor(Math.random()*wrong_answers.length)] + '")').html('');
};

// Make the bad guy vulnerable for 10 seconds
var prize_action3 = function(){
bad_guy_vulnerable = true;
$('img.bad_guy').attr('src', '/static/assets/img/ufo_blue.jpg');
Expand All @@ -300,6 +303,8 @@ $(function(){
$('#prize' + prize_indices[index]).toggle();
};

// Check if muncher is on a cell with a prize;
// if yes, execute prize action.
var prize_check = function(){
for (var i = 0; i < prize_indices.length; i++){
if (cell == prize_indices[i] && active_prizes[i] === true){
Expand Down

0 comments on commit c126c81

Please sign in to comment.