Skip to content

Commit

Permalink
Clearing stuff up. Added current equipped item to ingame screen
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaanC committed Jan 9, 2015
1 parent db86485 commit 72d3e3a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 37 deletions.
74 changes: 48 additions & 26 deletions build/build.js

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions src/collisions.js
Expand Up @@ -7,11 +7,6 @@ var playerHitBox = {
width: 50,
height: 60
};
var angledCollision = function(player, fo) {
var colliding = false;
colliding = aabb(playerHitBox, fo);
return colliding;
};

var aabb = function(a, b) {
if (
Expand Down Expand Up @@ -93,7 +88,7 @@ var check = function(player, foModule) {
var fo;
for (var i = 0; i < foToTest.length; i++) {
fo = foToTest[i];
if (angledCollision(player, fo)) {
if (aabb(playerHitBox, fo)) {
// console.log('HIT');
fo.alive = false;
if (fo.image === 'power-icon.png') {
Expand Down
3 changes: 2 additions & 1 deletion src/main.js
Expand Up @@ -10,6 +10,7 @@ var menus = require('./menus');
var buttons = require('./buttons');
var audio = require('./audio');
var store = require('./store');
var achievements = require('./achievements');

var canvas = document.querySelector('#game');
var ctx = canvas.getContext('2d');
Expand Down Expand Up @@ -53,7 +54,7 @@ loader.done(function() {
particles.draw(elapsed, ctx, player);
flyingObjects.loop(elapsed, ctx, player.offsetX, player.offsetY);
player.draw(ctx);
menus.ingame(ctx, player.fuel, player.health, player.money);
menus.ingame(ctx, player.fuel, player.health, player.money, player.equipped);

player.money += 0.01;
if (player.triggered === 'poison') {
Expand Down
6 changes: 5 additions & 1 deletion src/menus.js
Expand Up @@ -68,7 +68,7 @@ module.exports = {
ctx.font = '26pt Tempesta Five';
});
},
ingame: function(ctx, fuel, health, money) {
ingame: function(ctx, fuel, health, money, equipped) {
ctx.drawImage(loader.images['power-bar-icon.png'], 30, 500);
ctx.fillStyle = 'orange';
ctx.fillRect(30, 490 - fuel, 20, fuel);
Expand All @@ -81,6 +81,10 @@ module.exports = {
ctx.font = '12pt Tempesta Five';
ctx.fillStyle = 'white';
});
text.write('Equipped: ' + equipped, 30, 590, function() {
ctx.font = '10pt Tempesta Five';
ctx.fillStyle = 'white';
});
},
drawStore: function(ctx, totalMoney) {
ctx.fillStyle = '#0f0d20';
Expand Down
1 change: 0 additions & 1 deletion src/stats.js

This file was deleted.

6 changes: 4 additions & 2 deletions src/store.js
@@ -1,17 +1,18 @@
// Handles the market / store part of the game
var player = require('./player');
var buttons = require('./buttons');

var items = [
{
name: 'Health',
desc: 'Increases health by 10',
desc: 'Increases starting health by 10',
fn: function() {
player.defaults.health += 10;
}
},
{
name: 'Fuel',
desc: 'Increases fuel by 10',
desc: 'Increases starting fuel by 10',
fn: function() {
player.defaults.fuel += 10;
}
Expand All @@ -21,6 +22,7 @@ var items = [
desc: '',
fn: function() {
player.colors = ['blue', 'red'];
// player.colors = ['white', 'anything'];
}
},
{
Expand Down

0 comments on commit 72d3e3a

Please sign in to comment.