From 86d5ba6dc45900f8aa11090412746d205760a559 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 24 Feb 2018 22:24:48 +0100 Subject: [PATCH] blargh --- src/Floorplan.hs | 2 +- src/Test.hs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Floorplan.hs b/src/Floorplan.hs index a401e91..1d5ef69 100644 --- a/src/Floorplan.hs +++ b/src/Floorplan.hs @@ -309,7 +309,7 @@ buildDoorsGraph mat = then [(fr, fc + 1)] else []) in foldl flood (acc ++ ncoords) ncoords - roomcoords = flood [] coord + roomcoords = flood [coord] coord b = Boundaries (minimum (map fst roomcoords), minimum (map snd roomcoords)) (maximum (map fst roomcoords), maximum (map snd roomcoords)) diff --git a/src/Test.hs b/src/Test.hs index fd9894e..e16ca9a 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -27,7 +27,7 @@ import Debug.Trace loadMap :: Affection UserData () loadMap = do ud <- getAffection - let fc = FloorConfig (20, 20) [(5,5), (45, 95)] (50,100) + let fc = FloorConfig (20, 20) [(5,5), (45, 75)] (80,80) (Subsystems _ m) = subsystems ud matrix <- liftIO $ buildHallFloorIO fc (nws, nworld) <- yieldSystemT (worldState ud) $ do @@ -104,7 +104,7 @@ drawMap = do (zip [0..] (toLists matrix)) updateMap :: Double -> Affection UserData () -updateMap _ = do +updateMap dt = do ud <- getAffection (nws, nw) <- yieldSystemT (worldState ud) $ do emap $ do @@ -112,7 +112,7 @@ updateMap _ = do pos' <- E.get pos vel' <- E.get vel pure $ defEntity' - { pos = Set $ pos' + vel' + { pos = Set $ pos' + fmap (* (4 * dt)) vel' } getWorld putAffection ud @@ -131,12 +131,12 @@ drawTile row col tile = do let V2 pr pc = head playerPos ctx = nano ud (xinit, yinit) = initCoords $ stateData ud - tileWidth = 20 :: Double - tileHeight = 10 :: Double + tileWidth = 64 :: Double + tileHeight = 32 :: Double liftIO $ do save ctx beginPath ctx - let x = realToFrac $ 650 + ((fromIntegral col - pc) + + let x = realToFrac $ (640 + tileWidth / 2) + ((fromIntegral col - pc) + (fromIntegral row - pr)) * (tileWidth / 2) y = realToFrac $ 360 + ((fromIntegral row - pr) - (fromIntegral col - pc)) * (tileHeight / 2)