Show
Ignore:
Timestamp:
10/05/08 22:27:31 (3 months ago)
Author:
mokehehe
Message:

プレーヤー操作性調整
ノコノコを倒して蹴れるように
スコア演出追加

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/haskell/nario/Actor/Kinoko.hs

    r20775 r20811  
     1-- -*- mode: haskell; Encoding: UTF-8 -*- 
    12-- きのこ 
    23 
     
    89 
    910import Actor (Actor(..)) 
     11import Actor.Common (updateActorBase) 
    1012import Const 
    11 import Util (sgn) 
    1213import AppUtil (getImageSurface, cellCrd, Rect(..)) 
    1314import Images 
    1415import Field 
    1516import Player (PlayerType(..), getPlayerType, setPlayerType, addScore) 
     17import Event (Event(..)) 
    1618 
    17 maxVy = one * 6 
    18  
    19 pointKinoko = 1000 
     19ofsH = 15 
    2020 
    2121 
     
    2828 
    2929instance Actor Kinoko where 
    30         update fld self 
    31                 | isGround      = (self { x = x', vx = vx', y = (cellCrd y') * one * chrSize, vy = 0 }, []) 
    32                 | otherwise     = (self { x = x', vx = vx', y = y', vy = vy' }, []) 
     30        update fld self = (self', []) 
    3331                where 
    34                         x' = x self + vx self 
    35                         sideWall = isBlock $ fieldRef fld (cellCrd $ x' + sgn (vx self) * 6 * one) (cellCrd $ y self - chrSize * one `div` 2) 
    36                         vx' 
    37                                 | sideWall      = -(vx self) 
    38                                 | otherwise     = vx self 
    39  
    40                         vy' = min maxVy $ vy self + gravity 
    41                         y' = y self + vy' 
    42                         isGround = isBlock $ fieldRef fld (cellCrd $ x') (cellCrd y') 
     32                        self' = self { x = x', y = y', vx = vx', vy = vy' } 
     33                        (x', y', vx', vy') = updateActorBase fld (x self, y self, vx self, vy self) 
    4334 
    4435        render self imgres scrx sur = do 
    45                 blitSurface (getImageSurface imgres imgtype) Nothing sur (pt ((x self) `div` one - chrSize `div` 2 - scrx) ((y self) `div` one - 15 - 8)) 
     36                blitSurface (getImageSurface imgres imgtype) Nothing sur (pt ((x self) `div` one - chrSize `div` 2 - scrx) ((y self) `div` one - ofsH - 8)) 
    4637                return () 
    4738                where 
    4839                        imgtype = ImgKinoko 
    4940 
    50         bDead self = y self `div` one >= screenHeight + chrSize * 3 
     41        bDead self = y self >= (screenHeight + chrSize * 3) * one || x self <= -chrSize * one 
    5142 
    5243        getHitRect self = Just $ Rect (xx - 8) (yy - 16) (xx + 8) yy 
     
    5546                        yy = y self `div` one 
    5647 
    57         onHit pl self = (addScore pointKinoko $ setPlayerType nt pl, Nothing) 
     48        onHit pl self = (addScore pointKinoko $ setPlayerType nt pl, Nothing, ev) 
    5849                where 
    5950                        nt = case typ of 
     
    6152                                otherwise       -> typ 
    6253                        typ = getPlayerType pl 
    63  
     54                        ev = [EvScoreAddEfe (x self `div` one) (y self `div` one - chrSize * 2) pointKinoko] 
    6455 
    6556newKinoko :: Int -> Int -> Kinoko