I have an enemy that is throwing an axe. I've got most of it done, but I want him to throw it at the player. It's got it's own gravity, which works, and it goes in the right direction, I just need to know how to estimate the distance. I figured I would just calculate the distance from the player, then divide that by whatever, then have the axe travel at that speed, but he always whips it like crazy. I took off the calculation, and of cource it goes straight up and down nicely so it's obviously just how I did my calculations.
We need a few more details on how you have your engine set up. Or maybe just some source code.
23rd January, 2009 at 18:54:43 -
Well the rest of the code is fine, there is nothing else contributing to the axe moving on the aXe(HA) axis, other than
when enemy shooting animation is over then
--create axe at enemy
--set axe to direction of enemy
--set axeSpeed to Abs(LongDist( "Advanced Direction Object", X( "beserkerAxe" ), Y( "beserkerAxe" ), X( "player" ), Y( "player" ))/8.) (stupid emotes, the . is there for space)
--bring to front
--set gravity variables
if axe is facing >
--then set X to X+axeSpeed
if axe is facing <
--then set X to X-axeSpeed
Oops, I figured it out, I put the /8 in the wrong bracket. It works now.
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.