This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
htanks/HTanks.hs

25 lines
546 B
Haskell
Raw Normal View History

2010-02-22 16:50:42 +01:00
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