refactor UI, pathfinding working, added kabuto

This commit is contained in:
Amazed 2021-10-18 23:49:38 +02:00
parent 10049e114e
commit af2cb1caa0
97 changed files with 1012 additions and 514 deletions

View File

@ -12,6 +12,7 @@ fog_enabled = true
fog_depth_begin = 100.0 fog_depth_begin = 100.0
fog_depth_end = 5000.0 fog_depth_end = 5000.0
ss_reflections_enabled = true ss_reflections_enabled = true
ssao_enabled = true
dof_blur_far_distance = 200.0 dof_blur_far_distance = 200.0
glow_intensity = 1.0 glow_intensity = 1.0
glow_blend_mode = 1 glow_blend_mode = 1

46
characters/kabuto.gd Normal file
View File

@ -0,0 +1,46 @@
extends Character
class_name Kabuto
export var max_sprint_units: float = 1000
export var sprint_reload_units: float = 2000
var sprint_units_left: float = 0
var sprint_reload_units_left: float = 0
signal sprint_available
signal sprint_ended
signal sprint_used
func echo_signal(s):
print("Kabuto: %s" % s)
func _ready():
connect("sprint_available", self, "echo_signal", ["sprint_available"])
connect("sprint_used", self, "echo_signal", ["sprint_used"])
connect("sprint_ended", self, "echo_signal", ["sprint_ended"])
func is_sprinting() -> bool:
return sprint_units_left > 0
func sprint_available() -> bool:
return not is_sprinting() and sprint_reload_units_left <= 0
func start_sprint():
if sprint_available():
sprint_units_left = max_sprint_units
sprint_reload_units_left = sprint_reload_units
emit_signal("sprint_used")
func walk(delta):
.walk(delta)
return
var floor_vel = get_floor_velocity()
if is_on_floor() and sprint_units_left > 0:
sprint_units_left -= floor_vel.length()
if sprint_units_left <= 0:
emit_signal("sprint_ended")
if is_on_floor() and sprint_reload_units_left > 0:
sprint_reload_units_left -= floor_vel.length()
if sprint_reload_units_left <= 0:
emit_signal("sprint_available")

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=16 format=2] [gd_scene load_steps=16 format=2]
[ext_resource path="res://entities/character.gd" type="Script" id=1] [ext_resource path="res://characters/kabuto.gd" type="Script" id=1]
[ext_resource path="res://characters/latest_kabuto/kabuto.tscn" type="PackedScene" id=2] [ext_resource path="res://characters/latest_kabuto/kabuto.tscn" type="PackedScene" id=2]
[ext_resource path="res://characters/latest_kabuto/k_right_armmat.material" type="Material" id=3] [ext_resource path="res://characters/latest_kabuto/k_right_armmat.material" type="Material" id=3]
[ext_resource path="res://characters/latest_kabuto/k_nailmat.material" type="Material" id=4] [ext_resource path="res://characters/latest_kabuto/k_nailmat.material" type="Material" id=4]
@ -247,12 +247,13 @@ height = 0.5
transform = Transform( 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0 ) transform = Transform( 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0 )
collision_layer = 2 collision_layer = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
max_weapons = 0
animation_tree_path = NodePath("kabuto2/AnimationTree") animation_tree_path = NodePath("kabuto2/AnimationTree")
back_camera_path = NodePath("headpivot/SpringArm/Camera") back_camera_path = NodePath("headpivot/SpringArm/Camera")
head_path = NodePath("headpivot") head_path = NodePath("headpivot")
sprint_speed = 100.0 sprint_speed = 100.0
gravity = 200.0 gravity = 200.0
walk_speed = 50.0 walk_speed = 40.0
[node name="kabuto2" parent="." instance=ExtResource( 2 )] [node name="kabuto2" parent="." instance=ExtResource( 2 )]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 ) transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )

BIN
characters/latest_kabuto/T-Pose-loop.anim (Stored with Git LFS)

Binary file not shown.

