Changeset 21066 for lang/haskell

Show
Ignore:
Timestamp:
10/10/08 07:01:24 (3 months ago)
Author:
mokehehe
Message:

ファイヤーナリオのときにショットを撃てるように

Location:
lang/haskell/nario
Files:
2 added
15 modified

Legend:

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

    r20925 r21066  
    1 {-# OPTIONS_GHC -fglasgow-exts #-} 
     1{-# LANGUAGE ExistentialQuantification #-} 
    22-- -*- mode: haskell; Encoding: UTF-8 -*- 
    33 
     
    1717import Event (Event) 
    1818import Field (Field) 
    19 import Player (Player) 
     19import {-# SOURCE #-} Player (Player) 
    2020 
    2121 
  • lang/haskell/nario/Actor/AnimBlock.hs

    r20943 r21066  
    55        newAnimBlock 
    66) where 
    7  
    8 --import Multimedia.SDL hiding (Event) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Actor/BrokenBlock.hs

    r20943 r21066  
    55        newBrokenBlock 
    66) where 
    7  
    8 import Multimedia.SDL hiding (Event) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Actor/CoinGet.hs

    r20943 r21066  
    55        newCoinGet 
    66) where 
    7  
    8 import Multimedia.SDL hiding (Event) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Actor/Common.hs

    r20811 r21066  
    1 -- -*- mode: haskell; Encoding: UTF-8 -*- 
     1-- -*- mode: haskell; Encoding: UTF-8 -*- 
    22-- 共通動作 
    33 
     
    1313import Player (Player(..), getPlayerVY) 
    1414 
    15 maxVy = one * 5 
    1615 
    1716-- 共通動作 
  • lang/haskell/nario/Actor/Flower.hs

    r20943 r21066  
    55        newFlower 
    66) where 
    7  
    8 --import Multimedia.SDL (itSurface, pt) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Actor/Kinoko.hs

    r20943 r21066  
    55        newKinoko 
    66) where 
    7  
    8 --import Multimedia.SDL (blitSurface, pt) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Actor/Koura.hs

    r20943 r21066  
    55        newKoura 
    66) where 
    7  
    8 --import Multimedia.SDL (blitSurface, pt) 
    97 
    108import Actor (Actor(..), ActorWrapper(..)) 
  • lang/haskell/nario/Actor/Kuribo.hs

    r20943 r21066  
    55        newKuribo 
    66) where 
    7  
    8 --import Multimedia.SDL (blitSurface, pt) 
    97 
    108import Actor (Actor(..), ActorWrapper(..)) 
  • lang/haskell/nario/Actor/Nokonoko.hs

    r20943 r21066  
    55        newNokonoko 
    66) where 
    7  
    8 --import Multimedia.SDL (blitSurface, pt) 
    97 
    108import Actor (Actor(..), ActorWrapper(..)) 
  • lang/haskell/nario/Actor/ScoreAdd.hs

    r20943 r21066  
    55        newScoreAdd 
    66) where 
    7  
    8 --import Multimedia.SDL hiding (Event) 
    97 
    108import Actor (Actor(..)) 
  • lang/haskell/nario/Const.hs

    r20825 r21066  
    2222gravity = one * 2 `div` 5 
    2323 
     24-- 最大落下速度 
     25maxVy = one * 5 
     26 
    2427 
    2528-- ポイント 
  • lang/haskell/nario/Field.hs

    r20925 r21066  
    1313        fieldSet, 
    1414        isBlock, 
     15        hardBlock, 
    1516        renderField, 
    16         chr2img, 
    17         hardBlock 
     17        chr2img 
    1818) where 
    1919 
  • lang/haskell/nario/Images.hs

    r20825 r21066  
    11module Images (ImageType(..), imageTypes, imageFn) where 
    22import Maybe (fromJust) 
    3 data ImageType = Img100 | Img1000 | Img200 | Img400 | Img500 | ImgBlock1 | ImgBlock2 | ImgBlock3 | ImgBlock4 | ImgBlock5 | ImgBroken | ImgCloud00 | ImgCloud01 | ImgCloud02 | ImgCloud10 | ImgCloud11 | ImgCloud12 | ImgCoin0 | ImgCoin1 | ImgCoin2 | ImgCoin3 | ImgDk00 | ImgDk01 | ImgDk10 | ImgDk11 | ImgFlag | ImgFlower | ImgFNarioLJump | ImgFNarioLShot | ImgFNarioLSit | ImgFNarioLSlip | ImgFNarioLStand | ImgFNarioLWalk1 | ImgFNarioLWalk2 | ImgFNarioLWalk3 | ImgFNarioRJump | ImgFNarioRShot | ImgFNarioRSit | ImgFNarioRSlip | ImgFNarioRStand | ImgFNarioRWalk1 | ImgFNarioRWalk2 | ImgFNarioRWalk3 | ImgFont | ImgGrass0 | ImgGrass1 | ImgGrass2 | ImgKinoko | ImgKoura | ImgKoura2 | ImgKuri0 | ImgKuri1 | ImgKuriDead | ImgMt02 | ImgMt11 | ImgMt12 | ImgMt13 | ImgMt22 | ImgNarioDead | ImgNarioLJump | ImgNarioLSlip | ImgNarioLStand | ImgNarioLWalk1 | ImgNarioLWalk2 | ImgNarioLWalk3 | ImgNarioRJump | ImgNarioRSlip | ImgNarioRStand | ImgNarioRWalk1 | ImgNarioRWalk2 | ImgNarioRWalk3 | ImgNokoL0 | ImgNokoL1 | ImgNokoR0 | ImgNokoR1 | ImgPole0 | ImgPole1 | ImgSNarioLJump | ImgSNarioLSit | ImgSNarioLSlip | ImgSNarioLStand | ImgSNarioLWalk1 | ImgSNarioLWalk2 | ImgSNarioLWalk3 | ImgSNarioRJump | ImgSNarioRSit | ImgSNarioRSlip | ImgSNarioRStand | ImgSNarioRWalk1 | ImgSNarioRWalk2 | ImgSNarioRWalk3 | ImgTitle   deriving (Eq) 
    4 imageTypes = [Img100, Img1000, Img200, Img400, Img500, ImgBlock1, ImgBlock2, ImgBlock3, ImgBlock4, ImgBlock5, ImgBroken, ImgCloud00, ImgCloud01, ImgCloud02, ImgCloud10, ImgCloud11, ImgCloud12, ImgCoin0, ImgCoin1, ImgCoin2, ImgCoin3, ImgDk00, ImgDk01, ImgDk10, ImgDk11, ImgFlag, ImgFlower, ImgFNarioLJump, ImgFNarioLShot, ImgFNarioLSit, ImgFNarioLSlip, ImgFNarioLStand, ImgFNarioLWalk1, ImgFNarioLWalk2, ImgFNarioLWalk3, ImgFNarioRJump, ImgFNarioRShot, ImgFNarioRSit, ImgFNarioRSlip, ImgFNarioRStand, ImgFNarioRWalk1, ImgFNarioRWalk2, ImgFNarioRWalk3, ImgFont, ImgGrass0, ImgGrass1, ImgGrass2, ImgKinoko, ImgKoura, ImgKoura2, ImgKuri0, ImgKuri1, ImgKuriDead, ImgMt02, ImgMt11, ImgMt12, ImgMt13, ImgMt22, ImgNarioDead, ImgNarioLJump, ImgNarioLSlip, ImgNarioLStand, ImgNarioLWalk1, ImgNarioLWalk2, ImgNarioLWalk3, ImgNarioRJump, ImgNarioRSlip, ImgNarioRStand, ImgNarioRWalk1, ImgNarioRWalk2, ImgNarioRWalk3, ImgNokoL0, ImgNokoL1, ImgNokoR0, ImgNokoR1, ImgPole0, ImgPole1, ImgSNarioLJump, ImgSNarioLSit, ImgSNarioLSlip, ImgSNarioLStand, ImgSNarioLWalk1, ImgSNarioLWalk2, ImgSNarioLWalk3, ImgSNarioRJump, ImgSNarioRSit, ImgSNarioRSlip, ImgSNarioRStand, ImgSNarioRWalk1, ImgSNarioRWalk2, ImgSNarioRWalk3, ImgTitle] 
    5 imageFilenames = ["100.bmp", "1000.bmp", "200.bmp", "400.bmp", "500.bmp", "block1.bmp", "block2.bmp", "block3.bmp", "block4.bmp", "block5.bmp", "broken.bmp", "cloud00.bmp", "cloud01.bmp", "cloud02.bmp", "cloud10.bmp", "cloud11.bmp", "cloud12.bmp", "coin0.bmp", "coin1.bmp", "coin2.bmp", "coin3.bmp", "dk00.bmp", "dk01.bmp", "dk10.bmp", "dk11.bmp", "flag.bmp", "flower.bmp", "fNarioLJump.bmp", "fNarioLShot.bmp", "fNarioLSit.bmp", "fNarioLSlip.bmp", "fNarioLStand.bmp", "fNarioLWalk1.bmp", "fNarioLWalk2.bmp", "fNarioLWalk3.bmp", "fNarioRJump.bmp", "fNarioRShot.bmp", "fNarioRSit.bmp", "fNarioRSlip.bmp", "fNarioRStand.bmp", "fNarioRWalk1.bmp", "fNarioRWalk2.bmp", "fNarioRWalk3.bmp", "font.bmp", "grass0.bmp", "grass1.bmp", "grass2.bmp", "kinoko.bmp", "koura.bmp", "koura2.bmp", "kuri0.bmp", "kuri1.bmp", "kuriDead.bmp", "mt02.bmp", "mt11.bmp", "mt12.bmp", "mt13.bmp", "mt22.bmp", "narioDead.bmp", "narioLJump.bmp", "narioLSlip.bmp", "narioLStand.bmp", "narioLWalk1.bmp", "narioLWalk2.bmp", "narioLWalk3.bmp", "narioRJump.bmp", "narioRSlip.bmp", "narioRStand.bmp", "narioRWalk1.bmp", "narioRWalk2.bmp", "narioRWalk3.bmp", "nokoL0.bmp", "nokoL1.bmp", "nokoR0.bmp", "nokoR1.bmp", "pole0.bmp", "pole1.bmp", "sNarioLJump.bmp", "sNarioLSit.bmp", "sNarioLSlip.bmp", "sNarioLStand.bmp", "sNarioLWalk1.bmp", "sNarioLWalk2.bmp", "sNarioLWalk3.bmp", "sNarioRJump.bmp", "sNarioRSit.bmp", "sNarioRSlip.bmp", "sNarioRStand.bmp", "sNarioRWalk1.bmp", "sNarioRWalk2.bmp", "sNarioRWalk3.bmp", "title.bmp"] 
     3data ImageType = Img100 | Img1000 | Img200 | Img400 | Img500 | ImgBlock1 | ImgBlock2 | ImgBlock3 | ImgBlock4 | ImgBlock5 | ImgBroken | ImgCloud00 | ImgCloud01 | ImgCloud02 | ImgCloud10 | ImgCloud11 | ImgCloud12 | ImgCoin0 | ImgCoin1 | ImgCoin2 | ImgCoin3 | ImgDk00 | ImgDk01 | ImgDk10 | ImgDk11 | ImgFire0 | ImgFire1 | ImgFire2 | ImgFire3 | ImgFlag | ImgFlower | ImgFNarioLJump | ImgFNarioLShot | ImgFNarioLSit | ImgFNarioLSlip | ImgFNarioLStand | ImgFNarioLWalk1 | ImgFNarioLWalk2 | ImgFNarioLWalk3 | ImgFNarioRJump | ImgFNarioRShot | ImgFNarioRSit | ImgFNarioRSlip | ImgFNarioRStand | ImgFNarioRWalk1 | ImgFNarioRWalk2 | ImgFNarioRWalk3 | ImgFont | ImgGrass0 | ImgGrass1 | ImgGrass2 | ImgKinoko | ImgKoura | ImgKoura2 | ImgKuri0 | ImgKuri1 | ImgKuriDead | ImgMt02 | ImgMt11 | ImgMt12 | ImgMt13 | ImgMt22 | ImgNarioDead | ImgNarioLJump | ImgNarioLSlip | ImgNarioLStand | ImgNarioLWalk1 | ImgNarioLWalk2 | ImgNarioLWalk3 | ImgNarioRJump | ImgNarioRSlip | ImgNarioRStand | ImgNarioRWalk1 | ImgNarioRWalk2 | ImgNarioRWalk3 | ImgNokoL0 | ImgNokoL1 | ImgNokoR0 | ImgNokoR1 | ImgPole0 | ImgPole1 | ImgSNarioLJump | ImgSNarioLSit | ImgSNarioLSlip | ImgSNarioLStand | ImgSNarioLWalk1 | ImgSNarioLWalk2 | ImgSNarioLWalk3 | ImgSNarioRJump | ImgSNarioRSit | ImgSNarioRSlip | ImgSNarioRStand | ImgSNarioRWalk1 | ImgSNarioRWalk2 | ImgSNarioRWalk3 | ImgTitle       deriving (Eq) 
     4imageTypes = [Img100, Img1000, Img200, Img400, Img500, ImgBlock1, ImgBlock2, ImgBlock3, ImgBlock4, ImgBlock5, ImgBroken, ImgCloud00, ImgCloud01, ImgCloud02, ImgCloud10, ImgCloud11, ImgCloud12, ImgCoin0, ImgCoin1, ImgCoin2, ImgCoin3, ImgDk00, ImgDk01, ImgDk10, ImgDk11, ImgFire0, ImgFire1, ImgFire2, ImgFire3, ImgFlag, ImgFlower, ImgFNarioLJump, ImgFNarioLShot, ImgFNarioLSit, ImgFNarioLSlip, ImgFNarioLStand, ImgFNarioLWalk1, ImgFNarioLWalk2, ImgFNarioLWalk3, ImgFNarioRJump, ImgFNarioRShot, ImgFNarioRSit, ImgFNarioRSlip, ImgFNarioRStand, ImgFNarioRWalk1, ImgFNarioRWalk2, ImgFNarioRWalk3, ImgFont, ImgGrass0, ImgGrass1, ImgGrass2, ImgKinoko, ImgKoura, ImgKoura2, ImgKuri0, ImgKuri1, ImgKuriDead, ImgMt02, ImgMt11, ImgMt12, ImgMt13, ImgMt22, ImgNarioDead, ImgNarioLJump, ImgNarioLSlip, ImgNarioLStand, ImgNarioLWalk1, ImgNarioLWalk2, ImgNarioLWalk3, ImgNarioRJump, ImgNarioRSlip, ImgNarioRStand, ImgNarioRWalk1, ImgNarioRWalk2, ImgNarioRWalk3, ImgNokoL0, ImgNokoL1, ImgNokoR0, ImgNokoR1, ImgPole0, ImgPole1, ImgSNarioLJump, ImgSNarioLSit, ImgSNarioLSlip, ImgSNarioLStand, ImgSNarioLWalk1, ImgSNarioLWalk2, ImgSNarioLWalk3, ImgSNarioRJump, ImgSNarioRSit, ImgSNarioRSlip, ImgSNarioRStand, ImgSNarioRWalk1, ImgSNarioRWalk2, ImgSNarioRWalk3, ImgTitle] 
     5imageFilenames = ["100.bmp", "1000.bmp", "200.bmp", "400.bmp", "500.bmp", "block1.bmp", "block2.bmp", "block3.bmp", "block4.bmp", "block5.bmp", "broken.bmp", "cloud00.bmp", "cloud01.bmp", "cloud02.bmp", "cloud10.bmp", "cloud11.bmp", "cloud12.bmp", "coin0.bmp", "coin1.bmp", "coin2.bmp", "coin3.bmp", "dk00.bmp", "dk01.bmp", "dk10.bmp", "dk11.bmp", "fire0.bmp", "fire1.bmp", "fire2.bmp", "fire3.bmp", "flag.bmp", "flower.bmp", "fNarioLJump.bmp", "fNarioLShot.bmp", "fNarioLSit.bmp", "fNarioLSlip.bmp", "fNarioLStand.bmp", "fNarioLWalk1.bmp", "fNarioLWalk2.bmp", "fNarioLWalk3.bmp", "fNarioRJump.bmp", "fNarioRShot.bmp", "fNarioRSit.bmp", "fNarioRSlip.bmp", "fNarioRStand.bmp", "fNarioRWalk1.bmp", "fNarioRWalk2.bmp", "fNarioRWalk3.bmp", "font.bmp", "grass0.bmp", "grass1.bmp", "grass2.bmp", "kinoko.bmp", "koura.bmp", "koura2.bmp", "kuri0.bmp", "kuri1.bmp", "kuriDead.bmp", "mt02.bmp", "mt11.bmp", "mt12.bmp", "mt13.bmp", "mt22.bmp", "narioDead.bmp", "narioLJump.bmp", "narioLSlip.bmp", "narioLStand.bmp", "narioLWalk1.bmp", "narioLWalk2.bmp", "narioLWalk3.bmp", "narioRJump.bmp", "narioRSlip.bmp", "narioRStand.bmp", "narioRWalk1.bmp", "narioRWalk2.bmp", "narioRWalk3.bmp", "nokoL0.bmp", "nokoL1.bmp", "nokoR0.bmp", "nokoR1.bmp", "pole0.bmp", "pole1.bmp", "sNarioLJump.bmp", "sNarioLSit.bmp", "sNarioLSlip.bmp", "sNarioLStand.bmp", "sNarioLWalk1.bmp", "sNarioLWalk2.bmp", "sNarioLWalk3.bmp", "sNarioRJump.bmp", "sNarioRSit.bmp", "sNarioRSlip.bmp", "sNarioRStand.bmp", "sNarioRWalk1.bmp", "sNarioRWalk2.bmp", "sNarioRWalk3.bmp", "title.bmp"] 
    66imageFn = fromJust . flip lookup (zip imageTypes imageFilenames) 
  • lang/haskell/nario/Player.hs

    r20943 r21066  
    2222) where 
    2323 
    24 import Multimedia.SDL (blitSurface, pt) 
     24--import Multimedia.SDL (blitSurface, pt) 
    2525import Data.Bits ((.&.)) 
    2626 
     
    3131import Field 
    3232import Event 
     33import Actor (ActorWrapper(..)) 
     34import Actor.Shot 
    3335 
    3436 
    3537walkVx = one * 4 `div` 2 
    3638runVx = one * 11 `div` 4 
    37 maxVy = one * 5 
    3839acc = one `div` 32 
    3940acc2 = one `div` 14 
     
    7576 
    7677newPlayer = Player { 
    77         pltype = SmallNario, 
     78        pltype = FireNario, 
    7879        plstate = Normal, 
    7980        x = 3 * chrSize * one, 
     
    242243                vy' = (jumpVy2 - jumpVy) * (abs $ vx self) `div` runVx + jumpVy 
    243244 
     245 
     246-- ショットを撃つ? 
     247shot :: KeyProc -> Player -> (Player, [Event]) 
     248shot kp self 
     249        | canShot && padPressed kp PadB = (shotPl, shotEv) 
     250        | otherwise                                             = (self, []) 
     251        where 
     252                canShot = pltype self == FireNario 
     253                shotPl = self 
     254                shotEv = [EvAddActor $ ActorWrapper $ newShot (x self) (y self) (lr self)] 
     255 
     256 
    244257-- 更新処理 
    245258updatePlayer :: KeyProc -> Field -> Player -> (Player, [Event]) 
     
    254267-- 通常時 
    255268updateNormal :: KeyProc -> Field -> Player -> (Player, [Event]) 
    256 updateNormal kp fld self = 
    257         moveY $ scroll self $ checkX fld $ moveX kp self 
    258         where 
     269updateNormal kp fld self = (self'', ev' ++ ev'') 
     270        where 
     271                (self', ev') = moveY $ scroll self $ checkX fld $ moveX kp self 
     272                (self'', ev'') = shot kp self' 
    259273                moveY = checkCeil fld . doJump kp . checkFloor fld . fall (padPressing kp PadA) 
    260274