Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
outfrost committed Apr 26, 2021
2 parents d1ad114 + 674a825 commit ba0a33c
Show file tree
Hide file tree
Showing 16 changed files with 272 additions and 42 deletions.
19 changes: 19 additions & 0 deletions FCT.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends Label

func _show_value(value, travel, duration, spread):

text = value
var movement = travel.rotated(rand_range(-spread/2, spread/2))
var react_pivot_offset = rect_size / 2

$Tween.interpolate_property(self, "rect_position",
rect_position, rect_position + movement,
duration, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
$Tween.interpolate_property(self, "modulate:a",
1.0, 0.0, duration,Tween.TRANS_BACK,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)

$Tween.start()
yield($Tween, "tween_all_completed")
queue_free()

12 changes: 12 additions & 0 deletions FCTManager.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends Node2D

var FCT = preload("res://character/FCT.tscn")

export var travel = Vector2(0, -80)
export var duration = 2
export var spread = PI/2

func _show_value(value):
var fct = FCT.instance()
add_child(fct)
fct._show_value(str(value), travel, duration, spread)
7 changes: 7 additions & 0 deletions character/Enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ func _ready() -> void:
func take_damage(dmg: float, fire_dmg: float, ice_dmg: float, wind_dmg: float):

health -= (1.0 - resist_base) * dmg
$FCTManager._show_value((1.0 - resist_base) * dmg)
health -= (1.0 - resist_fire) * fire_dmg
if ((1.0 - resist_fire) * fire_dmg) != 0:
$FCTManager._show_value((1.0 - resist_fire) * fire_dmg)
health -= (1.0 - resist_ice) * ice_dmg
if ((1.0 - resist_ice) * ice_dmg) != 0:
$FCTManager._show_value((1.0 - resist_ice) * ice_dmg)
health -= (1.0 - resist_wind) * wind_dmg
if ((1.0 - resist_wind) * wind_dmg) != 0:
$FCTManager._show_value((1.0 - resist_wind) * wind_dmg)

if health <= 0.0:
queue_free()
Expand Down
9 changes: 8 additions & 1 deletion character/EnemyBlue.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=21 format=2]

[ext_resource path="res://character/EnemyBlue_SpriteFrames.tres" type="SpriteFrames" id=1]
[ext_resource path="res://character/Enemy.gd" type="Script" id=2]
Expand All @@ -18,6 +18,7 @@
[ext_resource path="res://sound/positional/SFX_SwordSwing_2.wav" type="AudioStream" id=16]
[ext_resource path="res://sound/positional/SFX_SwordHit_3.wav" type="AudioStream" id=17]
[ext_resource path="res://character/AttackFx_SpriteFrames.tres" type="SpriteFrames" id=18]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=19]

[sub_resource type="CircleShape2D" id=1]
radius = 16.0
Expand All @@ -28,6 +29,12 @@ walk_sounds = [ NodePath("AudioStreamPlayer2DWalk1"), NodePath("AudioStreamPlaye
walk_sound_interval = 0.32
swing_sounds = [ NodePath("AudioStreamPlayer2DSwing1"), NodePath("AudioStreamPlayer2DSwing2"), NodePath("AudioStreamPlayer2DSwing3"), NodePath("AudioStreamPlayer2DSwing4") ]
hit_sounds = [ NodePath("AudioStreamPlayer2DHit1"), NodePath("AudioStreamPlayer2DHit2"), NodePath("AudioStreamPlayer2DHit3"), NodePath("AudioStreamPlayer2DHit4"), NodePath("AudioStreamPlayer2DHit5"), NodePath("AudioStreamPlayer2DHit6"), NodePath("AudioStreamPlayer2DHit7") ]
resist_base = 1.0
resist_fire = 1.0
resist_wind = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 19 )]
position = Vector2( 0, -40 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
Expand Down
9 changes: 8 additions & 1 deletion character/EnemyRed.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=21 format=2]

