I think having a grappling hook in some games would be cool. I have not scripted it yet but I made a Pendulum Simulation that seems like a step in the right direction. I just wanted to log my progress.
update.c:
if your interested you can download a demo with this in action: https://www.mediafire.com/file/rwzhyd1jq35ng41/Pendulum_Simulation.zip/file
update.c:
Code:
void main()
{//Pendulum Simulation in Openbor
float len = 100; // lengh of the rope
float originX = 160; // X of the top of the rope
float originY = 0; // Y of the top of the rope
float bobX; //X end of the rope
float bobY; //Y end of the rope
float angle; //angle of rope
float angleV; //angle velocity
float angleA; //angle acceleration
//set inital values
if (angleA==NULL()){angleA=0.000000;}
if (angleV==NULL()){angleV=0.00000;}
if (angle==NULL()){angle=80.00000;}
//work out where end of the rope should be and draw a line to it
bobX = originX + len * sin(angle);
bobY = originY + len * cos(angle);
drawline(originX,originY,bobX,bobY,999,1);
//set the gravity, acceleration and dampening to movement
angleA = -0.05 * sin(angle);
angle += angleV;
angleV += angleA;
angleV *= 0.997;
}
if your interested you can download a demo with this in action: https://www.mediafire.com/file/rwzhyd1jq35ng41/Pendulum_Simulation.zip/file