25 lines
546 B
Haskell
25 lines
546 B
Haskell
![]() |
import Game
|
||
|
import Level
|
||
|
import Tank
|
||
|
import Control.Monad.State
|
||
|
|
||
|
import GLDriver
|
||
|
import GLX
|
||
|
|
||
|
main :: IO ()
|
||
|
main = do
|
||
|
glxContext <- initGL glxDriver
|
||
|
|
||
|
let gameState = GameState {level = testLevel, tanks = [Tank 0.5 0.5 0]}
|
||
|
|
||
|
(_, gameState) <- runGame gameState mainLoop
|
||
|
print $ tanks gameState
|
||
|
|
||
|
mainLoop :: Game ()
|
||
|
mainLoop = do
|
||
|
(tank:_) <- gets tanks
|
||
|
let newtank = tank {posx = 1 + posx tank}
|
||
|
modify $ \game -> game {tanks = newtank:(tail $ tanks game)}
|
||
|
gets tanks >>= \t -> liftIO $ print t
|
||
|
when (posx newtank < 10) mainLoop
|