Reputation: 265
ı 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);
Upvotes: 3
Views: 1867
Reputation: 6895
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);
Upvotes: 8
Reputation: 695
Either tell the button to move when you move the camera. (not recommended) OR Have the button on a layer above the camera view, so it independent of the camera movements.
Upvotes: 0