Skip to content

Commit

Permalink
Add some icons to the panel interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan01252 committed Apr 3, 2017
1 parent cf0506b commit f7dd47d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions client/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const ITEM_TYPE_WALL = 8;
export const ITEM_TYPE_TURRET = 9;
export const ITEM_TYPE_SLEEPER = 10;
export const ITEM_TYPE_PLASMA = 11;
export const ITEM_TYPE_LASER = 12;

export const DEPENDENCY_TREE = [
{'id': CAN_BUILD_HOUSE, 'parentid': 0},
Expand Down
27 changes: 26 additions & 1 deletion client/src/draw/draw-panel-interface.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import {MAX_HEALTH} from "../constants";
import {ITEM_TYPE_TURRET} from "../constants";
import {ITEM_TYPE_LASER} from "../constants";
import {ITEM_TYPE_MINE} from "../constants";
import {ITEM_TYPE_MEDKIT} from "../constants";
import {ITEM_TYPE_ROCKET} from "../constants";
import {ITEM_TYPE_BOMB} from "../constants";

var drawPanel = (game, stage) => {

Expand Down Expand Up @@ -34,10 +39,30 @@ var drawItems = (game, stage) => {


switch (icon.type) {
case 9:
case ITEM_TYPE_TURRET:
x = game.maxMapX + 7;
y = 372;
break;
case ITEM_TYPE_LASER:
x = game.maxMapX + 7;
y = 267;
break;
case ITEM_TYPE_ROCKET:
x = game.maxMapX + 42;
y = 267;
break;
case ITEM_TYPE_MEDKIT:
x = game.maxMapX + 77;
y = 267;
break;
case ITEM_TYPE_BOMB:
x = game.maxMapX + 7;
y = 302;
break;
case ITEM_TYPE_MINE:
x = game.maxMapX + 42;
y = 302;
break;
}

if (icon.selected) {
Expand Down
6 changes: 3 additions & 3 deletions client/src/input/input-keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const setupKeyboardInputs = (game) => { //Capture the keyboard arrow k
}
// It's not been converted to an item and so is able to be picked up again
if (!item) {
game.iconFactory.newIcon(game.player.id, x2, y2, icon.type)
game.iconFactory.newIcon(null, parseInt(x2), parseInt(y2), icon.type)
}
}

Expand All @@ -122,8 +122,8 @@ export const setupKeyboardInputs = (game) => { //Capture the keyboard arrow k
var angle = game.player.direction;
var angleInDegrees = (angle / 32) * 360;

var x = (Math.sin((angleInDegrees * 3.14)/180));
var y = (Math.cos((angleInDegrees * 3.14)/180) * -1);
var x = (Math.sin((angleInDegrees * 3.14) / 180));
var y = (Math.cos((angleInDegrees * 3.14) / 180) * -1);

var x2 = ((game.player.offset.x) + 24) + (x * 30);
var y2 = ((game.player.offset.y) + 24) + (y * 30);
Expand Down

0 comments on commit f7dd47d

Please sign in to comment.