Today I started coding the basic movement of the player. Actually it was really coding it was more just doing some math. If you click somewhere on the field, it will substract the clicks coordinates and the player coordinates. By dividing the y and x-values from that I get the slope of the movement. Then I calculate the angle with Arctan, and finally I get x-coordinate for a corresponding unit cirle with cos. The reason for doing it in this fashion is that the speed of the player will always be the same. When using the unit circle values, the speed is always exactly 1. Then I can just multiply something to that later on :)
TL;DR you can move around
Ingen kommentarer:
Send en kommentar