Working on HUD anim

master
Ruben Müller 8 years ago
parent 0a71cdbc49
commit 29ebab4b46

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -5,7 +5,7 @@ app = playground(
smoothing: false,
create: ->
@loadImages "layers", "active", "progress", "selected", "entities", "hud"
@loadImages "layers", "active", "progress", "selected", "entities", "hud", "actions"
@currentHoveredTile = new Tile
ready: ->

@ -4,6 +4,8 @@ app.game.hud =
@position = x: 45, y: 103
@itemArrow = new AnimatedItem maxFrames: 12, image: app.images.actions, speed: 50
@resources = []
for restype, i in resTypes
@resources[restype] = new Tilelayer(
@ -37,7 +39,8 @@ app.game.hud =
switch panelusage
when 'entity'
app.layer.drawRegion app.images.entities, currentSelectedTile.entity.sprite(), 44, 102
#app.layer.drawRegion app.images.entities, currentSelectedTile.entity.sprite(), 44, 102
app.layer.drawRegion @itemArrow.image, @itemArrow.sprite(), 44, 102
when 'resources'
# resources
i = 0

@ -1,12 +1,12 @@
class AnimatedItem
constructor: (options) ->
{@maxFrames, @image}
{@maxFrames, @image, @speed} = options
@frame = 0
window.setInterval @changeAnimation, 500
window.setInterval @changeAnimation, @speed
sprite: ->
[@frame*8, 8, 8, 8]
[@frame*8, 0, 8, 8]
changeAnimation: =>
if @frame == @maxFrames

Loading…
Cancel
Save