BIN
characters/latest_kabuto/idle-loop.anim (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
characters/latest_kabuto/jump-loop.anim (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
characters/latest_kabuto/walking-loop.anim (Stored with Git LFS)

Binary file not shown.

BIN
characters/latest_reaper/Idle1-loop.anim (Stored with Git LFS)

Binary file not shown.

View File

@ -118,11 +118,11 @@ visible = false
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 ) transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
[node name="lefthand" type="BoneAttachment" parent="Armature/Skeleton" index="1"] [node name="lefthand" type="BoneAttachment" parent="Armature/Skeleton" index="1"]
transform = Transform( 0.533259, 0.0320889, -0.845343, -0.614146, 0.701903, -0.360771, 0.581773, 0.711548, 0.394004, -1.5385, 5.02043, 1.17579 ) transform = Transform( 0.563706, 0.0202828, -0.825726, -0.591872, 0.70722, -0.386688, 0.576126, 0.706702, 0.41067, -1.42974, 5.01674, 1.23996 )
bone_name = "left_hand_index_4" bone_name = "left_hand_index_4"
[node name="righthand" type="BoneAttachment" parent="Armature/Skeleton" index="2"] [node name="righthand" type="BoneAttachment" parent="Armature/Skeleton" index="2"]
transform = Transform( -0.0728095, -0.680585, -0.729042, 0.215094, -0.724495, 0.654859, -0.973875, -0.109132, 0.199139, 0.824623, 5.05023, -0.526535 ) transform = Transform( -0.0701182, -0.689615, -0.720774, 0.2636, -0.709677, 0.653355, -0.96208, -0.144183, 0.231543, 0.778045, 5.06184, -0.592979 )
bone_name = "right_hand_index_2" bone_name = "right_hand_index_2"
[node name="AnimationPlayer" parent="." index="9"] [node name="AnimationPlayer" parent="." index="9"]

Binary file not shown.

BIN
characters/latest_reaper/T-Pose-loop.anim (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -29,6 +29,7 @@ func _ready():
_weap = pickup_weapon(create_weapon(preload("res://weapons/bow.tscn"))) _weap = pickup_weapon(create_weapon(preload("res://weapons/bow.tscn")))
_weap = pickup_weapon(create_weapon(preload("res://weapons/bow_rpg.tscn"))) _weap = pickup_weapon(create_weapon(preload("res://weapons/bow_rpg.tscn")))
_weap = pickup_weapon(create_weapon(preload("res://weapons/proximitymissile.tscn"))) _weap = pickup_weapon(create_weapon(preload("res://weapons/proximitymissile.tscn")))
_weap = pickup_weapon(create_weapon(preload("res://weapons/handgun.tscn")))
set_weapon_slot(0) set_weapon_slot(0)
connect("jumped", self, "jumped") connect("jumped", self, "jumped")

View File

@ -19,7 +19,6 @@ animation_tree_path = NodePath("ReaperGLTF/AnimationTree")
back_camera_path = NodePath("HeadPivot/SpringArm/BackCamera") back_camera_path = NodePath("HeadPivot/SpringArm/BackCamera")
head_path = NodePath("HeadPivot") head_path = NodePath("HeadPivot")
sprint_speed = 250.0 sprint_speed = 250.0
deacceleration = 6
air_control = 0.05 air_control = 0.05
jump_height = 65 jump_height = 65
gravity = 200.0 gravity = 200.0
@ -33,10 +32,10 @@ shape = SubResource( 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.611, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.611, 0 )
[node name="lefthand" parent="ReaperGLTF/Armature/Skeleton" index="1"] [node name="lefthand" parent="ReaperGLTF/Armature/Skeleton" index="1"]
transform = Transform( 0.52524, 0.121386, -0.842251, -0.658248, 0.685222, -0.311738, 0.539289, 0.718148, 0.439809, -1.57497, 5.07708, 1.16144 ) transform = Transform( 0.528845, 0.104264, -0.84229, -0.658084, 0.677079, -0.329376, 0.535954, 0.728487, 0.426685, -1.56829, 5.06479, 1.12625 )
[node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"] [node name="righthand" parent="ReaperGLTF/Armature/Skeleton" index="2"]
transform = Transform( 0.231562, -0.548807, -0.803236, 0.0602912, -0.815995, 0.574906, -0.970949, -0.181554, -0.155865, 1.19905, 5.04342, 0.0130773 ) transform = Transform( 0.225415, -0.578802, -0.783693, 0.0687161, -0.792948, 0.605402, -0.971836, -0.190319, -0.138969, 1.1485, 5.01285, -0.0293284 )
[node name="AnimationTree" parent="ReaperGLTF" index="10"] [node name="AnimationTree" parent="ReaperGLTF" index="10"]
parameters/movement/blend_position = Vector2( 0, 0 ) parameters/movement/blend_position = Vector2( 0, 0 )

View File

@ -46,7 +46,7 @@ var sprinting := false
const FLOOR_NORMAL := Vector3.UP const FLOOR_NORMAL := Vector3.UP
export var sprint_speed := 16.0 export var sprint_speed := 16.0
export var acceleration := 8 export var acceleration := 8
export var deacceleration := 100 export var deacceleration := 6
export(float, 0.0, 1.0, 0.00001) var air_control := 0.001 export(float, 0.0, 1.0, 0.00001) var air_control := 0.001
export var can_jump = true export var can_jump = true
export var jump_height := 5 export var jump_height := 5
@ -64,6 +64,7 @@ var footstep_sounds = {}
export var max_health = 100 export var max_health = 100
export var health = 100 export var health = 100
var state = States.Alive var state = States.Alive
var shoot_delay: float = 0
func has_weapon(weapon: Weapon) -> bool: func has_weapon(weapon: Weapon) -> bool:
if get_similar_weapon(weapon): if get_similar_weapon(weapon):
@ -80,6 +81,10 @@ func get_similar_weapon(weapon: Weapon) -> Weapon:
func can_pickup_weapon(weapon: Weapon) -> bool: func can_pickup_weapon(weapon: Weapon) -> bool:
return has_weapon(weapon) or len(weapons) < max_weapons return has_weapon(weapon) or len(weapons) < max_weapons
func can_shoot_delay() -> bool:
# returns true if the character has not shot a bullet recently
return shoot_delay <= 0
func pickup_weapon(weapon: Weapon) -> Weapon: func pickup_weapon(weapon: Weapon) -> Weapon:
var similar = get_similar_weapon(weapon) var similar = get_similar_weapon(weapon)
if similar: if similar:
@ -114,10 +119,12 @@ func die():
func set_weapon_slot(slot: int): func set_weapon_slot(slot: int):
if current_weapon: if current_weapon:
current_weapon.visible = false current_weapon.visible = false
current_weapon.disconnect("fired", self, "weapon_fired")
var newweapon = weapons[slot] var newweapon = weapons[slot]
current_weapon = newweapon current_weapon = newweapon
current_weapon.visible = true current_weapon.visible = true
current_weapon.play_switch_sound() current_weapon.play_switch_sound()
current_weapon.connect("fired", self, "weapon_fired")
func play_footstep(): func play_footstep():
if ground_type in footstep_sounds: if ground_type in footstep_sounds:
@ -142,12 +149,19 @@ func create_weapon(weapon_scene: PackedScene):
else: else:
weapon.queue_free() weapon.queue_free()
return null return null
func get_next_weapon_slot():
var current = get_current_weapon_slot()
if current + 1 < len(weapons):
return current + 1
else:
return 0
func switch_next_weapon_slot(): func switch_next_weapon_slot():
var weapon_slot = 0 var next_slot = get_next_weapon_slot()
if get_current_weapon_slot() != len(weapons) - 1: if next_slot == get_current_weapon_slot():
weapon_slot = get_current_weapon_slot() + 1 return
set_weapon_slot(weapon_slot) set_weapon_slot(next_slot)
func enter_water(force: float): func enter_water(force: float):
is_in_water = true is_in_water = true
@ -162,6 +176,10 @@ func exit_water(force: float):
func _ready(): func _ready():
if animation_tree_path: if animation_tree_path:
animation_tree = get_node(animation_tree_path) animation_tree = get_node(animation_tree_path)
func _process(delta):
if shoot_delay > 0:
shoot_delay -= delta
func _physics_process(delta): func _physics_process(delta):
if Engine.editor_hint: if Engine.editor_hint:
@ -179,7 +197,7 @@ func _physics_process(delta):
animation_blend_vector = res animation_blend_vector = res
func fire_pressed(): func fire_pressed():
if current_weapon: if current_weapon and can_shoot_delay():
current_weapon.activate(Globals.target_position["position"]) current_weapon.activate(Globals.target_position["position"])
func fire_released(): func fire_released():
@ -191,9 +209,12 @@ func jump():
velocity.y = jump_height velocity.y = jump_height
emit_signal("jumped") emit_signal("jumped")
func set_sprint(state: bool): func set_sprint(sprint_state: bool):
if can_sprint: if can_sprint:
sprinting = state sprinting = sprint_state
func weapon_fired():
shoot_delay = current_weapon.repeat_time
func walk(delta: float) -> void: func walk(delta: float) -> void:
# Input # Input

View File

@ -7,6 +7,7 @@ export var bullet_damage: float = 15
export var lifetime: float = 0 export var lifetime: float = 0
export var fx_explode: PackedScene export var fx_explode: PackedScene
var current_fx_explode: Particles var current_fx_explode: Particles
export var max_range: float
export var proximity_collision_area_path: NodePath export var proximity_collision_area_path: NodePath
onready var proximity_collision_area: Area = get_node(proximity_collision_area_path) onready var proximity_collision_area: Area = get_node(proximity_collision_area_path)

View File

@ -1,6 +1,8 @@
extends Spatial extends Spatial
class_name Weapon class_name Weapon
signal fired
enum WeaponType { enum WeaponType {
Activated, Activated,
OneShot OneShot
@ -21,6 +23,8 @@ export var max_ammo: int = 99
export var current_ammo: int = 5 export var current_ammo: int = 5
export var weapon_icon: Texture export var weapon_icon: Texture
var ui_icon: Control = preload("res://ui/rp_weapon_icon.tscn").instance() var ui_icon: Control = preload("res://ui/rp_weapon_icon.tscn").instance()
export var repeat_time: float = 1
export var no_ammo_sound: AudioStreamSample
# Type = Activated # Type = Activated
export var activate_efx: PackedScene = null # preload("res://effects/anim_bow_charging.tscn") export var activate_efx: PackedScene = null # preload("res://effects/anim_bow_charging.tscn")
@ -90,6 +94,7 @@ func play_switch_sound():
Globals.play_sound(switch_sound, Globals.Bus.Sounds, self) Globals.play_sound(switch_sound, Globals.Bus.Sounds, self)
func fire(to: Vector3): func fire(to: Vector3):
emit_signal("fired")
if max_ammo != 0: if max_ammo != 0:
update_ammo(current_ammo-1) update_ammo(current_ammo-1)
# deactivate # deactivate

View File

@ -115,37 +115,31 @@ func _input(event: InputEvent) -> void:
cam.transform = camera_front_transform cam.transform = camera_front_transform
if Input.is_action_just_released("camera_front"): if Input.is_action_just_released("camera_front"):
cam.transform = default_camera_trans cam.transform = default_camera_trans
if Input.is_action_pressed("inp_fire"):
if Input.is_action_just_pressed("inp_fire"):
character.fire_pressed() character.fire_pressed()
if Input.is_action_just_released("inp_fire"): if Input.is_action_just_released("inp_fire"):
character.fire_released() character.fire_released()
if Input.is_action_just_pressed("weapon_forward"): if Input.is_action_just_pressed("weapon_forward"):
character.switch_next_weapon_slot() character.switch_next_weapon_slot()
if Input.is_action_just_pressed("ui_cancel"):
if Globals.process_3d_inputs and Input.is_action_just_pressed("ui_cancel"):
var ingame_menu = preload("res://ui/menus/ingame_menu.tscn").instance() var ingame_menu = preload("res://ui/menus/ingame_menu.tscn").instance()
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED) Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
add_child(ingame_menu) add_child(ingame_menu)
ingame_menu.connect("tree_exited", self, "_ingamemenu_closed") ingame_menu.connect("tree_exited", self, "_ingamemenu_closed")
Globals.process_3d_inputs = false Globals.process_3d_inputs = false
if Input.is_action_just_pressed("camera_reaper"): if Input.is_action_just_pressed("camera_reaper"):
set_character(get_node(reaper_path)) set_character(get_node(reaper_path))
if Input.is_action_just_pressed("camera_vimp"): if Input.is_action_just_pressed("camera_vimp"):
set_character(get_node(vimp_path)) set_character(get_node(vimp_path))
if Input.is_action_just_pressed("move_jump"): if Input.is_action_just_pressed("move_jump"):
character.jump() character.jump()
if Input.is_action_just_pressed("move_sprint"): if Input.is_action_just_pressed("move_sprint"):
character.set_sprint(true) character.set_sprint(true)
if Input.is_action_just_released("move_sprint"): if Input.is_action_just_released("move_sprint"):
character.set_sprint(false) character.set_sprint(false)
if character is Kabuto and Input.is_action_just_pressed("kabuto_sprint"):
character.start_sprint()
func _ingamemenu_closed(): func _ingamemenu_closed():
Globals.process_3d_inputs = true Globals.process_3d_inputs = true
@ -162,9 +156,11 @@ func _process(_delta: float) -> void:
update_hud() update_hud()
func update_hud() -> void: func update_hud() -> void:
# for weapon_slot in HUD.find_node("Weapon*"): #for i in range(5):
# for child in weapon_slot.get_children(): # var weapon_slot = HUD.find_node("Weapon%s" % i)
# weapon_slot.remove_child(child) # if weapon_slot:
# for child in weapon_slot.get_children():
# weapon_slot.remove_child(child)
for weapon in character.weapons: for weapon in character.weapons:
var weapon_slot = character.get_weapon_slot(weapon) var weapon_slot = character.get_weapon_slot(weapon)
var hud_weapon_slot = HUD.find_node("Weapon%s" % weapon_slot) var hud_weapon_slot = HUD.find_node("Weapon%s" % weapon_slot)

View File

@ -29,6 +29,11 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://entities/genericprojectile.gd" "path": "res://entities/genericprojectile.gd"
}, { }, {
"base": "Character",
"class": "Kabuto",
"language": "GDScript",
"path": "res://characters/kabuto.gd"
}, {
"base": "Shop", "base": "Shop",
"class": "ReaperShop", "class": "ReaperShop",
"language": "GDScript", "language": "GDScript",
@ -54,6 +59,7 @@ _global_script_class_icons={
"Character": "", "Character": "",
"Entity": "", "Entity": "",
"GenericProjectile": "", "GenericProjectile": "",
"Kabuto": "",
"ReaperShop": "", "ReaperShop": "",
"Shop": "", "Shop": "",
"TPSController": "", "TPSController": "",
@ -149,6 +155,11 @@ camera_reaper={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":38,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":38,"unicode":0,"echo":false,"script":null)
] ]
} }
kabuto_sprint={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777240,"unicode":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://scenes/intro_island/intro_island.obj" type="ArrayMesh" id=1] [ext_resource path="res://scenes/intro_island/intro_island.obj" type="ArrayMesh" id=1]
[ext_resource path="res://scenes/intro_island/intro_sky.w_intro_island.gzp.tga" type="Texture" id=2] [ext_resource path="res://scenes/intro_island/intro_sky.w_intro_island.gzp.tga" type="Texture" id=2]
@ -11,15 +11,13 @@
[ext_resource path="res://ui/menus/main_menu.tscn" type="PackedScene" id=9] [ext_resource path="res://ui/menus/main_menu.tscn" type="PackedScene" id=9]
[ext_resource path="res://scenes/intro_island/MainMenu.gd" type="Script" id=10] [ext_resource path="res://scenes/intro_island/MainMenu.gd" type="Script" id=10]
[ext_resource path="res://scenes/realistic_water.tscn" type="PackedScene" id=12] [ext_resource path="res://scenes/realistic_water.tscn" type="PackedScene" id=12]
[ext_resource path="res://addons/silicon.vfx.lens_flare/lens_dirt_default.jpeg" type="Texture" id=13]
[ext_resource path="res://addons/silicon.vfx.lens_flare/lens_flare.gd" type="Script" id=14]
[ext_resource path="res://assets/all_gbs/Giants_logo_3D.gbs.obj" type="ArrayMesh" id=15] [ext_resource path="res://assets/all_gbs/Giants_logo_3D.gbs.obj" type="ArrayMesh" id=15]
[sub_resource type="ShaderMaterial" id=1] [sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 7 ) shader = ExtResource( 7 )
shader_param/slope_factor = 50.0 shader_param/slope_factor = 50.0
shader_param/blend_value = 0.5 shader_param/blend_value = 0.5
shader_param/grass_scale = Vector2( 40, 40 ) shader_param/grass_scale = Vector2( 20, 20 )
shader_param/dirt_scale = Vector2( 40, 40 ) shader_param/dirt_scale = Vector2( 40, 40 )
shader_param/light_map = ExtResource( 4 ) shader_param/light_map = ExtResource( 4 )
shader_param/grass_tex = ExtResource( 5 ) shader_param/grass_tex = ExtResource( 5 )
@ -39,6 +37,10 @@ fog_enabled = true
fog_color = Color( 0.00392157, 0.0901961, 0.254902, 1 ) fog_color = Color( 0.00392157, 0.0901961, 0.254902, 1 )
fog_depth_begin = 3847.8 fog_depth_begin = 3847.8
fog_depth_end = 10000.0 fog_depth_end = 10000.0
ss_reflections_enabled = true
ssao_enabled = true
dof_blur_far_distance = 1500.0
dof_blur_near_distance = 117.01
glow_enabled = true glow_enabled = true
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=4]
@ -52,7 +54,7 @@ tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 20, 40, 59.9 ), "times": PoolRealArray( 0, 20, 40, 59.9 ),
"transitions": PoolRealArray( 1, 1, 1, 0.1 ), "transitions": PoolRealArray( 1, 1, 0.5, 1 ),
"update": 0, "update": 0,
"values": [ Vector3( -1220, 863, 66 ), Vector3( -1915.28, 1065.14, -1712.86 ), Vector3( 380.715, 2128.84, -2299.07 ), Vector3( -1770.54, 311.251, -1710.79 ) ] "values": [ Vector3( -1220, 863, 66 ), Vector3( -1915.28, 1065.14, -1712.86 ), Vector3( 380.715, 2128.84, -2299.07 ), Vector3( -1770.54, 311.251, -1710.79 ) ]
} }
@ -88,7 +90,7 @@ light_specular = 1.0
directional_shadow_max_distance = 8192.0 directional_shadow_max_distance = 8192.0
[node name="Camera" type="Camera" parent="."] [node name="Camera" type="Camera" parent="."]
transform = Transform( -4.37114e-08, 0.707107, -0.707107, 0, 0.707107, 0.707107, 1, 3.09086e-08, -3.09086e-08, -1220, 863, 66 ) transform = Transform( -0.743509, 0.196323, -0.639259, 0, 0.955936, 0.293577, 0.668725, 0.218278, -0.710747, -1699.45, 370.081, -1730.17 )
current = true current = true
near = 5.0 near = 5.0
far = 500000.0 far = 500000.0
@ -110,21 +112,8 @@ visible = false
[node name="Water" parent="." instance=ExtResource( 12 )] [node name="Water" parent="." instance=ExtResource( 12 )]
transform = Transform( 50, 0, 0, 0, 10, 0, 0, 0, 50, 0, 20, 0 ) transform = Transform( 50, 0, 0, 0, 10, 0, 0, 0, 50, 0, 20, 0 )
[node name="LensFlare" type="Node" parent="."]
script = ExtResource( 14 )
flare_strength = 16.0
flare_bias = 7.103
flare_blur = 3.826
distortion_quality = 0
distortion = 2.0
ghost_count = 7
ghost_spacing = 0.3
halo_width = 0.25
streak_strength = 0.5
lens_dirt = ExtResource( 13 )
[node name="Logo" type="MeshInstance" parent="."] [node name="Logo" type="MeshInstance" parent="."]
transform = Transform( -4.37114e-08, 0.707107, 0.707107, 0, -0.707107, 0.707107, 1, 3.09086e-08, 3.09086e-08, -1043.22, 756.934, 66 ) transform = Transform( -0.74351, 0.639258, 0.196323, 0, -0.293578, 0.955935, 0.668725, 0.710747, 0.218278, -1561.78, 359.162, -1577.11 )
mesh = ExtResource( 15 ) mesh = ExtResource( 15 )
material/0 = null material/0 = null
material/1 = null material/1 = null

