working
This commit is contained in:
parent
cc95f8f36f
commit
374ccd95ce
4 changed files with 20 additions and 23 deletions
|
@ -21,10 +21,9 @@ gulp.task('server', function() {
|
|||
});
|
||||
|
||||
gulp.task('compile', function() {
|
||||
return gulp.src(['src/**/*.coffee'])
|
||||
return gulp.src(['src/entities/*.coffee', 'src/main.coffee', 'src/game.coffee'])
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(coffee({bare: true}))
|
||||
.pipe(uglify())
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('public'));
|
||||
|
|
|
@ -10,10 +10,8 @@ class Tile extends Base_entity
|
|||
new Tilelayer type: 'gold'
|
||||
]
|
||||
|
||||
console.log @layers
|
||||
|
||||
tick: (delta) ->
|
||||
# TODO: digging deeper?
|
||||
|
||||
render: ->
|
||||
app.layer.fillStyle("#fff").fillRect(0, 0, 8, 8);
|
||||
app.layer.fillStyle("#fff").fillRect(0, 0, 8, 8);
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
game = {
|
||||
app.game = {
|
||||
start: ->
|
||||
for i in [0..20*15]
|
||||
@map[i] = new Tile
|
||||
|
||||
hud: ->
|
||||
app
|
||||
.layer
|
||||
app.layer
|
||||
.fillStyle "#00f"
|
||||
.fillRect 0, 0, 200, 50
|
||||
|
||||
render: ->
|
||||
for i in @map
|
||||
i.render()
|
||||
|
||||
step: ->
|
||||
this.hud
|
||||
@hud
|
||||
|
||||
map: []
|
||||
|
||||
resources:
|
||||
ore: 50
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
app = playground({
|
||||
width: 16*20,
|
||||
height: 16*20,
|
||||
width: 8*20,
|
||||
height: 8*15,
|
||||
scaleToFit: true,
|
||||
smoothing: false,
|
||||
|
||||
createTestTiles: ->
|
||||
@testTile1 = new Tile
|
||||
@testTile2 = new Tile
|
||||
|
||||
create: ->
|
||||
@createTestTiles()
|
||||
|
||||
ready: ->
|
||||
game.start
|
||||
@setState game
|
||||
@game.start()
|
||||
@setState @game
|
||||
|
||||
step: ->
|
||||
|
||||
|
||||
render: ->
|
||||
this.layer.clear("#000");
|
||||
|
||||
@testTile1.render()
|
||||
@testTile2.render()
|
||||
@layer.clear("#00f");
|
||||
@game.render
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue