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"
|
||||
setMapRows : 50
|
||||
setMapColumns : 50
|
||||
setMapRows : 40
|
||||
setMapColumns : 40
|
||||
setSpawnerProbability : 0.01
|
||||
setFPS : 5
|
||||
|
|
|
@ -221,11 +221,27 @@ sendUpdates = do
|
|||
(\(player@(Player playerId wizard@(Wizard {..}))) -> do
|
||||
let V2 wr wc = wizardPos
|
||||
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
|
||||
(\(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
|
||||
else
|
||||
Nothing
|
||||
)
|
||||
subCoords
|
||||
-- liftIO $ print $ leftLine . (\x -> x - wr) . fromIntegral .fst <$> subCoords
|
||||
liftIO $ print initViewMatrix
|
||||
)
|
||||
players
|
||||
|
|
|
@ -29,7 +29,7 @@ newWizard
|
|||
newWizard pos =
|
||||
Wizard
|
||||
{ wizardWands = []
|
||||
, wizardRot = 0
|
||||
, wizardRot = 3
|
||||
, wizardPos = pos
|
||||
, wizardMana = 100
|
||||
, wizardHealth = 100
|
||||
|
|
Loading…
Reference in a new issue