AnimationEngine Arcade "shooter" strategy?

John Patten johnpatten at mac.com
Fri Jan 15 23:09:06 EST 2010


Thanks Malte! 

I just have one little issue with the example. I have the aeEnterFrame deleting the grc "target" when there is a collision between the projectile and the grc "target." However, after it deletes the grc it throws up the script dialog box immediately with "password required" for the AnimationEngine stack.

I think it's related to the aeMoveDone call, because after I delete the grc "target" it can't complete the aeMoveTo nestled in the aeMoveDone call anymore.

I attempted to trap for this by adding some conditions based on the number of grc "target" (s), so that if it = 0 it would just exit aeMoveDone.  That didn't seem to help. Any suggestions?

Thanks for your help!

Thank you!

John Patten


--------------snip--------

Message: 25
Date: Fri, 15 Jan 2010 01:45:43 +0100
From: Malte Pfaff-Brill <revolution at derbrill.de>
Subject: Re: AnimationEngine Arcade "shooter" strategy?
To: use-revolution at lists.runrev.com
Message-ID: <C68C4F21-E294-4F1F-9D62-82805C460630 at derbrill.de>
Content-Type: text/plain; charset=us-ascii

Hi John,

if you use AE 2.9 or higher, aeMoveTo is your friend.

aeMoveTo is a one line command that moves your object. it automatically sets up the needed timer to move the object and moves it from its current location to an end point you specify. You can apply an easing effect to the movement, which makes it look quite nicely. Also, aeMoveTo sends callback messages, while the object is moving.

Here is a starter. Assumes AE is in use and a button "projectile" and a button "target" exist. Also an image "cannon" Script is in the card:

on mouseDown
  set the loc of btn "projectile" to the loc of image "cannon"
  shoot
end mouseDown

on shoot
  aeMoveTo the long ID of btn "projectile",the mouseLoc,400,"inOut"
end shoot

on aeEnterFrame
  if intersect(btn "projectile",btn "target") then
     --more sophisticated collision detection goes here
     put "boom"
  end if
end aeEnterFrame

Hope that helps,

Malte

------------------------------



More information about the use-livecode mailing list