Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gun_slave/client/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ config/icon="res://icon.png"
Utils="*res://common/utils.gd"
Types="*res://common/types.gd"

[display]

window/size/resizable=false

[global]

port=false
Expand All @@ -61,7 +65,3 @@ click={

2d/default_gravity=0
2d/default_gravity_vector=Vector2( 0, 0 )

[rendering]

environment/default_environment="res://default_env.tres"
7 changes: 6 additions & 1 deletion gun_slave/client/world.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://common/map.tscn" type="PackedScene" id=1]
[ext_resource path="res://common/scene/character.tscn" type="PackedScene" id=2]
[ext_resource path="res://Manager.gd" type="Script" id=3]
[ext_resource path="res://common/script/client/NetManager.gd" type="Script" id=4]
[ext_resource path="res://common/scene/user_interface.tscn" type="PackedScene" id=5]

[node name="world" type="Node2D"]

Expand All @@ -20,3 +21,7 @@ is_player = true

[node name="NetManager" type="Node" parent="Manager"]
script = ExtResource( 4 )

[node name="interface" type="CanvasLayer" parent="Manager"]

[node name="user_interface" parent="Manager/interface" instance=ExtResource( 5 )]
331 changes: 324 additions & 7 deletions gun_slave/common/map.tscn

Large diffs are not rendered by default.

Binary file added gun_slave/common/resource/font/sourcesans.ttf
Binary file not shown.
Binary file modified gun_slave/common/resource/image/ak47.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gun_slave/common/resource/image/health-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gun_slave/common/resource/image/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gun_slave/common/resource/tileset/dust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion gun_slave/common/scene/character.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://common/resource/image/ct1.png" type="Texture" id=1]
[ext_resource path="res://common/script/character.gd" type="Script" id=2]
[ext_resource path="res://common/scene/weapon.tscn" type="PackedScene" id=3]
[ext_resource path="res://common/resource/image/light.png" type="Texture" id=4]

[sub_resource type="CapsuleShape2D" id=1]
radius = 6.67738
Expand Down Expand Up @@ -31,4 +32,18 @@ texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 64, 32, 32 )

[node name="light" type="Light2D" parent="."]
scale = Vector2( 2, 2 )
skew = 4.37114e-08
texture = ExtResource( 4 )
color = Color( 1, 1, 1, 0.45098 )
mode = 2
range_z_min = -1
range_z_max = 0
shadow_enabled = true
shadow_color = Color( 0, 0, 0, 0.419608 )
shadow_gradient_length = 1.0
shadow_filter = 3

[node name="weapon" parent="." instance=ExtResource( 3 )]
skew = 4.37114e-08
3 changes: 3 additions & 0 deletions gun_slave/common/scene/health.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[gd_scene format=2]

[node name="health" type="Node2D"]
44 changes: 44 additions & 0 deletions gun_slave/common/scene/user_interface.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://common/resource/image/health-icon.png" type="Texture" id=1]
[ext_resource path="res://common/resource/font/sourcesans.ttf" type="DynamicFontData" id=2]

[sub_resource type="DynamicFont" id=1]
size = 50
outline_size = 1
outline_color = Color( 0, 0, 0, 0.329412 )
use_filter = true
extra_spacing_char = -2
font_data = ExtResource( 2 )

[node name="user_interface" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}

[node name="health" type="TextureRect" parent="."]
self_modulate = Color( 1, 1, 0.784314, 1 )
margin_top = 520.0
margin_right = 80.0
margin_bottom = 600.0
texture = ExtResource( 1 )
expand = true
stretch_mode = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="health_text" type="Label" parent="health"]
self_modulate = Color( 0.00784314, 1, 0, 1 )
margin_left = 78.8456
margin_top = 9.2782
margin_right = 159.846
margin_bottom = 73.2782
custom_fonts/font = SubResource( 1 )
text = "100"
__meta__ = {
"_edit_use_anchors_": false
}
6 changes: 5 additions & 1 deletion gun_slave/common/scene/weapon.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]

[ext_resource path="res://common/resource/image/ak47.png" type="Texture" id=1]
[ext_resource path="res://common/script/weapon.gd" type="Script" id=2]
[ext_resource path="res://common/resource/sound/ak47.wav" type="AudioStream" id=3]

[node name="weapon" type="Node2D"]
rotation = 1.5708
Expand All @@ -20,3 +21,6 @@ z_index = 1
[node name="cast" type="RayCast2D" parent="bullet_point"]
enabled = true
cast_to = Vector2( 0, -1 )

[node name="sound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
10 changes: 5 additions & 5 deletions gun_slave/common/script/character.gd
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ func apply_health(new_health: int):
if (new_health < health) and use_animation:
blood_animation()
health = new_health

get_parent().get_node("interface/user_interface/health/health_text").text = str(health);

func set_state(state: Types.EntityState):
last_entity_state_mutex.lock()
last_entity_state = state
Expand Down Expand Up @@ -258,15 +258,15 @@ func hit_enemy(enemy: character):
return enemy.hit($weapon.damage)

func hit(damage:int)->void:
self.health -= damage;
self.apply_health(self.health - damage);
# self.health -= damage;
# if health <= 0:
# self.position.x += 100
# self.health = MAX_HEALTH
#
if not use_animation:
return

blood_animation()
#blood_animation()
# if self.health <= 0:
# self.hide()

Expand Down
1 change: 1 addition & 0 deletions gun_slave/common/script/weapon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func shoot(has_hit: bool)->void:
# body.hit(self.damage);

if use_animation:
$sound.play();
var target_pos:Vector2 = $bullet_point/cast.get_collision_point() if has_hit \
else to_global($bullet_point/cast.cast_to);
var trace = trace_obj.instance();
Expand Down