Index: /orxonox/trunk/src/Makefile.am
===================================================================
--- /orxonox/trunk/src/Makefile.am	(revision 3811)
+++ /orxonox/trunk/src/Makefile.am	(revision 3812)
@@ -34,4 +34,5 @@
 		 track_node.cc \
 		 animation.cc \
+		 animation_player.cc \
 		 simple_animation.cc \
 		 garbage_collector.cc \
@@ -85,4 +86,5 @@
 		 track_node.h \
 		 animation.h \
+		 animation_player.h \
 		 simple_animation.h \
 		 garbage_collector.h \
Index: /orxonox/trunk/src/Makefile.in
===================================================================
--- /orxonox/trunk/src/Makefile.in	(revision 3811)
+++ /orxonox/trunk/src/Makefile.in	(revision 3812)
@@ -56,10 +56,10 @@
 	command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \
 	track_manager.$(OBJEXT) track_node.$(OBJEXT) \
-	animation.$(OBJEXT) simple_animation.$(OBJEXT) \
-	garbage_collector.$(OBJEXT) story_entity.$(OBJEXT) \
-	campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
-	player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
-	skybox.$(OBJEXT) terrain.$(OBJEXT) weapon.$(OBJEXT) \
-	projectile.$(OBJEXT) satellite.$(OBJEXT) \
+	animation.$(OBJEXT) animation_player.$(OBJEXT) \
+	simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \
+	story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
+	world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
+	skysphere.$(OBJEXT) skybox.$(OBJEXT) terrain.$(OBJEXT) \
+	weapon.$(OBJEXT) projectile.$(OBJEXT) satellite.$(OBJEXT) \
 	character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \
 	test_bullet.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
@@ -77,4 +77,5 @@
 am__depfiles_maybe = depfiles
 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/animation.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/animation_player.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/array.Po ./$(DEPDIR)/base_entity.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/base_object.Po ./$(DEPDIR)/camera.Po \
@@ -246,4 +247,5 @@
 		 track_node.cc \
 		 animation.cc \
+		 animation_player.cc \
 		 simple_animation.cc \
 		 garbage_collector.cc \
@@ -297,4 +299,5 @@
 		 track_node.h \
 		 animation.h \
+		 animation_player.h \
 		 simple_animation.h \
 		 garbage_collector.h \
@@ -422,4 +425,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_player.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_entity.Po@am__quote@
Index: /orxonox/trunk/src/animation.cc
===================================================================
--- /orxonox/trunk/src/animation.cc	(revision 3811)
+++ /orxonox/trunk/src/animation.cc	(revision 3812)
@@ -17,4 +17,5 @@
 #include "animation.h"
 #include "debug.h"
+#include "animation_player.h"
 
 
@@ -27,4 +28,6 @@
   this->localTime = 0.0;
   this->bRunning = true;
+
+  AnimationPlayer::getInstance()->addAnimation(this);
 }
 
