|
Revision 20680, 0.7 kB
(checked in by mokehehe, 5 years ago)
|
|
きのこを取って巨大化
花を取ってファイヤー化(ショットはまだ撃てない)
|
| Line | |
|---|
| 1 | -- クリボー |
|---|
| 2 | |
|---|
| 3 | module Actor.Nokonoko ( |
|---|
| 4 | newNokonoko |
|---|
| 5 | ) where |
|---|
| 6 | |
|---|
| 7 | import Multimedia.SDL hiding (Event) |
|---|
| 8 | |
|---|
| 9 | import Actor (Actor(..)) |
|---|
| 10 | import Const |
|---|
| 11 | import AppUtil |
|---|
| 12 | import Images |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | data Nokonoko = Nokonoko { |
|---|
| 16 | x :: Int, |
|---|
| 17 | y :: Int, |
|---|
| 18 | vx :: Int, |
|---|
| 19 | vy :: Int, |
|---|
| 20 | cnt :: Int |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | instance 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 | |
|---|
| 32 | newNokonoko :: Int -> Int -> Nokonoko |
|---|
| 33 | newNokonoko cx cy = |
|---|
| 34 | Nokonoko { x = cx * chrSize * one, y = cy * chrSize * one, vx = -one `div` 2, vy = 0, cnt = 0 } |
|---|