[ext_resource path="res://character/EnemyRed_SpriteFrames.tres" type="SpriteFrames" id=1]
[ext_resource path="res://character/Enemy.gd" type="Script" id=2]
Expand All @@ -18,6 +18,7 @@
[ext_resource path="res://sound/positional/SFX_SwordSwing_2.wav" type="AudioStream" id=16]
[ext_resource path="res://sound/positional/SFX_SwordHit_3.wav" type="AudioStream" id=17]
[ext_resource path="res://character/AttackFx_SpriteFrames.tres" type="SpriteFrames" id=18]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=19]

[sub_resource type="CircleShape2D" id=1]
radius = 16.0
Expand All @@ -28,6 +29,12 @@ walk_sounds = [ NodePath("AudioStreamPlayer2DWalk1"), NodePath("AudioStreamPlaye
walk_sound_interval = 0.32
swing_sounds = [ NodePath("AudioStreamPlayer2DSwing1"), NodePath("AudioStreamPlayer2DSwing2"), NodePath("AudioStreamPlayer2DSwing3"), NodePath("AudioStreamPlayer2DSwing4") ]
hit_sounds = [ NodePath("AudioStreamPlayer2DHit1"), NodePath("AudioStreamPlayer2DHit2"), NodePath("AudioStreamPlayer2DHit3"), NodePath("AudioStreamPlayer2DHit4"), NodePath("AudioStreamPlayer2DHit5"), NodePath("AudioStreamPlayer2DHit6"), NodePath("AudioStreamPlayer2DHit7") ]
resist_base = 1.0
resist_ice = 1.0
resist_wind = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 19 )]
position = Vector2( 0, -40 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
Expand Down
9 changes: 8 additions & 1 deletion character/EnemyYellow.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=21 format=2]

[ext_resource path="res://character/EnemyYellow_SpriteFrames.tres" type="SpriteFrames" id=1]
[ext_resource path="res://character/Enemy.gd" type="Script" id=2]
Expand All @@ -18,6 +18,7 @@
[ext_resource path="res://sound/positional/SFX_SwordSwing_2.wav" type="AudioStream" id=16]
[ext_resource path="res://sound/positional/SFX_SwordHit_3.wav" type="AudioStream" id=17]
[ext_resource path="res://character/AttackFx_SpriteFrames.tres" type="SpriteFrames" id=18]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=19]

[sub_resource type="CircleShape2D" id=1]
radius = 16.0
Expand All @@ -28,6 +29,12 @@ walk_sounds = [ NodePath("AudioStreamPlayer2DWalk1"), NodePath("AudioStreamPlaye
walk_sound_interval = 0.32
swing_sounds = [ NodePath("AudioStreamPlayer2DSwing1"), NodePath("AudioStreamPlayer2DSwing2"), NodePath("AudioStreamPlayer2DSwing3"), NodePath("AudioStreamPlayer2DSwing4") ]
hit_sounds = [ NodePath("AudioStreamPlayer2DHit1"), NodePath("AudioStreamPlayer2DHit2"), NodePath("AudioStreamPlayer2DHit3"), NodePath("AudioStreamPlayer2DHit4"), NodePath("AudioStreamPlayer2DHit5"), NodePath("AudioStreamPlayer2DHit6"), NodePath("AudioStreamPlayer2DHit7") ]
resist_base = 1.0
resist_fire = 1.0
resist_ice = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 19 )]
position = Vector2( 0, -40 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
Expand Down
21 changes: 21 additions & 0 deletions character/FCT.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://FCT.gd" type="Script" id=1]
[ext_resource path="res://font/Silver.ttf" type="DynamicFontData" id=2]

[sub_resource type="DynamicFont" id=1]
size = 12
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 2 )

