summaryrefslogtreecommitdiffstats
path: root/src/CPUPlayer.hs
blob: ced2220ad37b4eeaea345ba74caef2cac48b27c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE DeriveDataTypeable #-}

module CPUPlayer ( CPUPlayer(..)
                 ) where


import Data.Typeable

import Transformable
import Vector
import GLDriver
import Player


data CPUPlayer = CPUPlayer Rotation
                 deriving (Typeable, Show)

instance Player CPUPlayer where
--    playerUpdate (CPUPlayer angle) _ = return (CPUPlayer (if (angle+0.2) > 180 then angle-359.8 else angle+0.2), Just angle, True, Just (-angle), ((fromIntegral . round $ angle) == angle) && ((round $ angle) `mod` 2 == 0))
    playerUpdate (CPUPlayer dir) _ = return (CPUPlayer dir', Just dir', True, Just $ negateV dir', False)
      where
        dir' = (fromAngle (0.2*pi/180)) >< dir