Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 41 lines (32 sloc) 0.763 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
-- 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 }
Something went wrong with that request. Please try again.