cut out
This commit is contained in:
parent
7c3fe35ca4
commit
0c805f3aa2
3 changed files with 20 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
setSocketPath : "/tmp/wizard.sock"
|
setSocketPath : "/tmp/wizard.sock"
|
||||||
setMapRows : 50
|
setMapRows : 40
|
||||||
setMapColumns : 50
|
setMapColumns : 40
|
||||||
setSpawnerProbability : 0.01
|
setSpawnerProbability : 0.01
|
||||||
setFPS : 5
|
setFPS : 5
|
||||||
|
|
|
@ -221,11 +221,27 @@ sendUpdates = do
|
||||||
(\(player@(Player playerId wizard@(Wizard {..}))) -> do
|
(\(player@(Player playerId wizard@(Wizard {..}))) -> do
|
||||||
let V2 wr wc = wizardPos
|
let V2 wr wc = wizardPos
|
||||||
subCoords = (,) <$> [floor wr - 4 .. floor wr + 4] <*> [floor wc - 4 .. floor wc + 4]
|
subCoords = (,) <$> [floor wr - 4 .. floor wr + 4] <*> [floor wc - 4 .. floor wc + 4]
|
||||||
|
leftBound = wizardRot + (pi / 4)
|
||||||
|
rightBound = wizardRot - (pi / 4)
|
||||||
|
leftLine row = cos leftBound * row
|
||||||
|
rightLine row = sin rightBound * row
|
||||||
|
correctionLeft = if wizardRot < pi / 2 || wizardRot > 4 * pi / 2
|
||||||
|
then floor
|
||||||
|
else ceiling
|
||||||
|
correctionRight = if wizardRot < pi / 2 || wizardRot > 4 * pi / 2
|
||||||
|
then ceiling
|
||||||
|
else floor
|
||||||
initViewMatrix = M.fromList 9 9 $ map
|
initViewMatrix = M.fromList 9 9 $ map
|
||||||
(\(qr, qc) ->
|
(\(qr, qc) ->
|
||||||
|
if qc - floor wc <= correctionLeft (leftLine (wr - fromIntegral qr))
|
||||||
|
&& qc - floor wc >= correctionRight (rightLine (wr - fromIntegral qr))
|
||||||
|
then
|
||||||
M.safeGet qr qc tileMap
|
M.safeGet qr qc tileMap
|
||||||
|
else
|
||||||
|
Nothing
|
||||||
)
|
)
|
||||||
subCoords
|
subCoords
|
||||||
|
-- liftIO $ print $ leftLine . (\x -> x - wr) . fromIntegral .fst <$> subCoords
|
||||||
liftIO $ print initViewMatrix
|
liftIO $ print initViewMatrix
|
||||||
)
|
)
|
||||||
players
|
players
|
||||||
|
|
|
@ -29,7 +29,7 @@ newWizard
|
||||||
newWizard pos =
|
newWizard pos =
|
||||||
Wizard
|
Wizard
|
||||||
{ wizardWands = []
|
{ wizardWands = []
|
||||||
, wizardRot = 0
|
, wizardRot = 3
|
||||||
, wizardPos = pos
|
, wizardPos = pos
|
||||||
, wizardMana = 100
|
, wizardMana = 100
|
||||||
, wizardHealth = 100
|
, wizardHealth = 100
|
||||||
|
|
Loading…
Reference in a new issue