[node name="FCT" type="Label"]
margin_right = 40.0
margin_bottom = 14.0
custom_fonts/font = SubResource( 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Tween" type="Tween" parent="."]
6 changes: 6 additions & 0 deletions character/FCTManager.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://FCTManager.gd" type="Script" id=1]

[node name="FCTManager" type="Node2D"]
script = ExtResource( 1 )
7 changes: 5 additions & 2 deletions character/PlayerCharacter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ var resist_fire: float = 0.20
var resist_ice: float = 0.20
var resist_wind: float = 0.20

var basic_attack_dmg: float = 40.0
export var basic_attack_dmg: float = 40.00
export var fire_attack_dmg: float = 0.00
export var ice_attack_dmg: float = 0.00
export var wind_attack_dmg: float = 0.00

var walk_sound_timer: float = 0.0
var playing_action: bool = false
Expand Down Expand Up @@ -127,7 +130,7 @@ func hit(other: CollisionObject2D):
yield(get_tree().create_timer(attack_hit_delay), "timeout")
if !is_instance_valid(other):
return
other.take_damage(basic_attack_dmg,0,0,0)
other.take_damage(basic_attack_dmg,fire_attack_dmg,ice_attack_dmg,wind_attack_dmg)
if hit_sounds.size() > 0:
get_node(hit_sounds[randi() % hit_sounds.size()]).play()

Expand Down
10 changes: 9 additions & 1 deletion environment/Breakable.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ onready var home = self.position

func take_damage(dmg: float, fire_dmg: float, ice_dmg: float, wind_dmg: float):


health -= (1.0 - resist_base) * dmg
$FCTManager._show_value((1.0 - resist_base) * dmg)
health -= (1.0 - resist_fire) * fire_dmg
if ((1.0 - resist_fire) * fire_dmg) != 0:
$FCTManager._show_value((1.0 - resist_fire) * fire_dmg)
health -= (1.0 - resist_ice) * ice_dmg
health -= (1.0 - resist_wind) * wind_dmg
if ((1.0 - resist_ice) * ice_dmg) != 0:
$FCTManager._show_value((1.0 - resist_ice) * ice_dmg)
health -= (1.0 - resist_wind) * wind_dmg
if ((1.0 - resist_wind) * wind_dmg) != 0:
$FCTManager._show_value((1.0 - resist_wind) * wind_dmg)

if health <= 0.0:
queue_free()
6 changes: 5 additions & 1 deletion environment/Breakable_Bush1.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://environment/breakablebush.png" type="Texture" id=1]
[ext_resource path="res://environment/Breakable.gd" type="Script" id=2]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=3]

[sub_resource type="RectangleShape2D" id=1]

[node name="StaticBody2D" type="StaticBody2D"]
script = ExtResource( 2 )

[node name="FCTManager" parent="." instance=ExtResource( 3 )]
position = Vector2( 0, -15 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

Expand Down
6 changes: 5 additions & 1 deletion environment/Breakable_FireBush.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://environment/redbreakablebush.png" type="Texture" id=1]
[ext_resource path="res://environment/Breakable.gd" type="Script" id=2]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=3]

[sub_resource type="RectangleShape2D" id=1]

Expand All @@ -11,6 +12,9 @@ resist_base = 1.0
resist_ice = 1.0
resist_wind = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 3 )]
position = Vector2( 0, -15 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

Expand Down
6 changes: 5 additions & 1 deletion environment/Breakable_IceBush.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://environment/bluebreakablebush.png" type="Texture" id=1]
[ext_resource path="res://environment/Breakable.gd" type="Script" id=2]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=3]

[sub_resource type="RectangleShape2D" id=1]

Expand All @@ -11,6 +12,9 @@ resist_base = 1.0
resist_fire = 1.0
resist_wind = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 3 )]
position = Vector2( 0, -15 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

Expand Down
6 changes: 5 additions & 1 deletion environment/Breakable_WindBush.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://environment/yellowbreakablebush.png" type="Texture" id=1]
[ext_resource path="res://environment/Breakable.gd" type="Script" id=2]
[ext_resource path="res://character/FCTManager.tscn" type="PackedScene" id=3]

[sub_resource type="RectangleShape2D" id=1]

Expand All @@ -11,6 +12,9 @@ resist_base = 1.0
resist_fire = 1.0
resist_ice = 1.0

[node name="FCTManager" parent="." instance=ExtResource( 3 )]
position = Vector2( 0, -15 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

Expand Down
4 changes: 2 additions & 2 deletions environment/props/TableWide2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[ext_resource path="res://game/ui-theme/font_large.tres" type="DynamicFont" id=6]
[ext_resource path="res://game/ui-theme/oinventoryitembackground.png" type="Texture" id=7]

[sub_resource type="CircleShape2D" id=1]
radius = 40.0
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 30, 5 )

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 30, 5 )
Expand Down
Loading

0 comments on commit ba0a33c

Please sign in to comment.