Haha, it's okay. But there really aren't "physics" to it. Plus I like trying to explain things so I'll try for you (and anyone else) line by line;
- Code: Select all
int num = distance(player.x, player.y, mouse.x, mouse.y)/6;
This makes the variable num = the number of chains we need to get from point a to point b. It's the distance/6 because a chain is 6 pixels long.
- Code: Select all
int i;
makes the variable i for the loop
- Code: Select all
angle = direction(player.x, player.y, mouse.x, mouse.y);
gets the angle that the player will be heading
- Code: Select all
if(!hooks)
If we don't have any hooks (so you cannot just keep shooting)
- Code: Select all
breaks = 0;
player.angle = angle;
player.directional_velocity = 6;
all this together because its simple. We reset the breaks variable in case it was triggered last shot, set the player's angle, and make him go
- Code: Select all
for(i=0;i<num;i++)
a loop for the number of chains
- Code: Select all
Actor * this = CreateActor("hook", "chain_01", "(none)", "(none)", player.x, player.y, true);
make the chain at the player's and y and make it called "this" temporarily
- Code: Select all
this->angle = angle;
set the chains angle
- Code: Select all
this->directional_velocity = 7.5 * i;
make it as fast as it's number. In other words were making it 7.5 pixels away from the last created chain (7.5 so theres a little gap between chains for visual)
- Code: Select all
this->animpos = angle/10;
set the chain's animation position
then when the chain is drawn we stop it from moving in the draw actor script and when there are no more hooks the player has gravity in his draw actor
sorry hblade I know some of that is obvious to you since you've used GE before, but others might not understand. I never saw sgt. sparkys though, his was probably better since mine doesn't have a distance limit and you can sometimes go through the ground a little if shot at the right angle. It would just make it more confusing for an example if I did all that though
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.