Hi,
I’ve got a vertical scrolling map where I created a player and i wanted to have it shoot projectiles.
I’m getting the projectile’s start X&Y coordinates with getX()/getY() from my player class which extends libgdx’s Sprite class.
Thing is this passes the world coordinates instead of the screencoordinates from my player to my projectile Class.
Now when i want to draw my projectiles on screen the starting Y coordinate is the players Y-screencoordinate plus the amount the map has already scrolled. Which is not what i want ofc, because now the projectiles starting point moves further and further away from the player with every scoll update.
Do you have a tip how I could handle this problem.
As i’m writing this i’m thinking about creating a variable that keeps track of how much the map already has scrolled and substract this from the Y-worldcoordinate the player is passing to the projectile when shooting. This could be one way to solve my issue.
But maybe there is an easier way??