Cycle through x,y coordinates using tables

Hi There

I have a table with 2 rows and 360 columns.The rows contain x and y coordinates of an actor the columns are the 360 different positions of that actor.

I want to use a timer to move an actor from the x,y coordinates in column 1 through to column 360. After the actor reaches column 360 it needs to start again at column 1 and continue this loop until a different behavior is triggered.

At the moment I can do is move the actor 1 column with a timer and a change attribute behavior from the x,y in column 1 to
the x,y in column 2.

How do i set up the change attribute behavior to go from column 1 through to column 360 and loop back to column 1?

Is the change attribute behavior the best way to do this task?

Thanks
Alan

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    edited October 2014 Accepted Answer

    Here you go, a 300 pixel x 150 pixel ellipse with its rotation offset by 45°.

    Bear in mind that the X and Y dimensions are absolute, so as you increase or decrease the rotational offset the width and height will remain the same.

    But you might want those dimensions to distort with the rotational offset (as if you were rotating a physical ellipse shape in real life), if you do want to do it that way you just need to adjust the width and height appropriately as it rotates.

    Link: https://www.mediafire.com/?t3gh9l4ocaaziwi

Answers

  • SocksSocks London, UK.Member Posts: 12,822

    @Alanadale said:
    . . . . the 360 different positions of that actor.

    is the actor moving in a circle ?

  • AlanadaleAlanadale Member Posts: 6

    Hi Socks

    Not quite, I know how to move an actor in circle
    Also move in an elliptical orbit by changing the constrain attribute.
    Example the x value = 150cos and the y value = 50sin.

    What I am trying to do is move the actor in an elliptical orbit offset by say 45 degrees from the x and y axis.

    I did not know how to do this in Gamesalad. So using excel I created the 360 x,y coordinates for my ellipse, offset at 45 degrees and imported it as a table to Gamesalad

    Alanadale

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Alanadale said:
    What I am trying to do is move the actor in an elliptical orbit offset by say 45 degrees from the x and y axis.

    I'm not 100% sure what offsetting from the X and Y axis means, do you simply want to tilt the ellipse at an angle, so it's like a wide elliptical orbit, but the whole thing is rotated by 45° ?

    If that's what you are after you just need to offset one axis by 45° . . . so something like this:

    constrain X position to 300 *cos(angle)+X centre

    constrain Y position to 150 *sin(</font color>(angle)+45°)</font color>+Y centre

    Let me make you a quick demo . . .

  • AlanadaleAlanadale Member Posts: 6

    Hi Socks
    Thanks for the demo its what I was trying to do.
    Good work
    Alan

  • SocksSocks London, UK.Member Posts: 12,822

    @Alanadale said:
    Hi Socks
    Thanks for the demo its what I was trying to do.
    Good work
    Alan

    Cool, glad it worked for you.

Sign In or Register to comment.