Okay, I want to shoot, but I hate TGF's shooting engine, what are my options? I want to fire at the curser, and I want it to be destroyed as soon as it hits something before or after it reaches the curser. I want it to pass through the exact center of the curser. I would prefer an invisable bullet, but it doesn't matter. Also, I want instant hits.
Keep in mind that I can use fastloop, and drawline. The only idea I can think of envolves sine cosine, and two values with a massive number of decimal points.
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
Direction calculator might help here, or trigonometry, then you can make the bullets move using coordinates rather than the default shooting + use fastloop I'm using it for my game, but I don't have an example ready, sorry... maybe there's an article around?
Since you're going for an invisible bullet, just do a little trick and make the bullet always head towards the cursor spot. If you're too lazy, just give the bullet a Ball movement and make it Always look at Cursor.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Hardly. The bullet just goes from Point A to Point B, which is usually a straight line.
Point A = Character
Point B = Cursor
Just make sure that the cursor's position is the same by the time the bullet reaches it .
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Okay, muz, you're not cheating, but your idea is too slow. Tell me how I can speed it up without it going through the occational pixel thin wall and I'll do it. Shen, I don't want this charactor to shoot through walls.
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
*5? Wouldn't that imply that *5 is needed, which would imply that the distance travelled is rounded of to the nearest pixel out of 5, which would imply that long range firing would miss the target completely, and still the bullet would be able to travell through a wall 4 pixels thick. Thanx for you help and all, but I need it to fire at a speciffic target, not a speciffic angle. Is there a way of making an object travel constantly towards another object in fastloop? As if I were to say, "look at target, set speed to 10" in fastloop?
What would be ideal, is if I were to create an invisable line from the gun to the target (I already know how to do that) then send and object along the line until it hits something. Then destroy/damage whatever it hit.
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
Okay, I'm gonna try something, but it's gonna take me ages to get right. I'm gonna run it past you guys, incase you spot any bugs, or ways of making it easier. First of all, the computer checks to see if the character is facing closest to up, down, left or right. Now, lets say for example, it's closest to right. The bullet starts off at the gun. Then it goes to the right one pixel, and set the counter to one, and positions virtically to the following formulae
(Y"target"-Y"man")*counter/(X"target"-X"man")-Y"man"
Then add one to the counter, move one to the right, and start again. All in fast loop. There will be a similar formulae for up, left and down. Do you reakon that'd work? I'll do it tomorrow maybe.
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
Okay guys, I know all about sine cosine secent cosecent tangent cotangent etc. Though my formulae doesn't use any trig, because what I want to do isn't a trig equation. It's just linear graphing. I mean, why calculate the direction an angle makes if you don't even know the angle to begin with? Then I'd have to work out the angle. Also with trig and TGF, you know that it isn't 100% accurate due to truncation. Am I making sense to anyone?
Chris, your example had nothing to do with what I wanted. I wanted it to automatically aim at a target. If I wanted to aim and fire using any other method, I would be able to do that anyway. Though thanx for trying.
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.
No, that's stupid. It still gets truncated to the nearest pixil. You can't set something to pixel 143.987. The only thing that indicates where the bullet is, is which pizel it's located at. I could save the co-ordinates, but it would still be a waste of time. Trig is very useful, but not for this. This is not a trig problem. Does anyone understand me?
Copy this to your hard drive. It will be worth alot when I'm famous.
Notice: Spelling mistakes above left in for people who need to correct others to make their life fulfilled.