Add player character
This commit is contained in:
parent
00bdf3b5df
commit
dc4af9b023
@ -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)');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user