AnimationEngine Arcade "shooter" strategy?
Malte Pfaff-Brill
revolution at derbrill.de
Thu Jan 14 19:45:43 EST 2010
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