View File

@ -1,7 +1,7 @@
extends Spatial extends Spatial
tool
onready var vimp = $Vimp onready var kabuto = $Kabuto
var kabuto_path: PoolVector3Array
onready var player = $PlayerController.character onready var player = $PlayerController.character
onready var nav = $Navigation onready var nav = $Navigation
@ -113,11 +113,62 @@ func _ready():
audiostream.bus = "Ambiants" audiostream.bus = "Ambiants"
mesh_instance.add_child(audiostream) mesh_instance.add_child(audiostream)
func _on_Timer_timeout(): func angle_between(a: Vector3, b: Vector3) -> float:
var path = nav.get_simple_path(vimp.global_transform.origin, player.global_transform.origin, true) var angle = rad2deg(atan2(b.y - a.y, b.x - a.x))
if path: if angle < 0:
var direction = path[0] - vimp.translation angle += 360
vimp.move_axis = direction.normalized() angle = (int(angle) + 90) % 360
vimp.walk(0.01) return float(angle)
path.remove(0)
onready var tween = get_node("Tween")
func _physics_process(delta):
if player.translation.distance_to(last_target_position) > 10:
last_target_position = player.translation
calculate_path()
if kabuto_path:
var direction = kabuto_path[path_index]
print(direction)
print("kabuto.translation: %s, distance = %s" % [kabuto.translation, kabuto.translation.distance_to(direction)])
while kabuto.translation.distance_to(direction) < 10:
path_index = wrapi(path_index + 1, 0, kabuto_path.size())
direction = kabuto_path[path_index] - kabuto.translation
var move_axis = Vector3(direction - kabuto.translation)
move_axis.y = 0
var look_at = kabuto_path[path_index]
look_at.y = kabuto.transform.origin.y
kabuto.look_at(look_at, Vector3.UP)
kabuto.move_axis = Vector3(1, 0, 0)
print("kabuto.move_axis: %s" % kabuto.move_axis)
else:
kabuto.move_axis = Vector3.ZERO
var visual_path = []
var path_index = 0
onready var last_target_position = player.translation
func _on_Timer_timeout():
pass
func calculate_path():
for o in visual_path:
o.queue_free()
visual_path.clear()
kabuto_path = nav.get_simple_path(kabuto.translation, player.translation, true)
path_index = 0
print("Path length: %s" % len(kabuto_path))
for i in range(len(kabuto_path)):
var t = kabuto_path[i]
var cube = CubeMesh.new()
cube.size = Vector3(1, 1, 1)
var m = MeshInstance.new()
m.translation = t
m.material_override = SpatialMaterial.new()
m.material_override.albedo_color = Color.green.linear_interpolate(Color.red, float(i)/float((len(kabuto_path)-1)))
m.mesh = cube
visual_path.append(m)
add_child(m)

