Skip to content

Commit

Permalink
moved some functions over from main.js, will update and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Zertuk committed Jul 4, 2014
1 parent 57e4820 commit b4bb37a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
39 changes: 39 additions & 0 deletions factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function createFlesh() {
if (player.maxHealth > player.maximum) {
player.maxHealth = player.maximum;
}
$('#blood').html('You have ' + player.gunk + ' gunk');
}
}

Expand Down Expand Up @@ -106,3 +107,41 @@ function turnOffBattery() {
$('#turn_off').html('Turn On Machine');
}
}

//generates ectoplasm on click
function ectoplasmClick(num) {
player.money = player.money + num;
document.getElementById('ectoplasm').innerHTML = "You have " + player.money + " gold";
}

//generates ectoplasm overtime, passing in gears placed
function ectoplasmGenerator(num) {
player.money = player.money + num*player.extraMoneyGen;
$('#ecto_gen').html('gold/s: ' + num);
updateResources();
hideClickButton();
}

//hides/shows click button if over/under 1000 money
function hideClickButton() {
if (player.money > 1000) {
$('#click_button').hide();
}
else if (player.money < 1000) {
$('#click_button').show();
}
}

//generates blood overtime, passing in batteries placed
function bloodGenerator(num) {
if (num * 2 <= player.money) {
player.gunk = player.gunk + num*2;
player.money = player.money - num*2;
$('#blood_gen').html('gunk/s: ' + num*2);
}
}

function updateResources() {
$('#blood').html('You have ' + player.gunk + ' gunk');
$('#ectoplasm').html('You have ' + player.money + ' gold');
}
17 changes: 17 additions & 0 deletions locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ function telescope(direction) {
}
}

function lightFire() {
$('#cabin_rest').show();
$('#location_text').html('The fire is roaring. You may now rest here freely.');
}

function magicDoor() {
if (inventoryObject.rune == true) {
$('#rune_true').css('display', 'inline');
$('#rune_false').css('display', 'none');
$('#magic_door').css('color', '#4FE8D6');
}
else {
$('#rune_false').css('display', 'inline-block');
$('#rune_true').css('display', 'none');
}
}

function showLab() {
$('#lab_map').show();
stuffToShow.lab_map = true;
Expand Down
11 changes: 11 additions & 0 deletions store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ var potionUsed = false;
var potionCD = 0;
var timeFrozen = false;

function updateHealthBar() {
$('#hp').html(player.health.toFixed(2) + '/' + player.maxHealth);
$('#hp').css('width', player.health / player.maxHealth * 100 + '%');
}

function healthRegen() {
player.health = player.health + player.regenVal;
}



var stuffToShow = {
mapButton: false,
post_lich: false,
Expand Down

0 comments on commit b4bb37a

Please sign in to comment.