Hey. I have this example.
You see, I draw a point in the scene and then move the camera with the keys. I want the point to stay anchored on the map, not on the camera as it’s now.
Any ideas? Thanks!
Hey. I have this example.
You see, I draw a point in the scene and then move the camera with the keys. I want the point to stay anchored on the map, not on the camera as it’s now.
Any ideas? Thanks!
Can you give us some code? Otherwise, by default, added gameObjects do not track the camera.
Simple example:
var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: {
create: create
}
};
var game = new Phaser.Game(config);
function create ()
{
var text = this.add.text(24, 24).setText('##########');
var text = this.add.text(80, 80).setText('T');
this.input.keyboard.on("keydown-A", ()=> {
this.cameras.main.x += 1
})
this.input.keyboard.on("keydown-D", ()=> {
this.cameras.main.x -= 1
})
}
Hey @idd, thanks for your time. I tested moving the camera along the tilemap but this wont work. Yes, the point will be anchored to the map, but because the whole camera moves not because the point follows up the movement of the tilemap.
What I found is that i’d “place a tile” or change the color of a tile. That will do. Still have to find the way but it’s just matter of digging in the API and finding examples.
Another solution that i may implement is creating another scene on top, transparent, with dynamic tiling and work on that instead of my base tilemap that is static. I believe this should be more performant.