File diff suppressed because one or more lines are too long

View File

@ -2,26 +2,46 @@ extends Control
class_name BaseUI class_name BaseUI
onready var hover_effect = preload("res://ui/text_hover_effect.tscn").instance() onready var hover_effect = preload("res://ui/text_hover_effect.tscn").instance()
onready var buttons_sound = AudioStreamPlayer.new() var ui_parent: Node
func _input(event):
if Globals.process_3d_inputs:
return
if Input.is_action_just_pressed("ui_cancel"):
close()
func connect_children(elem, event: String, method: String): func connect_children(elem, event: String, method: String):
for control in elem.get_children(): for control in elem.get_children():
if control is Button: if control is Button:
control.connect(event, self, method, [control]) control.connect(event, self, method, [control])
connect_children(control, event, method) connect_children(control, event, method)
func close():
if ui_parent:
ui_parent.visible = true
queue_free()
func enter_ui(ui: PackedScene):
var ui_scene = ui.instance()
ui_scene.ui_parent = self
visible = false
get_parent().add_child(ui_scene)
func _ready(): func _ready():
add_child(hover_effect) add_child(hover_effect)
hover_effect.visible = false
move_child(hover_effect, 1) move_child(hover_effect, 1)
add_child(buttons_sound)
connect_children(self, "mouse_entered", "button_hover") connect_children(self, "mouse_entered", "button_hover")
connect_children(self, "pressed", "button_click_sound") connect_children(self, "pressed", "button_click_sound")
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED) Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
Input.set_custom_mouse_cursor(preload("res://assets/all_gbs/textures/cursor.tga")) Input.set_custom_mouse_cursor(preload("res://assets/all_gbs/textures/cursor.tga"))
func button_hover(elem: Button): func button_hover(elem: Button):
buttons_sound.stream = preload("res://assets/audio/Sounds/MM_MINOR.xx_permanentaliens.gzp.wav") if elem.disabled:
buttons_sound.play() return
hover_effect.visible = true
var stream = preload("res://assets/audio/Sounds/MM_MINOR.xx_permanentaliens.gzp.wav")
Globals.play_sound(stream, Globals.Bus.Sounds)
var position = elem.rect_global_position var position = elem.rect_global_position
hover_effect.global_position = position + Vector2(elem.rect_size.x /2 - 10, elem.rect_size.y /2) hover_effect.global_position = position + Vector2(elem.rect_size.x /2 - 10, elem.rect_size.y /2)
hover_effect.visible = true hover_effect.visible = true
@ -31,5 +51,5 @@ func button_hover(elem: Button):
hover_effect.amount = pow(elem.rect_size.x/40, 2) + 10 hover_effect.amount = pow(elem.rect_size.x/40, 2) + 10
func button_click_sound(_elem: Button): func button_click_sound(_elem: Button):
buttons_sound.stream = preload("res://assets/audio/Sounds/MM_MAJOR.xx_permanentaliens.gzp.wav") var stream = preload("res://assets/audio/Sounds/MM_MAJOR.xx_permanentaliens.gzp.wav")
buttons_sound.play() Globals.play_sound(stream, Globals.Bus.Sounds)

