![]() |
'Power' parameter in the shoot command
I am attempting to create a projectile using the 'zangle' and 'power' parameters of the 'shoot' command, something like the bows on Graal Kingdoms. My problem is that I cannot find out the equation for 'power' based on the distance you want the projectile to be launched. I'm using a zangle of pi/4.
Any help would be much appreciated. (Please do not simply say "search the forums", as I have done so, but every conversation I've seen about the zangle in the shoot command has ended abruptly before 'power' was touched.) Thanks, Okiesmokie |
Use a loop to test increasing powers simulating shoot, until you have found one that works for the distance.
|
Quote:
just calculate the projectile physics, like i did v = dt d=1/2at^2 + vit simultaneous equations, or whatever it's called, the time is the same in both equations (well, the time is double in the v=dt equation) the information about projectile movement can be found in newfeatures.txt i used a constant zangle of 45 degrees i could just post you the entire script but that might be against the rules? |
Quote:
Quote:
Quote:
Quote:
|
Quote:
Quote:
i didn't simplify any of the stuff that could be simplified NPC Code:this.power = ( ( this.dist * -0.1 ) / ( 2 * cos(this.zangle) * -1 * sin(this.zangle) ) ) ^ 0.5; you will probably want to offset your destination x y by -1.5 or something, since projectiles have a width/height of 48x48 otherwise the top left corner will land at the coordinates you used (i think) here is the information I used, by the way, taken from newfeatures (actually someone pasted it into the #gscript channel) Quote:
Quote:
|
Thank you very much, your solution worked perfectly :)
The thing that threw me off was the 'speed' in newfeatures, I didn't know that meant power x_x |
Quote:
pi/4 is the radian equivalent of 45 degrees. The rest is just basic physics calculations. I haven't played with the shoot command much, but if it follows basic physics principles then all the equations stated should work out. |
| All times are GMT +2. The time now is 04:54 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.