From 29ebab4b4690cd1b9bfb4ba54a97081108ca9dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20M=C3=BCller?= Date: Sun, 7 Dec 2014 14:02:42 +0100 Subject: [PATCH] Working on HUD anim --- public/images/actions.png | Bin 222 -> 2868 bytes src/app.coffee | 2 +- src/hud.coffee | 5 ++++- src/items/animateditem.coffee | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/public/images/actions.png b/public/images/actions.png index b8cc1e6c3c2b3e63ef76927a46af21e50081afd8..1ee814d70b6db8d8d7a53641b812a4e2e6b3eca6 100644 GIT binary patch delta 2841 zcmV+!3+D9R0kjs7IDZOHX+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQEpR8#2| zJ@?-9LQ9B%luK_?6$l_wLW_VDktQl32@pz%A)(n7QNa;KMFbnjpojyGj)066Q7jCK z3fKqaA)=0hqlk*i`{8?|Yu3E?=FR@K*FNX0^PRKL2fzpnmVZbyQ8j=JsX`tR;Dg7+ z#^K~HK!FM*Z~zbpvt%K2{UZSY_f59&ghTmgWD z0l;*TI7e|ZE3OddDgXd@nX){&BsoQaTL>+22Uk}v9w^R9 z7b_GtVFF>AKrX_0nHe&HG!NkO%m4tOkrff(gY*4(&VLTB&dxTDwhmt{>c0m6B4T3W z{^ifBa6kY6;dFk{{wy!E8h|?nfNlPwCGG@hUJIag_lst-4?wj5py}FI^KkfnJUm6A zkh$5}<>chpO2k52Vaiv1{%68pz*qfj`F=e7_x0eu;v|7GU4cgg_~63K^h~83&yop* zV%+ABM}Pdc3;+Bb(;~!4V!2o<6ys46agIcqjPo+3B8fthDa9qy|77CdEc*jK-!%ZR zYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S1Au6Q;m>#f??3%Vpd|o+W=WE9003S@ zBra6Svp>fO002awfhw>;8}z{#EWidF!3EsG3xE7zHiSYX#KJ-lLJDMn9CBbOtb#%) zhRv`YDqt_vKpix|QD}yfa1JiQRk#j4a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(-8Yg@e!jk@b%cLj{kSkAKUC4TkHUI6gT!;y-fz>HMcd&t%Ugo)`Y2 z{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P`?ZJ24cOCDe z-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy001CkNK#Dz0D2_=0Dyx40Dt-a z004mL004C`008P>0026e000+nl3&F}0001ANkly{YGO%h zib8p2Nrr;Er*A-tUMf3KJjBz*F~sBe+o^_J2Ml{pPR=H$1(~Ivc_*>$ z)|$iXFz5M}p6%rc?F=d>TO%yLPcTl`F|^t|DZeO2eY<-1?QNkJzmFAv3|II6@z`D| aXBqPo=krPL4qj{m+3e}+=d#Wzp$P!s<3U3J diff --git a/src/app.coffee b/src/app.coffee index 1468d47..24df7e4 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -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: -> diff --git a/src/hud.coffee b/src/hud.coffee index b059f05..bfac5c8 100644 --- a/src/hud.coffee +++ b/src/hud.coffee @@ -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 diff --git a/src/items/animateditem.coffee b/src/items/animateditem.coffee index f1cb5e3..de65906 100644 --- a/src/items/animateditem.coffee +++ b/src/items/animateditem.coffee @@ -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