diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 22:45:46 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 22:45:46 +0200 |
commit | f3ed8e46d5913806cd8873df678bcd3362e98c93 (patch) | |
tree | 1aadc6431183e00a7986eccabb73681fa0015da5 | |
parent | 25e0a6b7b06086ba156dfdd6b12da4fa6d34ee15 (diff) |
Added setCollisioners
-rw-r--r-- | Spear.lkshw | 2 | ||||
-rw-r--r-- | Spear/Scene/GameObject.hs | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Spear.lkshw b/Spear.lkshw index fb35953..840d91d 100644 --- a/Spear.lkshw +++ b/Spear.lkshw | |||
@@ -1,7 +1,7 @@ | |||
1 | Version of workspace file format: | 1 | Version of workspace file format: |
2 | 1 | 2 | 1 |
3 | Time of storage: | 3 | Time of storage: |
4 | "Thu Aug 30 22:30:11 CEST 2012" | 4 | "Thu Aug 30 22:44:59 CEST 2012" |
5 | Name of the workspace: | 5 | Name of the workspace: |
6 | "Spear" | 6 | "Spear" |
7 | File paths of contained packages: | 7 | File paths of contained packages: |
diff --git a/Spear/Scene/GameObject.hs b/Spear/Scene/GameObject.hs index 62bb27e..e012122 100644 --- a/Spear/Scene/GameObject.hs +++ b/Spear/Scene/GameObject.hs | |||
@@ -16,6 +16,7 @@ module Spear.Scene.GameObject | |||
16 | , setAnimation | 16 | , setAnimation |
17 | , setAnimationSpeed | 17 | , setAnimationSpeed |
18 | , withCollisioners | 18 | , withCollisioners |
19 | , setCollisioners | ||
19 | -- * Rendering | 20 | -- * Rendering |
20 | , goRender | 21 | , goRender |
21 | -- * Collision | 22 | -- * Collision |
@@ -170,6 +171,11 @@ withCollisioners :: GameObject -> ([Collisioner] -> [Collisioner]) -> GameObject | |||
170 | withCollisioners go f = go { collisioners = f $ collisioners go } | 171 | withCollisioners go f = go { collisioners = f $ collisioners go } |
171 | 172 | ||
172 | 173 | ||
174 | -- | Set the game object's collisioners. | ||
175 | setCollisioners :: GameObject -> [Collisioner] -> GameObject | ||
176 | setCollisioners go cols = go { collisioners = cols } | ||
177 | |||
178 | |||
173 | -- | Get the game object's ith bounding box. | 179 | -- | Get the game object's ith bounding box. |
174 | goAABB :: Int -> GameObject -> AABB | 180 | goAABB :: Int -> GameObject -> AABB |
175 | goAABB i go = goAABB' $ (collisioners go) !! i | 181 | goAABB i go = goAABB' $ (collisioners go) !! i |