create base classes for collectable powerups
This commit is contained in:
parent
310105ed48
commit
b51248e7e7
2 changed files with 24 additions and 1 deletions
23
src/Classes/Physics/Collectable.hs
Normal file
23
src/Classes/Physics/Collectable.hs
Normal 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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue