It's very complicated but I'll try to explane.
Each enemy has a x and y position in the world, I use these positions to place the enemy and hp bar in the world by subtracting the players x and y value. (or I should say the worlds x and y because your players sprite doesn't move but the world itself does). By obtaining this position and offsetting it with the players, I can accumulate an area for..
...both the sprite and Hp bar in the open world wherever he and it may be :D
It's a wonderful equation that works out perfectly.
I hope this helps!
And please comment if you have any other questions.
ok i understand that.
you dont have to really answer this but,.. your world has collision right? because mine is the same type of movement (player in middle-ish of screen) and the map moves, but ive been trying to get it to work since- well for a long time, can you explain or show me a bit of code for it? just anything..?
unless your game dosent use this
so are the trees sprites or are they part of the BG?
i was thinking (for mine) that i could put 1 hole BG layer with just one type of tile then put over it in another layer, that way i can make it so it stops the sprite from going through it when touching that one tile.
instead of making a lot of different ones.
idk..
I too had the bg layer collision idea, but there is no command like that, a bg tile collision can be approximated but it doesn't work very well. My trees and objects that are interactible in the world are all sprites. I find this works the best especially for a bg moving world :)
ok well I got my collision up and running, I got jumping and gravity working, I got my TPAD working, so now im moving into spcol, haven't had much luck on it, I heard it was pretty easy though..?