Show
Ignore:
Timestamp:
10/03/08 23:41:05 (3 months ago)
Author:
mokehehe
Message:

ブロックを叩いたときのアニメをマシにした

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/haskell/nario/Main.hs

    r20534 r20641  
    7575                _               -> checkSDLEvent 
    7676 
    77 ---- 
    78 data ObjWrapper = forall a. Actor a => ObjWrapper a     -- 存在型aの動く範囲を型クラスDuckに制限 
    79  
    80 updateActors :: [ObjWrapper] -> [(ObjWrapper, [Event])] 
    81 updateActors = map (\(ObjWrapper x) -> let (x', ev') = update x in (ObjWrapper x', ev')) 
    82  
    83 renderActors :: ImageResource -> Int -> Surface -> [ObjWrapper] -> IO () 
    84 renderActors imgres ofsx sur = mapM_ (\(ObjWrapper x) -> render x imgres ofsx sur) 
    85  
    8677 
    8778-- 状態 
     
    144135                                (pl', ev) = updatePlayer kp (fld gs) (pl gs) 
    145136                                actors_updates = updateActors (actors gs) 
    146                                 actors' = map fst actors_updates 
     137                                actors' = filterActors $ map fst actors_updates 
    147138                                ev' = concatMap snd actors_updates 
    148139 
     
    159150procEvent gs ev = foldl f gs ev 
    160151        where 
    161                 f gs (EvHitBlock imgtype cx cy) = gs { fld = fld', actors = actors' } 
    162                         where 
     152                f gs (EvHitBlock imgtype cx cy) 
     153                        | hardBlock c   = gs 
     154                        | otherwise             = gs { fld = fld', actors = actors' } 
     155                        where 
     156                                c = fieldRef (fld gs) cx cy 
     157                                actors' = actors gs ++ [ObjWrapper $ newAnimBlock cx cy $ fieldRef (fld gs) cx cy] 
    163158                                fld' = fieldSet (fld gs) cx cy '*' 
    164                                 actors' = (ObjWrapper $ newAnimBlock cx cy) : actors gs 
    165159                f gs (EvSetField cx cy c) = gs { fld = fld' } 
    166160                        where 
     
    189183renderInfo :: GameGame -> ImageResource -> Scr 
    190184renderInfo gs imgres sur = do 
    191         puts 3 1 "MARIO" 
     185        puts 3 1 "NARIO" 
    192186        puts 3 2 $ deciWide 6 '0' $ getPlayerScore (pl gs) 
    193187        puts 11 2 ("?*" ++ deciWide 2 '0' (getPlayerMedal (pl gs)))