Skip to content

Commit

Permalink
Fixed various formatting issues and cleaned up some sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
zoibot committed Apr 22, 2014
1 parent 8ad7b08 commit 72017d3
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 15 deletions.
10 changes: 3 additions & 7 deletions js/inventory.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
return equipped;
},
update: function () {
// TODO handle input
// draw
// TODO move this to graphics somehow
graphics.draw([{ draw: function (ctx) {
Expand All @@ -26,18 +25,15 @@
// draw background squares
ctx.beginPath();
ctx.rect(50, 50, 700, 500);
for (var i = 0; i < 7; i++)
{
for (var j = 0; j < 5; j++)
{
for (var i = 0; i < 7; i++) {
for (var j = 0; j < 5; j++) {
ctx.rect(i * 100 + 60, j * 100 + 60, 80, 80);
}
}
ctx.strokeStyle = writeColor([255,255,255,255]);
ctx.stroke();

for (var k = 0; k < inventory_contents.length; k++)
{
for (var k = 0; k < inventory_contents.length; k++) {
var x = k % 7;
var y = Math.floor(k / 7);
item_db.get_sprite(inventory_contents[k].id).draw(ctx, x * 100 + 60, y * 100 + 60, 0, 'default');
Expand Down
3 changes: 3 additions & 0 deletions js/objects/background.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ var background = window.objects.background = function (pos, name, solid, sprite_
background.prototype.draw = function (ctx) {
this.graphic.draw(ctx, this.x, this.y, 0, 'default');
};

background.prototype.update = function () {
};

background.prototype.hits = function (ex, ey) {
return this.contains(ex, ey);
};

background.prototype.contains = function (x, y)
{
return this.graphic.contains(x, y, this.x, this.y, 0, 'default');
Expand Down
9 changes: 7 additions & 2 deletions js/objects/hud.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
var hud = window.objects.hud = function () {
this.hp = new graphics.sprite("gfx/hp.json");
this.energy = new graphics.sprite("gfx/e.json");
this.hp = new graphics.sprite("gfx/hp.json", [255, 100, 100, 255]);
this.energy = new graphics.sprite("gfx/e.json", [100, 100, 255, 255]);
this.loaded = jQuery.when(this.hp.loaded, this.energy.loaded);
};

Expand Down Expand Up @@ -35,7 +35,12 @@
_this.energy.draw(ctx, 670, 80, 0, 'default');

// everything below here is dynamic
// player name
ctx.strokeText("Name", 700, 15);

// hp
ctx.strokeText("100", 700, 65);
// energy
ctx.strokeText("100", 700, 95);

if (item1)
Expand Down
2 changes: 1 addition & 1 deletion pub/gfx/e.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "graphics.polygon", "animations": {"default": [[[4.228571299999999, 1.9708653999999992], [11.3428571, 1.9708653999999992], [7.057142900000002, 8.228008299999999], [10.057142900000002, 13.285151199999998], [6.199999999999999, 19.199437], [6.714285799999999, 12.942294099999998], [2.6857141999999996, 7.799436999999999]]]}}
{"type": "graphics.polygon", "animations": {"default": [[[100, 100, 255, 255], [4.228571299999999, 1.9708653999999992], [11.3428571, 1.9708653999999992], [7.057142900000002, 8.228008299999999], [10.057142900000002, 13.285151199999998], [6.199999999999999, 19.199437], [6.714285799999999, 12.942294099999998], [2.6857141999999996, 7.799436999999999]]]}}
2 changes: 1 addition & 1 deletion pub/gfx/hp.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "graphics.polygon", "animations": {"default": [[[7.5714285, 17.760966500000002], [0.8571430000000007, 9.1895375], [3.285714500000001, 3.1895375], [6.714285499999999, 7.332395], [10.285714500000001, 3.1895375], [13.571428500000003, 7.332395]]]}}
{"type": "graphics.polygon", "animations": {"default": [[[255, 100, 100, 255], [7.5714285, 17.760966500000002], [0.8571430000000007, 9.1895375], [3.285714500000001, 3.1895375], [6.714285499999999, 7.332395], [10.285714500000001, 3.1895375], [13.571428500000003, 7.332395]]]}}
2 changes: 1 addition & 1 deletion pub/gfx/potatoseeds.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "graphics.polygon", "scale": 0.08, "animations": {"default": [[[257.14286, 612.36218], [308.57142999999996, 366.64789999999994], [368.57142999999996, 340.93360999999993], [380.0, 358.07647], [431.42857, 343.79075], [448.57143, 369.50504], [500.0, 352.36218], [508.57143, 398.07647000000003], [557.14286, 366.64790000000005], [560.0, 403.79075000000006], [488.57143, 652.3621800000001], [434.28571, 686.6479], [428.57143, 635.21933], [368.57143, 666.6479], [365.71429, 618.0764700000001], [325.71429, 658.0764700000001], [294.28571, 612.36218], [260.0, 649.50504]]]}}
{"type": "graphics.polygon", "animations": {"default": [[[1.593156731699179, 16.605485025689593], [4.478027965849584, 2.8222112890879902], [7.843711165849589, 1.3797753915391935], [8.484793600000003, 2.3413993232384147], [11.369664834150397, 1.540045859839962], [12.331288765849596, 2.982481757388806], [15.216159999999988, 2.0208578256895846], [15.696971965849588, 4.585188123238394], [18.42157273169921, 2.8222112890879902], [18.58184319999998, 4.905729059839977], [14.575077565849597, 18.849273825689618], [11.52993530245119, 20.772521689088013], [11.209394365849604, 17.88765045493757], [7.843711165849589, 19.65062728908802], [7.6834406975487965, 16.92602652323842], [5.439651897548794, 19.169815323238424], [3.676674502451214, 16.605485025689593], [1.7534272000000186, 18.689003357388803]]]}}
11 changes: 8 additions & 3 deletions pub/items/itemsdb.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"description": "This is a crappy old hammer",
"grabbable": false,
"consume": false,
"use": ["hammer"],
"handlers": {
"use": ["event", "hammer"],
"hoe" : "you hoed that biz"
}
},
Expand All @@ -18,14 +18,19 @@
"description": "This is a crappy old hoe",
"grabbable": true,
"consume": false,
"use": ["hoe"]
"handlers": {
"use": ["event", "hoe"]
}
},
{
"id": 3,
"name": "Potato Seeds",
"sprite_name": "gfx/potatoseeds.json",
"description": "These are some crappy old potato seeds",
"grabbable": true
"grabbable": true,
"handlers": {
"use": ["event", "plant", {"plant": 4}]
}
},
{
"id": 4,
Expand Down
2 changes: 2 additions & 0 deletions pub/maps/farm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "maps/farm",
"objects": {
"field": ["background", [100,100], "field", false, "gfx/field.json"],
"plot": ["plot", [120,120]],
"potatoseeds": ["item", [100,50], 3],
"pond": ["background", [300,300], "pond", true, "gfx/pond.json"],
"hammer": ["item", [100,450], 1],
"hoe": ["item", [120,50], 2],
Expand Down

0 comments on commit 72017d3

Please sign in to comment.