User Tag List

Results 1 to 2 of 2

Thread: Movement in a Figure-8

  1. #1
    Wizrobe C-Dawg's Avatar
    Join Date
    Jan 2002
    Posts
    4,205
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,612
    Level
    24
    vBActivity - Bars
    Lv. Percent
    100%

    Movement in a Figure-8

    Heya Saffith.

    I'd wondered about a mathematics of movement guide awhile ago. Still wondering about that. I'd like an FFC to fly arond in a figure-8. I'll do some research on how to set this up, but I suspect that you already know how to do this more efficently that I'll figure.

  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,433
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.17%

    Re: Movement in a Figure-8

    Ah, yeah. I haven't forgotten that post, I'm just taking forever to respond.

    A figure eight's not too hard. If you think about it, it's really the same as movement in an ellipse, except it's twice as fast along one axis. This is pretty much it:
    Code:
    for(int i=0; true; i=(i+1)%360)
    {
    	this->X=xCenter+xRadius*Sin(2*i);
    	this->Y=yCenter+yRadius*Cos(i);
    	Waitframe();
    }
    That's vertical; put the 2*i in the cosine instead of the sine for horizontal. Also, that'll start at the bottom. If you add to i, it'll start elsewhere. So, for example, Sin(2*(i+90)) and Cos(i+90) will start at the center. If you want to adjust the speed, just multiply the numbers passed to Sin and Cos. You may have to change the 360 in that case, though.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social