Jump to content

Photo

[Request] Pieces...


  • Please log in to reply
7 replies to this topic

#1 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 14 December 2009 - 07:59 PM

I had an idea recently, but one issue I think I'll be facing is keeping the boss I want to write together. My idea is to have it's arms made of several pieces, which need to stick together, no doubt. They are allowed to rotate however they want as long as they stay 'attached' to another FFC. The first piece, I guess, could be linked to a dummy FFC or a specific position.

Another part of this idea is that I need the arms to 'reach out' to Link. If you've played Life Force and seen the weird hand things that reach out to the player in the first level, that's exactly what I'm looking for.

Any help would be greatly appreciated. icon_smile.gif

#2 Silver

Silver

    If only scripting were that easy...

  • Members
  • Real Name:Silva
  • Location:Somewhere on this plane.

Posted 15 December 2009 - 09:23 PM

I can't script for squat, but this caught my eye-your description was similar to this at 2:50...at least to me. Is that what you want?

#3 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 16 December 2009 - 12:00 PM

Not quite. Something like this video at 0:33. Is more what I'm looking for. Though that is a cool looking boss-fight that I may look upon in the future, so thanks for that. icon_smile.gif

#4 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 16 December 2009 - 01:58 PM

How many segments do you want?

#5 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 16 December 2009 - 02:05 PM

I'd say 5 would do it fine.

#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 16 December 2009 - 02:55 PM

I think this might behave exactly like the video. (movement not included)

You could have 32 ffcs making up the segments if you wanted (not sure how that would look though...)


CODE

// D0 - first ffc to attach to
// D1 - second ffc to attach to

ffc script ArmSegment
{
    void run( int ffcnum1, int ffcnum2 )
    {
        ffc p1 = Screen->LoadFFC( ffcnum1 );
        ffc p2 = Screen->LoadFFC( ffcnum2 );
        while( true )
        {
            Waitframe();
            attach_midpoint( this, p1, p2 );
        }
    }
    void attach_midpoint( ffc t, ffc p1, ffc p2 )
    {
        t->X = ( p1->X + p2->X ) / 2;
        t->Y = ( p1->Y + p2->Y ) / 2;
    }
}


// D0 - ffc number of shoulder joint
// D1 - radius can extend

ffc script Hand
{
    void run( int center, int dist )
    {
        ffc joint = Screen->LoadFFC( center );
        while( true )
        {
            Waitframe();
            clamp_dist( this, joint, dist );

            // movement code here

        }
    }
    void clamp_dist( ffc t, ffc anchor, float dist )
    {
        if( Distance( t->X, t->Y, anchor->X, anchor->Y ) > dist )
        {
            float a = Angle( t->X, t->Y, anchor->X, anchor->Y );
            t->X = anchor->X + Cos( a ) * dist;
            t->Y = anchor->Y + Sin( a ) * dist;
        }
    }
}



I also have a feeling I missed something...usually I get that feeling when I cut corners. hmm... I can't put my finger on it though, so, it might work! icon_smile.gif

Edited by Gleeok, 16 December 2009 - 03:26 PM.


#7 Joe123

Joe123

    Retired

  • Members

Posted 16 December 2009 - 03:18 PM

CODE
            t->X = Cos( a ) * dist;
            t->Y = Sin( a ) * dist;

Don't you want +centrex and +centrey in there?

#8 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 17 December 2009 - 12:34 PM

Works perfectly. icon_smile.gif Thank you very much! icon_biggrin.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users