diff options
author | Griffin Smith <root@gws.fyi> | 2019-09-10T00·54-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-09-10T00·54-0400 |
commit | 9ebdc6fbb446fea5e505172a6b3dd459beaf3552 (patch) | |
tree | a1403026afb597e12c25e84ef8991f062655e5b8 /src/Xanthous/Entities/SomeEntity.hs | |
parent | e01cf9b0565eaa9c09e19f66331a2010aea908cb (diff) |
Convert generated levels to walls
Add support for converting generated levels to walls, and merge one into the entity map at the beginning of the game. There's nothing here that guarantees the character ends up *inside* the level though (they almost always don't) so that'll have to be slotted into the level generation process.
Diffstat (limited to 'src/Xanthous/Entities/SomeEntity.hs')
-rw-r--r-- | src/Xanthous/Entities/SomeEntity.hs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/Xanthous/Entities/SomeEntity.hs b/src/Xanthous/Entities/SomeEntity.hs deleted file mode 100644 index 029247de9b7f..000000000000 --- a/src/Xanthous/Entities/SomeEntity.hs +++ /dev/null @@ -1,34 +0,0 @@ -{-# LANGUAGE GADTs #-} -module Xanthous.Entities.SomeEntity - ( SomeEntity(..) - , downcastEntity - ) where - -import Xanthous.Prelude -import Test.QuickCheck (Arbitrary(..)) -import qualified Test.QuickCheck.Gen as Gen - -import Xanthous.Entities (Draw(..), Entity) -import Data.Typeable -import Xanthous.Entities.Character - -data SomeEntity where - SomeEntity :: forall a. (Entity a, Typeable a) => a -> SomeEntity - -instance Show SomeEntity where - show (SomeEntity x) = "SomeEntity (" <> show x <> ")" - -instance Eq SomeEntity where - (SomeEntity (a :: ea)) == (SomeEntity (b :: eb)) = case eqT @ea @eb of - Just Refl -> a == b - _ -> False - -instance Arbitrary SomeEntity where - arbitrary = Gen.oneof - [pure $ SomeEntity Character] - -instance Draw SomeEntity where - draw (SomeEntity ent) = draw ent - -downcastEntity :: (Entity a, Typeable a) => SomeEntity -> Maybe a -downcastEntity (SomeEntity e) = cast e |