Index: /orxonox/trunk/src/animation_player.cc
===================================================================
--- /orxonox/trunk/src/animation_player.cc	(revision 3812)
+++ /orxonox/trunk/src/animation_player.cc	(revision 3812)
@@ -0,0 +1,99 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ANIM
+
+#include "animation_player.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+AnimationPlayer::AnimationPlayer () 
+{
+   this->setClassName ("AnimationPlayer");
+
+   this->animationList = new tList<Anim>();
+}
+
+/**
+   \brief the singleton reference to this class
+*/
+AnimationPlayer* AnimationPlayer::singletonRef = NULL;
+
+/**
+   \returns a Pointer to this Class
+*/
+AnimationPlayer* AnimationPlayer::getInstance(void)
+{
+  if (!AnimationPlayer::singletonRef)
+    AnimationPlayer::singletonRef = new AnimationPlayer();
+  return AnimationPlayer::singletonRef;
+}
+
+/**
+   \brief standard deconstructor
+
+   !! DANGER !! when unloading the AnimationPlayer no other Function
+   should reference any Animations, because it automatically deletes
+   them. This usually happens when unloading a World.
+*/
+AnimationPlayer::~AnimationPlayer () 
+{
+  // deleting the Animation List AND all the elements of the List
+   tIterator<Anim>* animIt = animationList->getIterator();
+  Anim* anim = animIt->nextElement();
+  while( anim != NULL)
+    {
+      delete anim;
+      anim = animIt->nextElement();
+    }
+  delete animIt;
+  delete this->animationList;
+
+  AnimationPlayer::singletonRef = NULL;
+}
+
+/**
+   \brief adds an Animation to the AnimationList.
+   \param animation the Animation to handle
+
+   when adding a Animation the Animation will too be deleted when
+   the AnimationPlayer gets deleted. Consider not adding it, or 
+   unadding it with animation->notHandled();
+*/
+void AnimationPlayer::addAnimation(Anim* animation)
+{
+  this->animationList->add(animation);
+}
+
+/**
+   \brief Ticks all the animations in animationList 
+   \param timePassed the time passed since the last tick.
+*/
+void AnimationPlayer::tick(float timePassed)
+{
+  tIterator<Anim>* animIt = animationList->getIterator();
+  Anim* anim = animIt->nextElement();
+  while( anim != NULL)
+    {
+      anim->tick(timePassed);
+      anim = animIt->nextElement();
+    }
+  delete animIt;
+
+}
Index: /orxonox/trunk/src/animation_player.h
===================================================================
--- /orxonox/trunk/src/animation_player.h	(revision 3812)
+++ /orxonox/trunk/src/animation_player.h	(revision 3812)
@@ -0,0 +1,34 @@
+/*! 
+    \file animation_player.h
+*/
+
+#ifndef _ANIMATION_PLAYER_H
+#define _ANIMATION_PLAYER_H
+
+#include "base_object.h"
+#include "animation.h"
+
+/* FORWARD DEFINITION */
+
+//! A AnimationPlayer, that handles the animation of all the Animations in the scene.
+class AnimationPlayer : public BaseObject {
+
+ public:
+  static AnimationPlayer* getInstance(void);
+  virtual ~AnimationPlayer(void);
+
+  void addAnimation(Anim* animation);
+
+  void tick(float timePassed);
+
+ private:
+  /* singleton */
+  AnimationPlayer(void);
+  static AnimationPlayer* singletonRef;
+
+  /* class specific */
+  tList<Anim>* animationList;              //!< A List of Animations to be handled
+};
+
+
+#endif /* _ANIMATION_PLAYER_H */
Index: /orxonox/trunk/src/defs/debug.h
===================================================================
--- /orxonox/trunk/src/defs/debug.h	(revision 3811)
+++ /orxonox/trunk/src/defs/debug.h	(revision 3812)
@@ -72,4 +72,5 @@
 #define DEBUG_MODULE_MATH               0
 #define DEBUG_MODULE_FONT               4
+#define DEBUG_MODULE_ANIM               3
 
 #define DEBUG_MODULE_NULL_PARENT        0
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 3811)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 3812)
@@ -39,5 +39,5 @@
 #include "garbage_collector.h"
 #include "simple_animation.h"
-#include "animation.h"
+#include "animation_player.h"
 
 #include "command_node.h"
@@ -162,4 +162,5 @@
 
   delete this->simpleAnimation;
+  delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
   //delete garbagecollecor
   //delete animator
@@ -184,4 +185,5 @@
   this->debugWorldNr = worldID;
   this->entities = new tList<WorldEntity>();
+  AnimationPlayer::getInstance(); // initializes the animationPlayer
 }
 
@@ -374,5 +376,5 @@
 	    testText->setBindNode(tn);
 
-	    testAnim = new tAnim<Text>(testText, &Text::setBlending);
+	    tAnim<Text>* testAnim = new tAnim<Text>(testText, &Text::setBlending);
 	    testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR);
 	    testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR);
@@ -944,5 +946,5 @@
       this->garbageCollector->tick(seconds);
       this->simpleAnimation->tick(seconds);
-      
+      AnimationPlayer::getInstance()->tick(seconds);
       //testAnim->tick(seconds);
 
@@ -1055,9 +1057,4 @@
   else if( !strcmp( cmd->cmd, "view4")) this->localCamera->setViewMode(VIEW_RIGHT);
   else if( !strcmp( cmd->cmd, "view5")) this->localCamera->setViewMode(VIEW_TOP);
-  if (!strcmp(cmd->cmd, "view0")) testAnim->play();
-  if (!strcmp(cmd->cmd, "view1")) testAnim->stop();
-  if (!strcmp(cmd->cmd, "view2")) testAnim->pause();
-  if (!strcmp(cmd->cmd, "view3")) testAnim->replay();
-  if (!strcmp(cmd->cmd, "view4")) testAnim->rewind();
 
   return false;
Index: /orxonox/trunk/src/story_entities/world.h
===================================================================
--- /orxonox/trunk/src/story_entities/world.h	(revision 3811)
+++ /orxonox/trunk/src/story_entities/world.h	(revision 3812)
@@ -25,5 +25,4 @@
 class GarbageCollector;
 class SimpleAnimation;
-template<class T> class tAnim;
 class Text;
 
@@ -100,5 +99,4 @@
   GLMenuImageScreen* glmis;           //!< The Level-Loader Display
 
-  tAnim<Text>* testAnim;
   Text* testText;                     //!< A text to Test the TextEngine;
 
