root/lang/haskell/nario/Actor/Nokonoko.hs @ 20775

Revision 20680, 0.7 kB (checked in by mokehehe, 5 years ago)

きのこを取って巨大化
花を取ってファイヤー化(ショットはまだ撃てない)

Line 
1-- クリボー
2
3module Actor.Nokonoko (
4        newNokonoko
5) where
6
7import Multimedia.SDL hiding (Event)
8
9import Actor (Actor(..))
10import Const
11import AppUtil
12import Images
13
14
15data Nokonoko = Nokonoko {
16        x :: Int,
17        y :: Int,
18        vx :: Int,
19        vy :: Int,
20        cnt :: Int
21        }
22
23instance Actor Nokonoko where
24        update fld self = (self { x = x self + vx self, cnt = cnt self + 1 }, [])
25
26        render self imgres scrx sur = do
27                blitSurface (getImageSurface imgres imgtype) Nothing sur (pt ((x self) `div` one - scrx) ((y self) `div` one - 8))
28                return ()
29                where
30                        imgtype = [ImgNoko0, ImgNoko1] !! (cnt self `mod` 16 `div` 8)
31
32newNokonoko :: Int -> Int -> Nokonoko
33newNokonoko cx cy =
34        Nokonoko { x = cx * chrSize * one, y = cy * chrSize * one, vx = -one `div` 2, vy = 0, cnt = 0 }
Note: See TracBrowser for help on using the browser.