added the ability to spawn in with only one gun

This commit is contained in:
Derek
2024-07-18 08:20:52 -05:00
parent 6fef7d2a6c
commit dea6c0bfd9
3 changed files with 13 additions and 12 deletions

View File

@@ -1,11 +1,10 @@
[gd_scene load_steps=52 format=3 uid="uid://dyop6vk3rgkkb"]
[gd_scene load_steps=51 format=3 uid="uid://dyop6vk3rgkkb"]
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_orhgl"]
[ext_resource type="Texture2D" uid="uid://dqs06ic3vjtwk" path="res://assets/Models/asphalt1.albedo.jpg" id="1_w4rag"]
[ext_resource type="PackedScene" uid="uid://brl0bsqjl5dg3" path="res://assets/mac_10.tscn" id="2_6rjit"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="2_f87c2"]
[ext_resource type="PackedScene" uid="uid://d1j6ktsmxfq6e" path="res://assets/spider.tscn" id="3_cvvjo"]
[ext_resource type="PackedScene" uid="uid://dslxb3psx30vp" path="res://assets/pistol1.tscn" id="3_gjst3"]
[ext_resource type="PackedScene" uid="uid://20csd6dmwj4y" path="res://assets/jump_platform.tscn" id="4_8nxyr"]
[ext_resource type="PackedScene" uid="uid://dws2vwfxubqvb" path="res://assets/cannon.tscn" id="5_28rul"]
[ext_resource type="PackedScene" uid="uid://bpkmyd3wvqi5p" path="res://assets/boombox.tscn" id="6_xrg7k"]
@@ -416,11 +415,9 @@ size = Vector3(16.265, 5.07275, 15.3267)
script = ExtResource("1_orhgl")
player = NodePath("Player")
gun_1 = ExtResource("2_6rjit")
gun_2 = ExtResource("3_gjst3")
[node name="Player" parent="." instance=ExtResource("2_f87c2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.0295, 1.4435, 21.1166)
WALK_SPEED = 6.0
weapon_sway_amount = 0.07
weapon_rotation_amount = 0.07

File diff suppressed because one or more lines are too long

View File

@@ -6,21 +6,25 @@ extends Node3D
@export var gun_1 : Resource
@export var gun_2 : Resource
var held_guns = []
var ammo_current = [0,0]
var ammo_reserve = [0,0]
var ammo_current = [0]
var ammo_reserve = [0]
var guns_dict = {}
var current_gun_index
# Called when the node enters the scene tree for the first time.
func _ready():
#Set up starting guns and ammo
held_guns = [gun_1,gun_2]
held_guns = [gun_1]
var instance_gun = held_guns[0].instantiate()
var instance_gun_2 = held_guns[1].instantiate()
ammo_current[1] = instance_gun_2.max_ammo
ammo_reserve[1] = instance_gun_2.max_ammo * instance_gun_2.start_mags
ammo_current[0] = instance_gun.max_ammo
ammo_reserve[0] = instance_gun.max_ammo * instance_gun.start_mags
if gun_2 != null:
held_guns.append(gun_2)
var instance_gun_2 = held_guns[1].instantiate()
ammo_current.append(instance_gun_2.max_ammo)
ammo_reserve.append(instance_gun_2.max_ammo * instance_gun_2.start_mags)
# Spawn first gun
current_gun_index = 0
gun_spawn(0)