Question: Bullet flying towards the player, how ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Mynze
Prole
Posts: 3
Joined: Tue Mar 19, 2019 2:56 pm

Question: Bullet flying towards the player, how ?

Post by Mynze »

Hey guys,
im pretty new to löve and my code is always long and sometimes makes no sense, however, I'm currently making a game and mostly done with it, but I've came up across a problem, wich I don't know how to solve. On paper it is clear but I can't code it like that. Hope someone can help me out:

Imagine There comes a bullet from the top of the screen and it targets the players x coordinate and flys towards it, untill the bullet has reached a certain y coordinate, then the bullet looks on the coordinate in wich the player has been when the bullet passed taht certain y coordinate.

A friend of mine said that i should do it with vectors and the bullet targets (as updates) the player.x until it reaches the certain y coordinate, then it stop updating so the vector keeps flying towards that locked point.

Does anyone know how to solve this problem ? (And sorry for my bad english)
Thanks in advance :awesome:
fox77
Prole
Posts: 1
Joined: Sat May 18, 2019 8:09 pm

Re: Question: Bullet flying towards the player, how ?

Post by fox77 »

It depends on how you actually want it to be exactly. Does it have to check only once, i.e. when the bullet is fired, or should it update it's direction when travelling?
Post Reply

Who is online

Users browsing this forum: No registered users and 91 guests