Add mobile support
All checks were successful
Build & deploy web version / Build WebAssembly & deploy (push) Successful in 1m1s
All checks were successful
Build & deploy web version / Build WebAssembly & deploy (push) Successful in 1m1s
This commit is contained in:
parent
6e4f0428dc
commit
c4f7565d18
1 changed files with 567 additions and 69 deletions
|
|
@ -73,9 +73,9 @@ void createProjectile(vector3D playerPosition, vector3D playerSize, vector2D* pl
|
|||
newProjectile -> position.y = playerPosition.y + playerSize.y / 2;
|
||||
newProjectile -> size = projectileSize;
|
||||
|
||||
intVector2D playerCoord = get2DPoint((vector3D) {newProjectile -> position.x, newProjectile -> position.y, 0});
|
||||
int deltaX = mouse.x - playerCoord.x;
|
||||
int deltaY = playerCoord.y - mouse.y;
|
||||
vector2D playerCoord = get2DPoint((vector3D) {newProjectile -> position.x, newProjectile -> position.y, 0});
|
||||
float deltaX = mouse.x - playerCoord.x;
|
||||
float deltaY = playerCoord.y - mouse.y;
|
||||
float distance = sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
float compensation = 0;
|
||||
if(distance > 0) compensation = projectileVelocity / distance;
|
||||
|
|
|
|||
Loading…
Reference in a new issue