Add player character

This commit is contained in:
Dan Buch 2015-05-15 22:18:09 -04:00
parent 00bdf3b5df
commit dc4af9b023
2 changed files with 10 additions and 0 deletions

View File

@ -41,3 +41,11 @@ Crafty.c('Bush', {
.color('rgb(20, 185, 40)'); .color('rgb(20, 185, 40)');
} }
}); });
Crafty.c('PlayerCharacter', {
init: function() {
this.requires('Actor, Fourway, Color')
.fourway(4)
.color('rgb(20, 75, 40)');
}
});

View File

@ -20,6 +20,8 @@ Game = {
Crafty.init(Game.width(), Game.height()); Crafty.init(Game.width(), Game.height());
Crafty.background('rgb(249, 223, 125)'); Crafty.background('rgb(249, 223, 125)');
Crafty.e('PlayerCharacter').at(5, 5);
for (var x = 0; x < Game.map_grid.width; x++) { for (var x = 0; x < Game.map_grid.width; x++) {
for (var y = 0; y < Game.map_grid.height; y++) { for (var y = 0; y < Game.map_grid.height; y++) {
var at_edge = x == 0 || x == Game.map_grid.width - 1 || y == 0 || y == Game.map_grid.height - 1; var at_edge = x == 0 || x == Game.map_grid.width - 1 || y == 0 || y == Game.map_grid.height - 1;