Thursday, April 25, 2013

Slingshot Mechanic Prototyped!

Whoo! So the second of our major mechanics has an initial prototype. It still needs a lot of work, but its getting there!

//------------------------------------------------------------------------------------------------------------
state Slinging
{
    local vector slingVelocity;
   
    function PlayerMove(float DeltaTime)
    {   
        // Move pawn to the current tether position.
        Pawn.Velocity = -30 * slingVelocity;
       
        UpdateRotation( DeltaTime );
    }
   
    event BeginState(Name PreviousStateName)
    {
        slingVelocity = HTPawn(Pawn).Location - HTPawn(Pawn).MovementBoundsPosition;
    }
}


I know, you are saying, really Kersti? It took you that long to write this snippet of code? Jeeze you suck. This is just the snippet of code that defines what is happening. Easy peasy. The real challenge was in making this snippet work with the rest of the code. All the rest of my coding effort for this problem was in a million little places everywhere else in the script that needed some new variable, some new function. Also, I had to rework the way the states worked a little bit, but they work better now!

Anyway. From here on out for the slingshot mechanic, most of what I will need to do will be expanding this little snippet into a larger snippet.  All the programming structure is in, now I just have to finesse it, make it more involved.

But before I do that, I am going to go back and fix up the Moveable Golem mechanic a bit. Also, going to implement a feedback particle for consecutive tether switching.

No comments:

Post a Comment