How to shoot animation from point A to point B
How to shoot animation from point A to point B
I am working on a game. Im kinda stumped atm, having issues on grasping how to shoot a Animation shot from object 1 to object 2 where object 2 is changing slowly moving towards the nearest object 1. i am trying to draw a invisible line from object 1 to object 2 current position and play the animation along that invisible line. Am i even in the right nieghborhood.
Re: How to shoot animation from point A to point B
I know y = m*x + b is the formula to find a straight line between 2 points but i'm not really sure if it would work for sprite movement. Chili explains it in lesson 10.
Though using trigonometry SOH CAH TOA you can get a direction from one point to another and move the shot the exact distance you want in that direction.
In fact I'm going to see if i can write a function that takes in 2 coordinates and finds the angle and distance between them, just for fun.
Though using trigonometry SOH CAH TOA you can get a direction from one point to another and move the shot the exact distance you want in that direction.
In fact I'm going to see if i can write a function that takes in 2 coordinates and finds the angle and distance between them, just for fun.
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: How to shoot animation from point A to point B
Well, i really did try but i can't get it to work. i wrote a function to move one point towards another with a variable speed, it compiled fine but broke when i ran it. Then while debugging, whenever i try to step into the function is tells me the source code is missing and i have no idea why.
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: How to shoot animation from point A to point B
Seems simple enough. Take the x and y distances and divide them by the number of frames you want the animation to last. Then add these values to you position for n frames, after which your object will be at its destination. Make sure you use floats and use logical rounding.
Chili
Re: How to shoot animation from point A to point B
ok, i am going to try and see if i can get this to play from that angle, also one more thing, object a uses animation to simulate rotation bases off of mouse coords, use the same thing for both?
Re: How to shoot animation from point A to point B
Interesting, haven't thought about chili's method before.
ʕ •ᴥ•ʔ