trouble with aeMoveTo & aeMoveDone

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Post Reply
rudyrever
Posts: 10
Joined: Wed Aug 19, 2009 11:17 am
Location: Murfreesboro,TN,USA
Contact:

trouble with aeMoveTo & aeMoveDone

Post by rudyrever » Fri Nov 27, 2009 9:51 pm

I'm new to Animation engine and I am using it to have 5th grade students who have good musical rhythm and keyboarding skills make animated candles dance above a Hanukkah Menorah for a holiday program. Using 8 keydown handlers to call the aeMoveTo command to make the 8 buttons (candle icon) jump up and then having the aeMoveDone callback handler in each candle's script to bring them done with a satisfying bounce, I have created a wonderful dance format to have the candles leaping in sync with live music on any key combination the would make clever sequential group movements.
My problem is that when I go the next card for a different scene and type of animation, I get error windows popping up applying to the buttons that have the on aemoveDone scripts in them. I am assuming that this is because their is nothing clearing a second aeMoveDone callback made after the buttons execute their internal aeMoveTo scripts to fall back donw to their starting positions:

on aeMoveDone
aeMoveTo the long ID of button "candle1",373,217, 500,"bounce"
end aeMoveDone

Even though the key strokes execute everything beautifully, it is the script windows of the animated buttons that open up with the following error when I "go next":

Chunk: no such object
Object candle1
Line aeMoveTo the long ID of button "candle1",373,217, 500,"bounce"
Hint candle1

I assume the next card is calling for the object.

How do I clear out the callbacks or whatever is firing up the error windows when I go to the next card?
rudyrev

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: trouble with aeMoveTo & aeMoveDone

Post by malte » Fri Nov 27, 2009 11:40 pm

Hi,

what happens here is that you end up in a neverending loop of aeMoveDone calls, sent every 500 milliseconds. You can fix that with a condition check.

[edit: adding a there is condition check too to make it saver]

Code: Select all

on aeMoveDone
  if there is a button "candle1" then
    if the loc of button "candle1" <> 373,217 then
      aeMoveTo the long ID of button "candle1",373,217, 500,"bounce"
    end if
  end if
end aeMoveDone
Also, if you want to leave the card, you can call

aeStopMoving "all"

to stop all movement that is currently executed. I think I forgot to document that call. Sorry about that. :-) It would also take the long ID of a moving control as a parameter to stop that.

Hope that helps,

Malte

rudyrever
Posts: 10
Joined: Wed Aug 19, 2009 11:17 am
Location: Murfreesboro,TN,USA
Contact:

Re: trouble with aeMoveTo & aeMoveDone

Post by rudyrever » Sat Nov 28, 2009 2:21 am

Thanks so much Malte. The aeStopMoving "all" handler is a godsend.
rudyrev

Post Reply

Return to “Animation Engine”