Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chase camera with sprite in andengine

ı have created a race game and the camera follow the car with code below.Besides there is a sprite in scene which is in (100px,100px) as button.the problem is: When camera moves, the button never move.The button must always show on screen.But it don't move.What can I do?

mCamera.setChaseEntity(sprite);
like image 257
user1391058 Avatar asked Jan 26 '26 07:01

user1391058


1 Answers

Use HUD. It is a special Scene that does not move when the Camera moves and it was created for exactly this purpose. The basic usage looks something like this:

private HUD mHUD;
mHUD = new HUD();
camera.setHUD(mHUD);
mHUD.attachChild(button);
like image 101
JohnEye Avatar answered Jan 28 '26 21:01

JohnEye