I'm new to the forums and new to coding in LUA with löve
I'm making a game and I need some help with the coding
The code I've made is
Where enx & eny is the enemys position and x & y is the players position.enx = enx + (x - enx) * (dt - 0.01)
eny = eny + (y - eny) * (dt - 0.01)
This code is placed in function love.update(dt).
I've coded so that when the player's position is past a certain x value the variable mo becomes smaller and the background moves back, creating the illusion that you are walking forward (when really he is just standing still at the x position given)
This also work the other way around, when he is walking left the mo variable gets bigger.
Now, I want to make so that the enemy's position will be eny + mo but I dont know any good way to make this happen
If I simply write enx + mo the enemy will "fly" further and further away from the player
I can post the .love program if it helps
Thanks
regards, alecal
ps. awesome forum