Tree puncher Help

extends Node

export(PackedScene) var trunk_scene

onready var First_Trunk_position = $First_Trunk_Position
onready var ko = $KO
onready var time_left = $TimeLeft
onready var lumber_jack = $Lumber_Jack
onready var timer = $Timer

var last_spawn_position
var last_has_accorn = false
var last_accorn_right = false
var dead = false

var trunks =

func _ready():
last_spawn_position = First_Trunk_position.position
spawn_first_trunks()

func _process(delta):
if dead:
return
time_left.value -= delta
if time_left.value <= 0:
die()

func spawn_first_trunks():
for counter in range (5):
var New_Trunk = trunk_scene.instance()
add_child(New_Trunk)
New_Trunk.position = last_spawn_position
last_spawn_position.y -= New_Trunk.sprite_hight
New_Trunk.initialize_trunk(false, false)
trunks.append(New_Trunk)

func add_trunk(accorn, accorn_right):
var New_Trunk = trunk_scene.instance()
add_child(New_Trunk)
New_Trunk.position = last_spawn_position
New_Trunk.initialize_trunk(accorn, accorn_right)
trunks.append(New_Trunk)

func punch_tree(from_right):
if !last_has_accorn:
if rand_range(0,100) > 50:
last_accorn_right = rand_range(0, 100) > 50
last_has_accorn = true
else:
last_has_accorn = false
else:
if rand_range(0, 100) > 50:
last_has_accorn = true
else:
last_has_accorn = false
add_trunk(last_has_accorn, last_accorn_right)

trunks[0].remove(from_right)
trunks.pop_front()
for trunk in trunks:
	trunk.position.y += trunk.sprite_hight

func die():
ko.position.x = lumber_jack.positon.x
lumber_jack.queue_free()
timer.start()
ko.visible = true
dead = true

func _on_Timer_timeout():
get_tree().reload_current_scene()

So I know this may not be the right place to post this but I am having trouble with a udemy tutorial on the tree puncher project. I would really apppriciate some help on this as I know there are some great script writers here. Someone said that this godot series had not started yet but I have gotten help here before with my Blender projects and I know that this is a very helpful community. I am a better artist than a coder. I wish I could just learn how to understand the error codes. Trying to learn to make games and cartoons on my own. Started with Blender but want to use my assets on a gaming engine. Took to Godot better than unity. The interface is simular to Blenders. Anyways Thanks for any help you can offer.

So I cant beleave I missed it but I just misspelled position. Duh

Privacy & Terms