Custom anim event called after deleting object?

edited May 2011 in General discussions
I have defined graphic and animations for button like this
[PlayButton]
Graphic = PlayButtonGraphic
Position = (-50, 100, 1)
AnimationSet = PlayButtonAnimations

[PlayButtonAnimations]
AnimationList = PlayButtonStaticAnim # PlayButtonClickAnim
LinkList = PlayStatic2PlayStatic # PlayClick2PlayStatic

[PlayStatic2PlayStatic]
Source = PlayButtonStaticAnim
Destination = PlayButtonStaticAnim

[PlayClick2PlayStatic]
Source = PlayButtonClickAnim
Destination = PlayButtonStaticAnim

[PlayButtonStaticAnim]
DefaultKeyDuration = 1
KeyData1 = PlayButtonGraphic

[PlayButtonClickAnim]
DefaultKeyDuration = 0.2
KeyData1 = PlayButtonGraphicHover
KeyEventName1 = PlayButtonClick

This PlayButton is child of object Menu, which is removed after button is clicked (PlayButtonClick event). Menu disappears after click, but handler event is stil called every 0.2 secs and I wasn't able to figure out why is that happening. At first, I thought it's problem in animation definitions, but now I'm quite sure it's not.
void Screens::Home(void){
	orxObject_CreateFromConfig("Menu"); // contains PlayButton as Child
}

void Screens::Game(void){ // is called after PlayButton is clicked
	orxOBJECT *menu = Tools::GetObjectByName("Menu");
	
	if (menu != orxNULL) {
		orxObject_SetLifeTime(menu, orxFLOAT_0);	
		Game::Algorithm();
	}	
}

So, why is that happening? As it's making me quite mad right now because I'm probably doing something wrong again.

Comments

  • edited May 2011
    Hmm never mind, I found out why this was happening. Delete this topic please as it's useless (I just used if("PlayButton") on event name instead comparing strings. I'm probably too tired :D
  • edited May 2011
    Hehe, yes, maybe it's time to take a break and get some rest. ;) Glad you found the solution though! :)
Sign In or Register to comment.