User Tag List

Results 1 to 3 of 3

Thread: Orbit Change

  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,611
    Level
    24
    vBActivity - Bars
    Lv. Percent
    99.9%

    Orbit Change

    I'm seeking some help on how I'd use ZScript to change the orbit of a spinning body. Essentially, I'm looking to re-create the ball-and-chain spinning enemies from LttP. This would consist of a minimum of 2 FFCs: the Knight and his Mace. It could have three or for more FFCs to act as the chain, but they can be added easily once the underlying function is defined.

    The orbit is no problem. I came up with some functions based on the cartesian definition of a circle (x^2 + y^2 = radius), and DarkDragon's demo has a much more elegant orbit algorithim using the sin function. Same with following Link; I came up with a nested if situation involving comparing Link's position to the FFC, and his more elegantly uses the distance formula.

    The problem is what happens when the Knight strikes out at Link. The FFC can't just zip straight to Link's position; it has to swing outwards in a natural looking attack influenced by it's orbit.

    I have a few ideas on how to do this, but I havn't done trig in so long that I'm convinced some of you can make the algorithim more efficent. My suggestion would be to trigger an attack every five or six spins of the mace. Once the attack is triggered, the mace continues to orbit, but the tangent line to it's orbit is calculated each tic. Once Link is sufficently close to the tangent line extending in the same direction as the Mace's movement, his position at that tic is grabbed. Then, the mace's orbit is modified by moving it closer to link's grabbed position for a few tics, then back to the orbit. Then the trigger is cleared and the mace waits for another attack. Essentially, this would result in the mace continuing it's orbit but swinging out towards Link's position every few revolutions.

    Any ideas to tighten this up?

  2. #2
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.71%

    Re: Orbit Change

    The FFC can't just zip straight to Link's position
    But that's what they do in every game they appear in!!

    (Ball and Chain Troopers appear in Link's Awakening and all of the Capcom Zeldas.)

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

    Re: Orbit Change

    The ball-and-chain knights dont. Their mace has to fly out as if they swung it.

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