Oiling the Gears in an App with Lots of Moving Parts
Posted: Thu Feb 02, 2012 3:36 am
I've got a relatively simple graphical drag and drop game that I'm building for practice. It consists of dragging the planets to the correct orbits around the sun. Currently, when the user drags a planet to the correct orbit, the planet (which is a button object) moves along a circular path determined by a free hand curve.
Then in each button's script is the following code to keep it orbiting:
When I try to move the last planet, the program lags quite a bit. Is there anyway to speed up the processing or eliminate the lag? Will it require a different approach?
Code: Select all
if intersect(button thingGrabbed, graphic thingGrabbed, 1) then
move button thingGrabbed to the points of graphic (thingGrabbed & "hilite") without waiting
else
set the icon of button thingGrabbed to (thingGrabbed & "big")
set the width of button thingGrabbed to the width of img (thingGrabbed & "big")
set the height of button thingGrabbed to the height of img (thingGrabbed & "big")
move button thingGrabbed to the loc of img (thingGrabbed & "big") in .5 seconds without waiting
end if
Code: Select all
if intersect(me, graphic (the short name of me), 1) then
move me to the points of graphic ((the short name of me) & "hilite") without waiting
end if