How setZIndex of sprite on HUD of Camera ?

  ... tutorials on how to use AndEngine.

How setZIndex of sprite on HUD of Camera ?

Postby anhvtex » Wed Mar 07, 2012 9:50 am

Hi everyone,

I'm starting work games on Andengine. I have the scene that the fish system are moving and the gear could catch them. When the gear is under water, it will be placed below than fish, and when is above, it will be placed above than fish. So I could use the method setZindex to fix this. But if the camera zoom the scene then the gear will be resized too. This is that I don't want. The gear always have unique size in every case. I tried to give the gear into the HUD object. But meanwhile, it always place above than the fish.

Could anyone help me this,

Any idea I'm appreciated.

Thanks,
anhvtex
 
Posts: 2
Joined: Tue Feb 28, 2012 9:11 am

Re: How setZIndex of sprite on HUD of Camera ?

Postby kblood » Wed Mar 07, 2012 5:45 pm

I think you can only z-index HUD sprites among other HUD sprites. I had a similar problem recently.

So I guess you might have to resize it to negate the zooming effect, and make sure that it follows the camera with some math as well.
kblood
 
Posts: 333
Joined: Wed May 25, 2011 10:13 pm

Re: How setZIndex of sprite on HUD of Camera ?

Postby anhvtex » Wed Mar 07, 2012 6:07 pm

Thank you for your ideas,
Could you show the example that you fixed your issues such as negative them than zooming effects

Thanks,
anhvtex
 
Posts: 2
Joined: Tue Feb 28, 2012 9:11 am

Re: How setZIndex of sprite on HUD of Camera ?

Postby kblood » Wed Mar 07, 2012 10:34 pm

The problem I had did not include zooming, but here it is:

http://dionysus.dk/devstuff/downloads/scrollmenu.java

Its the java file. I made the title image and the background image follow the camera, so its a kind of HUD, without using the HUD itself. But I do not know how to keep the image from resizing when the camera zooms, except by trying to make it smaller or bigger when you are zooming in and out.

So I am not sure what the exact math would be to make sure you would not notice that it was not part of the background when zooming. I am pretty sure there is a zoom factor when you zoom in, and you should be able to use that to make sure that your image just does the opposite with that zoom factor.

Here is something about where to find the zoom factor. Hope it helps:
post14688.html
kblood
 
Posts: 333
Joined: Wed May 25, 2011 10:13 pm


Return to Tutorials

Who is online

Users browsing this forum: Google Feedfetcher, ipopza and 33 guests