Open octopuddle opened 3 months ago
There are a couple of issues.
Firstly, the code snippet
func _ready(): var player_nodes: Array = get_tree().get_nodes_in_group("player") if not player_nodes.is_empty(): target = player_nodes[0
target isn't declared anywhere, instead on page 218 it is declared as
target
var player: Player
In the code download it is in the script as
var target: Node2D
Secondly, also in the above snippet, Player is unrecognised, as the player.gd script only contains
Player
extends CharacterBody2D
and not
class_name Player extends CharacterBody2D
The former is in the chapter 9 code download, and the latter appears in the chapter 10 code download.
There are a couple of issues.
Firstly, the code snippet
func _ready(): var player_nodes: Array = get_tree().get_nodes_in_group("player") if not player_nodes.is_empty(): target = player_nodes[0
target
isn't declared anywhere, instead on page 218 it is declared asvar player: Player
In the code download it is in the script as
var target: Node2D
Secondly, also in the above snippet,
Player
is unrecognised, as the player.gd script only containsextends CharacterBody2D
and not
class_name Player extends CharacterBody2D
The former is in the chapter 9 code download, and the latter appears in the chapter 10 code download.