create base classes for collectable powerups

This commit is contained in:
nek0 2021-04-18 14:56:32 +02:00
parent 7456840238
commit f3a70c100f
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,23 @@
module Classes.Physics.Collectable where
-- | All kinds of Effects present in the game
data Effect
= HealthUp
| SpeedUp
| JumpUp
| ArmorUp
| Antidote
| StopTime
| Invisibility
-- | The Effect holder type definition
data EffectHolder = EffectHolder
{ effectDuration :: Double -- ^ Duration of stored effect
, effectReleased :: Effect -- ^ The actual effect released
}
class Collidible c => Collectable c where
effect
:: c -- ^ Collectable object
-> EffectHolder -- ^ The descriptor of the effect contained

View file

@ -1,4 +1,4 @@
{-# LANGUAGE ExistentialQuantification #-}
module Types.Tangible where
data Tangible = forall a . Collidible a => Tangible a
data Tangible = forall a . Collectable a => Tangible a