Entities' positions in the background are off


(John Andersson) #1

I have a background layer and I have some entities that move there. They are however not moving the same as the BG layer. The scrollx and y properties of the entities and the BG layer is the same, but they move a few pixels off. So depending on where the camera is, the entity might be a bit off the ground, or below it.

The entity still looks like it is in the BG, since it ALMOST moves perfectly, but it’s just a bit off?


(John Andersson) #2

Anyone? I could really use some help :stuck_out_tongue:


(Darrin) #3

John,

Some code and maybe a pic might help. It is really hard to just tell from the description.

Darrin


(B6ka) #4

I use a parallax scrolling with some background entities in one of my games, and it works fine. Are you sure that you set the same values for scrollX and scrollY in the background tiles and background entities?


(Martí Angelats i Ribera) #5

We need some code to help you. You may be doing something wrong, but we can’t tell you what without seeing it (obviously) :stuck_out_tongue:


(John Andersson) #6

stupidity got a hold of me

here is the code :stuck_out_tongue:

Gameworld:

		addGraphic(_map_BG_2, 3, 0, -41);
		_map_BG_2.scrollY = 0.2;
		_map_BG_2.scrollX = 0.2;

so the scrolly and scrollx = 0.2

now the entity in the background:

		spritemap.scrollX = 0.2;
		spritemap.scrollY = 0.2;

Note that I use pixel graphics, and the entire screen is enlarged

this might have something to do with it?`