Hi,
I have been trying to make a catapult game in which you pull back this cup on a string with a rock in it, let it go, and try to hit a target. My problem? My problem is that when you let go of the cup, it needs to spring back to it's original location, rather quickly. Of course I could have it go there instantly but I think it would look better animated. So, I came up with this. -145 being the orriginal x position
repeat (-145 minus x position)
change x by 1
end repeat
That worked fine except for one thing: It was horribly slow.
So then I did this
repeat (-145 minus x position divided by 15)
change x by 15
end repeat
That would have worked but of course, unless they drag it back a multiple of 15, it will miss it's original location.
Any ideas? Thanks, Pip
Offline
{repeat (round( ( (-145 - x position) / 15) -0.5 ) )
[change x by 15]
end repeat}
[change x by ( (-145 - x position) mod 15)]
Hope that helps
Last edited by SeptimusHeap (2010-08-27 17:01:36)
Offline
That was what I was thinking, Jwosty!
Offline