added money and money counter
This commit is contained in:
BIN
assets/Models/money1.blend
Normal file
BIN
assets/Models/money1.blend
Normal file
Binary file not shown.
50
assets/Models/money1.blend.import
Normal file
50
assets/Models/money1.blend.import
Normal file
@@ -0,0 +1,50 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://txjpkuh4uft6"
|
||||
path="res://.godot/imported/money1.blend-55847a66decb2b901945ba8bde1230b8.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Models/money1.blend"
|
||||
dest_files=["res://.godot/imported/money1.blend-55847a66decb2b901945ba8bde1230b8.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
BIN
assets/Models/money1.blend1
Normal file
BIN
assets/Models/money1.blend1
Normal file
Binary file not shown.
@@ -394,10 +394,10 @@ _data = {
|
||||
[node name="mac10" node_paths=PackedStringArray("flare_light", "anim_player", "barrel_raycast", "casing_ejector", "mag_ejector", "audio_fire", "audio_empty", "audio_reload") instance=ExtResource("1_nb4p5")]
|
||||
script = ExtResource("2_6i1l4")
|
||||
gun_name = "Mac 10"
|
||||
recoil_amount = 0.4
|
||||
recoil_amount = 1.0
|
||||
max_ammo = 30
|
||||
bullet_drop = 0.1
|
||||
random_spread_amt = 0.3
|
||||
random_spread_amt = 0.5
|
||||
fire_pitch_scale_amt = 0.1
|
||||
flare_light = NodePath("mac10/SpotLight3D")
|
||||
bullet = ExtResource("3_pyl20")
|
||||
|
||||
123
assets/money_1.tscn
Normal file
123
assets/money_1.tscn
Normal file
File diff suppressed because one or more lines are too long
@@ -180,7 +180,7 @@ skeleton = NodePath("")
|
||||
transform = Transform3D(-3.23167e-06, 0, -0.892729, 0, 0.892728, 0, 0.892728, 0, -3.23167e-06, 0, -0.000397999, 0)
|
||||
shape = SubResource("ConvexPolygonShape3D_vl0tx")
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
[node name="Area3D" type="Area3D" parent="." groups=["pickup"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
|
||||
|
||||
@@ -35,9 +35,8 @@ collision_layer = 3
|
||||
safe_margin = 0.2
|
||||
script = ExtResource("1_x7wms")
|
||||
SENSITIVITY = 0.008
|
||||
BOB_AMP = 0.085
|
||||
weapon_holder = NodePath("Head/Camera3D/WeaponHolder")
|
||||
weapon_sway_amount = 0.1
|
||||
weapon_rotation_amount = 0.1
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
visible = false
|
||||
|
||||
@@ -424,10 +424,11 @@ _data = {
|
||||
script = ExtResource("2_7rsti")
|
||||
gun_name = "Ye Ol' Revolver"
|
||||
fire_mode = 1
|
||||
fov_zoom_amt = 0.95
|
||||
recoil_amount = 1.0
|
||||
fov_zoom_amt = 0.96
|
||||
recoil_amount = 2.0
|
||||
max_ammo = 6
|
||||
bullet_damage = 5
|
||||
bullet_force_mod = 100
|
||||
bullet_speed = 300
|
||||
bullet_drop = 0.0
|
||||
random_spread_amt = 0.1
|
||||
|
||||
@@ -422,8 +422,8 @@ 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)
|
||||
weapon_sway_amount = 0.05
|
||||
weapon_rotation_amount = 0.05
|
||||
weapon_sway_amount = 0.07
|
||||
weapon_rotation_amount = 0.07
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.387515, 0.144211, -0.910514, 0, 0.987688, 0.156434, 0.921863, 0.0606208, -0.382744, 0, 0, 0)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Label
|
||||
|
||||
@onready var player = $"../../.."
|
||||
@onready var level_control = $"../../../.."
|
||||
|
||||
const ASPECT_RATIO_STD = .5625 #9/16 for standard ratio
|
||||
@export var padding_amount = .05 #multiplied by screen size
|
||||
@@ -17,4 +18,4 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
text = "Stamina: " + str(int((player.remaining_stamina/player.MAX_STAMINA)*100)) + "%"
|
||||
text = "$" + str(int(level_control.money)) + "\nStamina: " + str(int((player.remaining_stamina/player.MAX_STAMINA)*100)) + "%"
|
||||
|
||||
@@ -12,10 +12,11 @@ func _ready():
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func breaking():
|
||||
func breaking(current_velocity):
|
||||
var spawn_broken = broken_object.instantiate()
|
||||
spawn_broken.position = global_position
|
||||
spawn_broken.transform.basis = global_transform.basis
|
||||
spawn_broken.rotation = rotation
|
||||
|
||||
get_tree().get_root().add_child(spawn_broken)
|
||||
queue_free()
|
||||
|
||||
@@ -5,7 +5,7 @@ var bullet_drop
|
||||
var random_spread_amt
|
||||
var bullet_damage
|
||||
var instance_bullethole
|
||||
var gun
|
||||
var bullet_force_mod = 1.0
|
||||
|
||||
@onready var mesh = $gunbullet1
|
||||
@onready var ray = $RayCast3D
|
||||
@@ -49,17 +49,17 @@ func _process(delta):
|
||||
ray.enabled = false
|
||||
|
||||
#bullethole effect
|
||||
#instance_bullethole = gun.bullethole.instantiate()
|
||||
ray.get_collider().add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = ray.get_collision_point()
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal(), Vector3.UP)
|
||||
|
||||
#move rigidbodies
|
||||
if ray.get_collider().is_in_group("scene_rigidbody"):
|
||||
ray.get_collider().linear_velocity += transform.basis * Vector3(0,0,-1 * 5)
|
||||
ray.get_collider().linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
|
||||
if ray.get_collider().is_in_group("breakable"):
|
||||
ray.get_collider().breaking()
|
||||
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
|
||||
ray.get_collider().breaking(current_velocity)
|
||||
|
||||
|
||||
if ray.get_collider().is_in_group("enemy"):
|
||||
|
||||
@@ -8,6 +8,7 @@ extends Node3D
|
||||
var stamina = load("res://assets/stamina_pickup.tscn")
|
||||
var ammo = load("res://assets/ammo_pickup.tscn")
|
||||
var jump = load("res://assets/jump_pickup.tscn")
|
||||
var money = load("res://assets/money_1.tscn")
|
||||
|
||||
@onready var timer = $Timer
|
||||
@onready var cannonparticles = $cannonparticles
|
||||
@@ -34,7 +35,7 @@ func _process(delta):
|
||||
func _on_timer_timeout():
|
||||
# Random Variables
|
||||
var lv_y = rng.randf_range(CANNON_MIN_POWER,CANNON_MAX_POWER)
|
||||
var rand_selector = int(round(rng.randf_range(1,2)))
|
||||
var rand_selector = int(round(rng.randf_range(1,3)))
|
||||
var rand_timer = rng.randf_range(TIMER_MIN,TIMER_MAX)
|
||||
|
||||
match rand_selector:
|
||||
@@ -43,7 +44,7 @@ func _on_timer_timeout():
|
||||
2:
|
||||
rand_select = ammo
|
||||
3:
|
||||
rand_select = jump
|
||||
rand_select = money
|
||||
|
||||
# Reset Timer
|
||||
timer.wait_time = rand_timer #rand_timer
|
||||
|
||||
@@ -14,7 +14,7 @@ var cycle_count
|
||||
@export var max_ammo = 15
|
||||
@export var start_mags = 3
|
||||
@export var bullet_damage = 1
|
||||
@export var kick_amount = 1
|
||||
@export var bullet_force_mod = 5.0
|
||||
@export var bullet_speed = 150
|
||||
@export var bullet_drop = .3
|
||||
@export var random_spread_amt = 1.0
|
||||
@@ -75,11 +75,11 @@ func reload_finished():
|
||||
if level_control.ammo_reserve[gun_index] >= max_ammo:
|
||||
level_control.ammo_current[gun_index] += max_ammo
|
||||
level_control.ammo_reserve[gun_index] -= max_ammo
|
||||
player.reloading = false
|
||||
#player.reloading = false
|
||||
else:
|
||||
level_control.ammo_current[gun_index] += level_control.ammo_reserve[gun_index]
|
||||
level_control.ammo_reserve[gun_index] -= level_control.ammo_reserve[gun_index]
|
||||
player.reloading = false
|
||||
#player.reloading = false
|
||||
|
||||
func shoot(player,delta):
|
||||
|
||||
@@ -103,8 +103,8 @@ func shoot(player,delta):
|
||||
instance_bullet.bullet_drop = bullet_drop
|
||||
instance_bullet.random_spread_amt = random_spread_amt
|
||||
instance_bullet.bullet_damage = bullet_damage
|
||||
instance_bullet.bullet_force_mod = bullet_force_mod
|
||||
instance_bullet.instance_bullethole = bullethole.instantiate()
|
||||
instance_bullet.gun = self
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
|
||||
# Casing transform
|
||||
@@ -121,8 +121,8 @@ func shoot(player,delta):
|
||||
audio_empty.play()
|
||||
|
||||
func reload(player,delta):
|
||||
if level_control.ammo_current[gun_index] < max_ammo and player.reloading == false and level_control.ammo_reserve[gun_index] > 0:
|
||||
player.reloading = true
|
||||
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
||||
#player.reloading = true
|
||||
anim_player.play("reload")
|
||||
audio_reload.play()
|
||||
if anim_player.is_playing() and anim_player.current_animation == "reload":
|
||||
|
||||
@@ -22,8 +22,8 @@ var start_sensitivity
|
||||
@export var BOB_AMP = 0.08
|
||||
@export var t_bob = 1.0
|
||||
@export var weapon_holder : Node3D
|
||||
@export var weapon_sway_amount : float = 5
|
||||
@export var weapon_rotation_amount : float = 1
|
||||
@export var weapon_sway_amount : float = .1
|
||||
@export var weapon_rotation_amount : float = .1
|
||||
@export_subgroup("FOV")
|
||||
@export var BASE_FOV : float = 80
|
||||
@export var FOV_CHANGE = 1.5
|
||||
@@ -223,6 +223,16 @@ func _on_pick_up_detection_body_entered(body):
|
||||
pickup_sound.pitch_scale = 1 + rng.randf_range(-.3,.3)
|
||||
pickup_sound.play()
|
||||
body.queue_free()
|
||||
elif body.pickupType == "money":
|
||||
pickupmsg = pickup_announce.instantiate()
|
||||
pickupmsg.pickuptext = "$" + str(int(body.rand_amt))
|
||||
get_parent().add_child(pickupmsg)
|
||||
level_control.money += int(body.rand_amt)
|
||||
picked_up = true
|
||||
picked_up_text = "ammo"
|
||||
pickup_sound.pitch_scale = 1 + rng.randf_range(-.3,.3)
|
||||
pickup_sound.play()
|
||||
body.queue_free()
|
||||
elif body.pickupType == "jump":
|
||||
pickupmsg = pickup_announce.instantiate()
|
||||
pickupmsg.pickuptext = "jump"
|
||||
|
||||
@@ -15,6 +15,7 @@ var cycle_count
|
||||
@export var start_mags = 3
|
||||
@export var bullet_damage = 1
|
||||
@export var kick_amount = 1
|
||||
@export var bullet_force_mod = 5
|
||||
@export var bullet_speed = 150
|
||||
@export var bullet_drop = .3
|
||||
@export var random_spread_amt = 1.0
|
||||
@@ -150,16 +151,15 @@ func fire(delta):
|
||||
instance_bullet.bullet_drop = bullet_drop
|
||||
instance_bullet.bullet_damage = bullet_damage
|
||||
instance_bullet.random_spread_amt = random_spread_amt
|
||||
instance_bullet.bullet_force_mod = bullet_force_mod
|
||||
instance_bullet.instance_bullethole = bullethole.instantiate()
|
||||
instance_bullet.gun = self
|
||||
get_tree().get_root().add_child(instance_bullet)
|
||||
player.weapon_recoil()
|
||||
chamber.rotate_object_local(Vector3(0,-1,0),deg_to_rad(60))
|
||||
|
||||
|
||||
func reload(player,delta):
|
||||
if level_control.ammo_current[gun_index] < max_ammo and player.reloading == false and level_control.ammo_reserve[gun_index] > 0:
|
||||
player.reloading = true
|
||||
if level_control.ammo_current[gun_index] < max_ammo and player.gun.anim_player.get_current_animation() != "reload" and level_control.ammo_reserve[gun_index] > 0:
|
||||
anim_player.play("reload")
|
||||
audio_reload.play()
|
||||
for i in bullet_array:
|
||||
|
||||
@@ -16,7 +16,7 @@ const MAX_AV = 10
|
||||
|
||||
var stamina = load("res://assets/stamina_pickup.tscn")
|
||||
var ammo = load("res://assets/ammo_pickup.tscn")
|
||||
var jump = load("res://assets/jump_pickup.tscn")
|
||||
var money = load("res://assets/money_1.tscn")
|
||||
var die_particles = load("res://assets/die_particles.tscn")
|
||||
var particlespawn
|
||||
var rng = RandomNumberGenerator.new()
|
||||
@@ -52,7 +52,7 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
|
||||
#pickup drop
|
||||
while number_of_drops > 0:
|
||||
var rand_selector = int(round(rng.randf_range(1,2)))
|
||||
var rand_selector = int(round(rng.randf_range(1,3)))
|
||||
var lv_x = rng.randf_range(-MAX_LV,MAX_LV)
|
||||
var lv_y = rng.randf_range(0,MAX_LV)
|
||||
var lv_z = rng.randf_range(-MAX_LV,MAX_LV)
|
||||
@@ -66,7 +66,7 @@ func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
2:
|
||||
rand_select = ammo
|
||||
3:
|
||||
rand_select = jump
|
||||
rand_select = money
|
||||
# Random Item Drop
|
||||
rand_item = rand_select.instantiate()
|
||||
rand_item.position = self.global_position
|
||||
|
||||
Reference in New Issue
Block a user