Bullet Shoot Problem!

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Manner
Prole
Posts: 3
Joined: Tue Jun 12, 2012 5:28 pm

Bullet Shoot Problem!

Post by Manner »

Hey,
i want to make a game where the player controls a tank from a top down perspective and he can move Up, Down, Left and Right. Now i want to make him shoot
and i followed the tutorial over here: http://www.yellow.indieis.me/2012/05/04 ... ng-things/
But now i have the problem that if i get closer to player.x = 0 and player.y = 0 the bullets get shoot in the oposit direction of my mouse. I think its because of this line of code

Code: Select all

local direction = math.atan2(love.mouse.getY() - player.y, love.mouse.getX() - player.x)
but how can i fix it?

EDIT: I fixed it. I only had to change player.x and player.y to constants
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 58 guests