Invalid access to property or key 'zoom' on a base object... i newbye


how i can solve this?

Make sure the path to Camera2D is accessible by get_node() line 6.

Also put the initialization code of cam and others in func _ready() function.

1 Like

how do initialization code?

You are trying to access cam properties before it is ready. Put the cam.zoom.x and other code to the _ready() function.

2 Likes

and how i can do it?

var camzoomx
var camzoomy
var remshift

func _ready():
	camzoomx = cam.zoom.x
	camzoomy = cam.zoom.y
	remshift = rem.position.x

ok, but how share this between classes, that not calling each other?

That’s a different issue, not related to the original problem of this thread.
Anyway, you can use autoload scripts to hold variables that would be accessible from anywhere in your project.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.