View File

@ -1,21 +1,11 @@
extends BaseUI extends BaseUI
onready var options_menu = preload("res://ui/menus/options_menu.tscn").instance()
func _ready():
options_menu.called_ui = self
options_menu.connect("tree_exited", self, "options_menu_closed")
func _on_Resume_pressed(): func _on_Resume_pressed():
get_parent().remove_child(self) close()
func _on_Options_pressed(): func _on_Options_pressed():
get_parent().add_child(options_menu) enter_ui(preload("res://ui/menus/options_menu.tscn"))
self.visible = false
# get_parent().remove_child(self)
func options_menu_closed():
self.visible = true
func _on_MainMenu_pressed(): func _on_MainMenu_pressed():
get_tree().change_scene("res://scenes/intro_island/MainMenu.tscn") get_tree().change_scene("res://scenes/intro_island/MainMenu.tscn")

View File

@ -1,10 +1,5 @@
extends BaseUI extends BaseUI
onready var options_menu = preload("res://ui/menus/options_menu.tscn").instance()
func _ready():
options_menu.called_ui = self
func _on_Start_pressed(): func _on_Start_pressed():
get_tree().change_scene("res://scenes/playground.tscn") get_tree().change_scene("res://scenes/playground.tscn")
@ -12,5 +7,4 @@ func _on_Quit_pressed():
get_tree().quit() get_tree().quit()
func _on_Options_pressed(): func _on_Options_pressed():
get_parent().add_child(options_menu) enter_ui(preload("res://ui/menus/options_menu.tscn"))
get_parent().remove_child(self)

View File

