How To

Vector bullets

1

McStevey 2019-09-16 18:27

I want to learn how to make enemy bullets aim like in low-res Galaxy but I'm a little confused


Timo 2019-09-16 18:33

The idea is to calculate the "normal":
At first you just calculate the the distances for both X and Y between the two objects. This gives you already the vector of the direction, but it's too long. You need to calculate the length of it, and then divide both X and Y by the length. This is the "normal" vector, which can be used to move a sprite step by step.


McStevey 2019-09-16 18:45

Sorry I'm not sure I understand..


Timo 2019-09-16 20:29

I'll try to create an example soon.


McStevey 2019-09-16 20:37

Okay thank you very much:)


Timo 2019-09-18 05:49

Here it is:

https://lowresnx.inutilis.com/topic.php?id=657


McStevey 2019-09-18 11:52

Thank you!


Log in to reply.