diff --git a/cannonball.tscn b/cannonball.tscn new file mode 100644 index 0000000..e7d372f --- /dev/null +++ b/cannonball.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://4vfvxfpy4wn2"] + +[ext_resource type="PackedScene" uid="uid://bj6bw54a873im" path="res://Assets/Model/Objects/CanonBall.glb" id="1_b7tpd"] + +[node name="CANNONBALL" type="Node3D"] + +[node name="CanonBall" parent="." instance=ExtResource("1_b7tpd")] diff --git a/scripts/Modules/Cannon.gd b/scripts/Modules/Cannon.gd index 82247dc..c6d0773 100644 --- a/scripts/Modules/Cannon.gd +++ b/scripts/Modules/Cannon.gd @@ -55,9 +55,14 @@ func shoot(): currentStashValue -= 1 currentPowderStashValue = 0 currentState = STATE.INACTIVE + var bullet = preload("res://cannonball.tscn").instantiate() + add_child(bullet) + print(bullet.position) + var tween = bullet.create_tween() + tween.tween_property(bullet,"position",Vector3(70,0,0),0.5) + tween.tween_callback(queue_free) $AudioStreamPlayer.play(0) return true - if currentStashValue >= 1 and currentPowderStashValue >= 2 and currentState == STATE.INACTIVE and ammoType == 1: currentState = STATE.SHOOTING currentStashValue -= 1