diff options
Diffstat (limited to 'HTanks.hs')
-rw-r--r-- | HTanks.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/HTanks.hs b/HTanks.hs new file mode 100644 index 0000000..cf3aae0 --- /dev/null +++ b/HTanks.hs @@ -0,0 +1,24 @@ +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 |