Untitled

 avatar
unknown
plain_text
2 years ago
657 B
6
Indexable
module Tarefa1 where

import LI12324

colisoesParede :: Mapa -> Personagem -> Bool
colisoesParede (Mapa _ _ b) Personagem {posicao = (px,py)} = 
    (b !! py1) !! px1 == P && py1 < length b-1 || px1 == 0 || px1 == length (head b)-1 || py1 ==0
    
    where px1 = round px
          py1 = round py

map1 = Mapa ((0.5, 5.5), Oeste) (0.5, 2.5)
        [[P, P, V, P, P, P, P, P, P, P]
        ,[V, V, V, V, V, V, V, V, V, V]
        ,[V, V, V, V, V, V, V, V, V, V]
        ,[P, P, V, V, V, V, P, P, P, P]
        ,[V, V, V, V, V, V, V, V, E, V]
        ,[V, V, V, V, V, V, V, V, E, V]
        ,[P, P, P, P, P, P, P, P, P, P]]
per = Personagem {posicao = (6,3)}
Editor is loading...
Leave a Comment