cameras.main.startFollow target.x error

New to Phaser, I’m just trying to get the camera to follow my player with cameras.main.startFollow but I keep getting the error ‘can’t read undefined x’ (in phaser js file, startFollow function at var fx = target.x - offsetX). Any help appreciated!

Show your code please.

I solved this problem but have another similar one! My camera won’t move to my player or follow him

The code is based off the ‘creating your first game example’. I’ve tried the setScroll, centreOn etc. functions but nothing changes. Alternatively, I just want my game origin to be the bottom left corner but changing the bounds also hasn’t worked. Thanks

The startFollow(player) is enough; don’t use setScroll() or centerOn() as well.

Temporarily remove the

player.setCollideWorldBounds(true);

and see if you get any camera movement.