@ -25,12 +25,14 @@ __meta__ = {
} }
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0 anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 470.0 margin_left = -110.5
margin_top = 323.634 margin_top = -256.0
margin_right = -470.0 margin_right = 110.5
margin_bottom = -25.3656 margin_bottom = -5.0
custom_constants/separation = 10 custom_constants/separation = 10
alignment = 1 alignment = 1
__meta__ = { __meta__ = {
@ -38,28 +40,42 @@ __meta__ = {
} }
[node name="Start" type="Button" parent="VBoxContainer"] [node name="Start" type="Button" parent="VBoxContainer"]
margin_top = 63.0 margin_top = 18.0
margin_right = 84.0 margin_right = 221.0
margin_bottom = 98.0 margin_bottom = 53.0
theme = ExtResource( 1 ) theme = ExtResource( 1 )
text = "Start" text = "Start"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Options" type="Button" parent="VBoxContainer"] [node name="Join" type="Button" parent="VBoxContainer"]
margin_top = 63.0
margin_right = 221.0
margin_bottom = 98.0
disabled = true
text = "Join Multiplayer Game"
[node name="Host" type="Button" parent="VBoxContainer"]
margin_top = 108.0 margin_top = 108.0
margin_right = 84.0 margin_right = 221.0
margin_bottom = 143.0 margin_bottom = 143.0
disabled = true
text = "Host Multiplayer Game"
[node name="Options" type="Button" parent="VBoxContainer"]
margin_top = 153.0
margin_right = 221.0
margin_bottom = 188.0
text = "Options" text = "Options"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Quit" type="Button" parent="VBoxContainer"] [node name="Quit" type="Button" parent="VBoxContainer"]
margin_top = 153.0 margin_top = 198.0
margin_right = 84.0 margin_right = 221.0
margin_bottom = 188.0 margin_bottom = 233.0
text = "Quit" text = "Quit"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false

View File

@ -1,76 +1,23 @@
extends BaseUI extends BaseUI
var last_key_pressed = null
func input_list_to_string(inputlist: Array) -> String:
var arr_str = []
for input in inputlist:
arr_str.append(input.as_text())
var psa = PoolStringArray(arr_str)
return psa.join(", ")
onready var keymap_btns = {
$VBoxContainer/GridContainer/Forward: "move_forward",
$VBoxContainer/GridContainer/Backward: "move_backward",
$VBoxContainer/GridContainer/Left: "move_left",
$VBoxContainer/GridContainer/Right: "move_right",
$VBoxContainer/GridContainer/Jump: "move_jump",
$VBoxContainer/GridContainer/Frontcamera: "camera_front",
$VBoxContainer/GridContainer/Sprint: "move_sprint",
$VBoxContainer/GridContainer/Changeweapon: "weapon_forward",
}
var called_ui: BaseUI = null
func _ready():
add_user_signal("key_pressed", [{"name": "event", "type": InputEvent}])
refresh_keymap_btns()
$VBoxContainer/GridContainer/MusicVolume.value = db2linear(get_bus_volume("Music"))
$VBoxContainer/GridContainer/MasterVolume.value = db2linear(get_bus_volume("Master"))
for input_btn in keymap_btns:
input_btn.connect("pressed", self, "_on_keymap_pressed", [input_btn, keymap_btns[input_btn]])
func refresh_keymap_btns():
for keymap_btn in keymap_btns:
refresh_keymap_btn(keymap_btn, keymap_btns[keymap_btn])
func refresh_keymap_btn(button: Button, action: String):
button.text = input_list_to_string(InputMap.get_action_list(action))
func get_bus_volume(bus: String):
var idx = AudioServer.get_bus_index(bus)
return AudioServer.get_bus_volume_db(idx)
func set_bus_volume(bus: String, volume_percent: float):
var idx = AudioServer.get_bus_index(bus)
AudioServer.set_bus_volume_db(idx, linear2db(volume_percent))
func _on_Master_value_changed(value):
set_bus_volume("Master", value)
func _on_Music_value_changed(value):
set_bus_volume("Music", value)
func _on_keymap_pressed(button: Button, action: String):
wait_for_new_key(button, action)
func wait_for_new_key(btn: Button, action: String):
btn.text = "Press a key..."
last_key_pressed = null
connect("key_pressed", self, "set_key", [action, btn], CONNECT_ONESHOT)
func set_key(key: InputEvent, action: String, btn: Button):
InputMap.action_erase_events(action)
InputMap.action_add_event(action, key)
refresh_keymap_btn(btn, action)
func _input(event: InputEvent):
if last_key_pressed or not event is InputEventKey:
return
last_key_pressed = event
emit_signal("key_pressed", event)
func _on_Save_pressed(): func _on_Save_pressed():
get_parent().add_child(called_ui) close()
get_parent().remove_child(self)
func _on_VideoOptions_pressed():
enter_ui(preload("res://ui/menus/video_settings.tscn"))
func _on_SoundOptions_pressed():
enter_ui(preload("res://ui/menus/sound_settings.tscn"))
func _on_MeccOptions_pressed():
pass # Replace with function body.
func _on_ReaperOptions_pressed():
enter_ui(preload("res://ui/menus/reaper_menu.tscn"))
func _on_KabutoOptions_pressed():
pass # Replace with function body.

View File

@ -2,13 +2,38 @@
[ext_resource path="res://ui/ui_theme.tres" type="Theme" id=1] [ext_resource path="res://ui/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://assets/all_gbs/textures/chatbox.tga" type="Texture" id=2] [ext_resource path="res://assets/all_gbs/textures/chatbox.tga" type="Texture" id=2]
[ext_resource path="res://ui/menus/options_menu.gd" type="Script" id=3]
[sub_resource type="GDScript" id=1]
script/source = "extends BaseUI
func _on_Save_pressed():
close()
func _on_VideoOptions_pressed():
enter_ui(preload(\"res://ui/menus/video_settings.tscn\"))
func _on_SoundOptions_pressed():
enter_ui(preload(\"res://ui/menus/sound_settings.tscn\"))
func _on_MeccOptions_pressed():
pass # Replace with function body.
func _on_ReaperOptions_pressed():
enter_ui(preload(\"res://ui/menus/reaper_menu.tscn\"))
func _on_KabutoOptions_pressed():
pass # Replace with function body.
"
[node name="OptionsMenu" type="Control"] [node name="OptionsMenu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
theme = ExtResource( 1 ) theme = ExtResource( 1 )
script = ExtResource( 3 ) script = SubResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -32,223 +57,54 @@ margin_left = 273.0
margin_top = 30.0 margin_top = 30.0
margin_right = -274.0 margin_right = -274.0
margin_bottom = -49.0 margin_bottom = -49.0
custom_constants/separation = 100 custom_constants/separation = 30
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="GridContainer" type="GridContainer" parent="VBoxContainer"] [node name="VideoOptions" type="Button" parent="VBoxContainer"]
margin_right = 477.0 margin_right = 477.0
margin_bottom = 386.0
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label2" type="Label" parent="VBoxContainer/GridContainer"]
margin_right = 151.0
margin_bottom = 35.0 margin_bottom = 35.0
text = "Master volume" text = "Graphics settings"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MasterVolume" type="HSlider" parent="VBoxContainer/GridContainer"] [node name="SoundOptions" type="Button" parent="VBoxContainer"]
margin_left = 155.0 margin_top = 65.0
margin_right = 477.0 margin_right = 477.0
margin_bottom = 16.0 margin_bottom = 100.0
max_value = 1.0 text = "Sound options"
step = 0.05
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="VBoxContainer/GridContainer"] [node name="MeccOptions" type="Button" parent="VBoxContainer"]
margin_top = 39.0 margin_top = 130.0
margin_right = 151.0
margin_bottom = 74.0
text = "Music volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MusicVolume" type="HSlider" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 39.0
margin_right = 477.0 margin_right = 477.0
margin_bottom = 55.0 margin_bottom = 165.0
size_flags_horizontal = 3 disabled = true
max_value = 1.0 text = "Mecc controls"
step = 0.05
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label3" type="Label" parent="VBoxContainer/GridContainer"] [node name="ReaperOptions" type="Button" parent="VBoxContainer"]
margin_top = 78.0
margin_right = 151.0
margin_bottom = 113.0
text = "Move forward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Forward" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 78.0
margin_right = 477.0
margin_bottom = 113.0
text = "Forward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label4" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 117.0
margin_right = 151.0
margin_bottom = 152.0
text = "Move backward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Backward" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 117.0
margin_right = 477.0
margin_bottom = 152.0
text = "Backward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label5" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 156.0
margin_right = 151.0
margin_bottom = 191.0
text = "Move left"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Left" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 156.0
margin_right = 477.0
margin_bottom = 191.0
text = "Left"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label6" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 195.0
margin_right = 151.0
margin_bottom = 230.0
text = "Move right"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Right" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 195.0 margin_top = 195.0
margin_right = 477.0 margin_right = 477.0
margin_bottom = 230.0 margin_bottom = 230.0
text = "Right" text = "Reaper controls"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label7" type="Label" parent="VBoxContainer/GridContainer"] [node name="KabutoOptions" type="Button" parent="VBoxContainer"]
margin_top = 234.0 margin_top = 260.0
margin_right = 151.0
margin_bottom = 269.0
text = "Jump"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Jump" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 234.0
margin_right = 477.0 margin_right = 477.0
margin_bottom = 269.0 margin_bottom = 295.0
text = "Jump" disabled = true
__meta__ = { text = "Kabuto controls"
"_edit_use_anchors_": false
}
[node name="Label8" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 273.0
margin_right = 151.0
margin_bottom = 308.0
text = "Sprint"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprint" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 273.0
margin_right = 477.0
margin_bottom = 308.0
text = "Sprint"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label9" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 312.0
margin_right = 151.0
margin_bottom = 347.0
text = "Front camera"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Frontcamera" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 312.0
margin_right = 477.0
margin_bottom = 347.0
text = "Front Camera"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label10" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 351.0
margin_right = 151.0
margin_bottom = 386.0
text = "Change weapon"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Changeweapon" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 351.0
margin_right = 477.0
margin_bottom = 386.0
text = "Change weapon"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Save" type="Button" parent="VBoxContainer"] [node name="Save" type="Button" parent="VBoxContainer"]
margin_top = 486.0 margin_top = 325.0
margin_right = 477.0 margin_right = 477.0
margin_bottom = 521.0 margin_bottom = 360.0
text = "Save" text = "Close"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Control" type="Control" parent="."] [connection signal="pressed" from="VBoxContainer/VideoOptions" to="." method="_on_VideoOptions_pressed"]
margin_right = 40.0 [connection signal="pressed" from="VBoxContainer/SoundOptions" to="." method="_on_SoundOptions_pressed"]
margin_bottom = 40.0 [connection signal="pressed" from="VBoxContainer/MeccOptions" to="." method="_on_MeccOptions_pressed"]
[connection signal="pressed" from="VBoxContainer/ReaperOptions" to="." method="_on_ReaperOptions_pressed"]
[connection signal="value_changed" from="VBoxContainer/GridContainer/MasterVolume" to="." method="_on_Master_value_changed"] [connection signal="pressed" from="VBoxContainer/KabutoOptions" to="." method="_on_KabutoOptions_pressed"]
[connection signal="value_changed" from="VBoxContainer/GridContainer/MusicVolume" to="." method="_on_Music_value_changed"]
[connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_Save_pressed"] [connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_Save_pressed"]

58
ui/menus/reaper_menu.gd Normal file
View File

@ -0,0 +1,58 @@
extends BaseUI
var last_key_pressed = null
func input_list_to_string(inputlist: Array) -> String:
var arr_str = []
for input in inputlist:
arr_str.append(input.as_text())
var psa = PoolStringArray(arr_str)
return psa.join(", ")
onready var keymap_btns = {
$VBoxContainer/GridContainer/Forward: "move_forward",
$VBoxContainer/GridContainer/Backward: "move_backward",
$VBoxContainer/GridContainer/Left: "move_left",
$VBoxContainer/GridContainer/Right: "move_right",
$VBoxContainer/GridContainer/Jump: "move_jump",
$VBoxContainer/GridContainer/Frontcamera: "camera_front",
$VBoxContainer/GridContainer/Sprint: "move_sprint",
$VBoxContainer/GridContainer/Changeweapon: "weapon_forward",
}
func _ready():
add_user_signal("key_pressed", [{"name": "event", "type": InputEvent}])
refresh_keymap_btns()
for input_btn in keymap_btns:
input_btn.connect("pressed", self, "_on_keymap_pressed", [input_btn, keymap_btns[input_btn]])
func refresh_keymap_btns():
for keymap_btn in keymap_btns:
refresh_keymap_btn(keymap_btn, keymap_btns[keymap_btn])
func refresh_keymap_btn(button: Button, action: String):
button.text = input_list_to_string(InputMap.get_action_list(action))
func _on_keymap_pressed(button: Button, action: String):
wait_for_new_key(button, action)
func wait_for_new_key(btn: Button, action: String):
btn.text = "Press a key..."
last_key_pressed = null
connect("key_pressed", self, "set_key", [action, btn], CONNECT_ONESHOT)
func set_key(key: InputEvent, action: String, btn: Button):
InputMap.action_erase_events(action)
InputMap.action_add_event(action, key)
refresh_keymap_btn(btn, action)
func _input(event: InputEvent):
if last_key_pressed or not event is InputEventKey:
return
last_key_pressed = event
emit_signal("key_pressed", event)
func _on_Save_pressed():
close()

215
ui/menus/reaper_menu.tscn Normal file
View File

@ -0,0 +1,215 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ui/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://assets/all_gbs/textures/chatbox.tga" type="Texture" id=2]
[ext_resource path="res://ui/menus/reaper_menu.gd" type="Script" id=3]
[node name="ReaperMenu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.001
anchor_bottom = 0.997
margin_left = -2.0
margin_right = -0.0240479
margin_bottom = -0.200012
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 273.0
margin_top = 30.0
margin_right = -274.0
margin_bottom = -49.0
custom_constants/separation = 30
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
margin_right = 477.0
margin_bottom = 308.0
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label3" type="Label" parent="VBoxContainer/GridContainer"]
margin_right = 151.0
margin_bottom = 35.0
text = "Move forward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Forward" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_right = 477.0
margin_bottom = 35.0
size_flags_horizontal = 3
text = "Forward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label4" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 39.0
margin_right = 151.0
margin_bottom = 74.0
text = "Move backward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Backward" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 39.0
margin_right = 477.0
margin_bottom = 74.0
size_flags_horizontal = 3
text = "Backward"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label5" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 78.0
margin_right = 151.0
margin_bottom = 113.0
text = "Move left"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Left" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 78.0
margin_right = 477.0
margin_bottom = 113.0
size_flags_horizontal = 3
text = "Left"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label6" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 117.0
margin_right = 151.0
margin_bottom = 152.0
text = "Move right"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Right" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 117.0
margin_right = 477.0
margin_bottom = 152.0
size_flags_horizontal = 3
text = "Right"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label7" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 156.0
margin_right = 151.0
margin_bottom = 191.0
text = "Jump"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Jump" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 156.0
margin_right = 477.0
margin_bottom = 191.0
size_flags_horizontal = 3
text = "Jump"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label8" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 195.0
margin_right = 151.0
margin_bottom = 230.0
text = "Sprint"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprint" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 195.0
margin_right = 477.0
margin_bottom = 230.0
size_flags_horizontal = 3
text = "Sprint"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label9" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 234.0
margin_right = 151.0
margin_bottom = 269.0
text = "Front camera"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Frontcamera" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 234.0
margin_right = 477.0
margin_bottom = 269.0
size_flags_horizontal = 3
text = "Front Camera"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label10" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 273.0
margin_right = 151.0
margin_bottom = 308.0
text = "Change weapon"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Changeweapon" type="Button" parent="VBoxContainer/GridContainer"]
margin_left = 155.0
margin_top = 273.0
margin_right = 477.0
margin_bottom = 308.0
size_flags_horizontal = 3
text = "Change weapon"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Save" type="Button" parent="VBoxContainer"]
margin_top = 338.0
margin_right = 477.0
margin_bottom = 373.0
text = "Save"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_Save_pressed"]

View File

@ -0,0 +1,32 @@
extends BaseUI
func _ready():
$VBoxContainer/GridContainer/MasterVolume.value = db2linear(get_bus_volume("Master"))
$VBoxContainer/GridContainer/MusicVolume.value = db2linear(get_bus_volume("Music"))
$VBoxContainer/GridContainer/SoundsVolume.value = db2linear(get_bus_volume("Sounds"))
$VBoxContainer/GridContainer/AmbiantsVolume.value = db2linear(get_bus_volume("Ambiants"))
func get_bus_volume(bus: String):
var idx = AudioServer.get_bus_index(bus)
return AudioServer.get_bus_volume_db(idx)
func set_bus_volume(bus: String, volume_percent: float):
var idx = AudioServer.get_bus_index(bus)
AudioServer.set_bus_volume_db(idx, linear2db(volume_percent))
func _on_MasterVolume_value_changed(value):
set_bus_volume("Master", value)
func _on_MusicVolume_value_changed(value):
set_bus_volume("Music", value)
func _on_SoundsVolume_value_changed(value):
set_bus_volume("Sounds", value)
func _on_AmbiantsVolume_value_changed(value):
set_bus_volume("Ambiants", value)
func _on_Save_pressed():
close()

View File

@ -0,0 +1,135 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ui/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://assets/all_gbs/textures/chatbox.tga" type="Texture" id=2]
[ext_resource path="res://ui/menus/sound_settings.gd" type="Script" id=3]
[node name="SoundSettings" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.001
anchor_bottom = 0.997
margin_left = -2.0
margin_right = -0.0240479
margin_bottom = 1.79999
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 273.0
margin_top = 30.0
margin_right = -274.0
margin_bottom = -49.0
custom_constants/separation = 100
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
margin_right = 477.0
margin_bottom = 152.0
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MasterLabel" type="Label" parent="VBoxContainer/GridContainer"]
margin_right = 160.0
margin_bottom = 35.0
text = "Master volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MasterVolume" type="HSlider" parent="VBoxContainer/GridContainer"]
margin_left = 164.0
margin_right = 477.0
margin_bottom = 16.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.1
[node name="MusicLabel" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 39.0
margin_right = 160.0
margin_bottom = 74.0
text = "Music volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MusicVolume" type="HSlider" parent="VBoxContainer/GridContainer"]
margin_left = 164.0
margin_top = 39.0
margin_right = 477.0
margin_bottom = 55.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.1
[node name="SoundsLabel" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 78.0
margin_right = 160.0
margin_bottom = 113.0
text = "Sounds volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SoundsVolume" type="HSlider" parent="VBoxContainer/GridContainer"]
margin_left = 164.0
margin_top = 78.0
margin_right = 477.0
margin_bottom = 94.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.1
[node name="AmbiantsLabel" type="Label" parent="VBoxContainer/GridContainer"]
margin_top = 117.0
margin_right = 160.0
margin_bottom = 152.0
text = "Ambiants volume"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AmbiantsVolume" type="HSlider" parent="VBoxContainer/GridContainer"]
margin_left = 164.0
margin_top = 117.0
margin_right = 477.0
margin_bottom = 133.0
size_flags_horizontal = 3
max_value = 1.0
step = 0.1
[node name="Save" type="Button" parent="VBoxContainer"]
margin_top = 252.0
margin_right = 477.0
margin_bottom = 287.0
text = "Save"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Control" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[connection signal="value_changed" from="VBoxContainer/GridContainer/MasterVolume" to="." method="_on_MasterVolume_value_changed"]
[connection signal="value_changed" from="VBoxContainer/GridContainer/MusicVolume" to="." method="_on_MusicVolume_value_changed"]
[connection signal="value_changed" from="VBoxContainer/GridContainer/SoundsVolume" to="." method="_on_SoundsVolume_value_changed"]
[connection signal="value_changed" from="VBoxContainer/GridContainer/AmbiantsVolume" to="." method="_on_AmbiantsVolume_value_changed"]
[connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_Save_pressed"]

View File

@ -0,0 +1,14 @@
extends BaseUI
func _ready():
$VBoxContainer/GridContainer/CheckBox.pressed = OS.window_fullscreen
func _on_Save_pressed():
close()
func _on_CheckBox_toggled(button_pressed):
if OS.window_fullscreen:
OS.window_fullscreen = false
else:
OS.window_fullscreen = true

View File

@ -0,0 +1,78 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ui/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://assets/all_gbs/textures/chatbox.tga" type="Texture" id=2]
[ext_resource path="res://ui/menus/video_settings.gd" type="Script" id=3]
[node name="VideoSettings" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.001
anchor_bottom = 0.997
margin_left = -2.0
margin_right = -0.0240479
margin_bottom = -0.200012
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 273.0
margin_top = 30.0
margin_right = -274.0
margin_bottom = -49.0
custom_constants/separation = 100
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="VBoxContainer"]
margin_right = 477.0
margin_bottom = 35.0
columns = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label2" type="Label" parent="VBoxContainer/GridContainer"]
margin_right = 108.0
margin_bottom = 35.0
text = "Full screen"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/GridContainer"]
margin_left = 112.0
margin_right = 136.0
margin_bottom = 35.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Save" type="Button" parent="VBoxContainer"]
margin_top = 135.0
margin_right = 477.0
margin_bottom = 170.0
text = "Save"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Control" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[connection signal="toggled" from="VBoxContainer/GridContainer/CheckBox" to="." method="_on_CheckBox_toggled"]
[connection signal="pressed" from="VBoxContainer/Save" to="." method="_on_Save_pressed"]

View File

@ -7,12 +7,7 @@ content_margin_left = 6.0
content_margin_right = 6.0 content_margin_right = 6.0
content_margin_top = 4.0 content_margin_top = 4.0
content_margin_bottom = 4.0 content_margin_bottom = 4.0
bg_color = Color( 0.18, 0.207, 0.279, 1 ) bg_color = Color( 0.180392, 0.207843, 0.278431, 0 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.14, 0.161, 0.217, 1 )
[sub_resource type="StyleBoxFlat" id=2] [sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.6, 0.6, 0.6, 0 ) bg_color = Color( 0.6, 0.6, 0.6, 0 )

View File

@ -19,6 +19,7 @@ switch_sound = ExtResource( 7 )
max_ammo = 0 max_ammo = 0
current_ammo = 0 current_ammo = 0
weapon_icon = ExtResource( 8 ) weapon_icon = ExtResource( 8 )
repeat_time = 0.01
activate_efx = ExtResource( 4 ) activate_efx = ExtResource( 4 )
activate_sound = ExtResource( 6 ) activate_sound = ExtResource( 6 )

View File

@ -19,6 +19,7 @@ switch_sound = ExtResource( 7 )
max_ammo = 25 max_ammo = 25
current_ammo = 25 current_ammo = 25
weapon_icon = ExtResource( 8 ) weapon_icon = ExtResource( 8 )
repeat_time = 0.01
activate_efx = ExtResource( 6 ) activate_efx = ExtResource( 6 )
activate_sound = ExtResource( 3 ) activate_sound = ExtResource( 3 )

21
weapons/handgun.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/all_gbs/mc_gun.gbs.obj" type="ArrayMesh" id=1]
[ext_resource path="res://entities/weapon.gd" type="Script" id=2]
[ext_resource path="res://projectiles/default.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/all_gbs/textures/st_mec_gun.tga" type="Texture" id=4]
[ext_resource path="res://assets/audio/Sounds/ME_PEAS1.xx_mecclev1.gzp.wav" type="AudioStream" id=5]
[node name="Weapon" type="Spatial"]
script = ExtResource( 2 )
projectile = ExtResource( 3 )
fire_sound = ExtResource( 5 )
max_ammo = 0
current_ammo = 0
weapon_icon = ExtResource( 4 )
repeat_time = 0.5
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
mesh = ExtResource( 1 )
material/0 = null