Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (32 sloc) 0.763 kB
-- Score add animation
module Actor.ScoreAdd (
newScoreAdd
) where
import Actor (Actor(..))
import AppUtil (putimg)
import Const
import Images
vy :: Int
vy = -1
data ScoreAdd = ScoreAdd {
pnt :: Int,
sx :: Int,
sy :: Int,
cnt :: Int
}
instance Actor ScoreAdd where
update _ self = (self { sy = sy self + vy, cnt = cnt self + 1 }, [])
render self imgres scrx sur =
putimg sur imgres imgtype (sx self - scrx) (sy self)
where
imgtype = case pnt self of
100 -> Img100
200 -> Img200
400 -> Img400
500 -> Img500
1000 -> Img1000
_ -> undefined
bDead self = cnt self >= frameRate `div` 2
newScoreAdd :: Int -> Int -> Int -> ScoreAdd
newScoreAdd sx' sy' pnt' =
ScoreAdd { pnt = pnt', sx = sx', sy = sy', cnt = 0 }
Jump to Line
Something went wrong with that request. Please try again.