From f3ed8e46d5913806cd8873df678bcd3362e98c93 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Thu, 30 Aug 2012 22:45:46 +0200 Subject: Added setCollisioners --- Spear.lkshw | 2 +- Spear/Scene/GameObject.hs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Spear.lkshw b/Spear.lkshw index fb35953..840d91d 100644 --- a/Spear.lkshw +++ b/Spear.lkshw @@ -1,7 +1,7 @@ Version of workspace file format: 1 Time of storage: - "Thu Aug 30 22:30:11 CEST 2012" + "Thu Aug 30 22:44:59 CEST 2012" Name of the workspace: "Spear" 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 , setAnimation , setAnimationSpeed , withCollisioners +, setCollisioners -- * Rendering , goRender -- * Collision @@ -170,6 +171,11 @@ withCollisioners :: GameObject -> ([Collisioner] -> [Collisioner]) -> GameObject withCollisioners go f = go { collisioners = f $ collisioners go } +-- | Set the game object's collisioners. +setCollisioners :: GameObject -> [Collisioner] -> GameObject +setCollisioners go cols = go { collisioners = cols } + + -- | Get the game object's ith bounding box. goAABB :: Int -> GameObject -> AABB goAABB i go = goAABB' $ (collisioners go) !! i -- cgit v1.2.3