Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Main
- -- Code 12d - tween path
- -- Bruce Elliott
- -- April 2013
- -- Accepts a table of waypoints to follow
- -- Setup multiple destinations or stop points
- -- strt is the starting point
- -- t1 - t5 are waypoints for the path
- -- Then you will find four tweens - only one
- -- at a time should be uncommented. The last tween
- -- takes two lines so comment or uncomment carefully
- -- Use this function to perform your initial setup
- function setup()
- strt = {x = WIDTH, y = HEIGHT, size = 20}
- t1 = {x = 102, y = 100, size = 10}
- t2 = {x = 200, y = 500, size = 50}
- t3 = {x = WIDTH/2, y = HEIGHT/2, size = 100}
- t4 = {x = WIDTH/4, y = HEIGHT/4, size = 10}
- t5 = {x = 300, y = 200, size = 75}
- -- tween.path(20, strt, {strt, t1, t2, t3, t4, t5 ,t1})
- -- tween.path(20, strt, {strt, t1, t2, t3, t4, t5 ,t1, strt})
- tween.path(20, strt, {t1, t2, t3, t4, t5 ,t1, strt})
- -- tween.path(20, strt, {strt, t1, t2, t3, t4, t5 ,t1}
- -- , {loop=tween.loop.forever})
- end
- -- This function gets called once every frame
- function draw()
- -- This sets a dark background color
- background(40, 40, 50)
- noFill()
- -- This sets the line thickness
- strokeWidth(2)
- -- The object moved during the path execution
- -- note that even though strt is the final
- -- waypoint the path never seems to return
- -- there
- -- If strt is the first waypoint the path will
- -- start there but, even with a loop, we never
- -- seem to return there
- ellipse(strt.x, strt.y, strt.size)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement