Add shot and reload actions

This commit is contained in:
2025-01-16 17:42:44 +01:00
parent 7b0de72911
commit 7ec7cf189c
8 changed files with 86 additions and 7 deletions

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://b50vg1umdgjas"]
[ext_resource type="PackedScene" uid="uid://dumj5qqh2h2tg" path="res://assets/models/weapon/DEAGLE/DEAGLE.glb" id="1_5xic7"]
[node name="DEAGLE" instance=ExtResource("1_5xic7")]

21
scenes/weapon/pistol.gd Normal file
View File

@ -0,0 +1,21 @@
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# TODO: Handle the shot logic
func shot():
var pistol := $DEAGLE
pistol.rotate_z(20.0)
# TODO: Handle the reload logic
func reload():
var pistol := $DEAGLE
pistol.rotate_z(-20.0)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://d21giy40pnjhe"]
[ext_resource type="PackedScene" uid="uid://dumj5qqh2h2tg" path="res://assets/models/weapon/DEAGLE/DEAGLE.glb" id="1_ard7n"]
[ext_resource type="Script" path="res://scenes/weapon/pistol.gd" id="1_jgbvq"]
[node name="Pistol" type="Node3D"]
script = ExtResource("1_jgbvq")
[node name="DEAGLE" parent="." instance=ExtResource("1_ard7n")]