Indications when a unit is hit but not destroyed

This commit is contained in:
Kienan Stewart 2022-04-03 19:07:01 -04:00
parent 752f2180e9
commit dfb5ecd2db
20 changed files with 161 additions and 42 deletions

View File

@ -1,9 +1,8 @@
1. Visual polish
* visual indications when damage is done but a unit isn't killed
* visual indication when a unit is stronger (eg. a little skull or star or something)
* multiple square tiles to add variation
2. Sound effects
* on hit, especially when the unit isn't killed
* when a unit is killed
* if possible, a small bit of background music
3. Gameplay additions:
* powerups: change movement type, remove pawn's attack and movement restrictions

BIN
assets/export/hit1.wav Normal file

Binary file not shown.

BIN
assets/export/hit2.wav Normal file

Binary file not shown.

BIN
assets/export/hit3.wav Normal file

Binary file not shown.

BIN
assets/export/hit4.wav Normal file

Binary file not shown.

View File

@ -1,7 +1,75 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="voice_clips_data" version="1.3.0" audacityversion="2.4.2" sel0="0.0000000000" sel1="0.0000000000" vpos="0" h="30.8477097506" zoom="86.1328125000" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<project xmlns="http://audacity.sourceforge.net/xml/" projname="voice_clips_data" version="1.3.0" audacityversion="2.4.2" sel0="0.1044897959" sel1="0.1625396825" vpos="0" h="0.0000000000" zoom="86.1328125000" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="0" linked="1" mute="0" solo="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12800">
<waveblock start="0">
<simpleblockfile filename="eff1f023.au" len="12800" min="-0.503601" max="0.707655" rms="0.04372"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="1.01006803" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="17408">
<waveblock start="0">
<simpleblockfile filename="eff1f4ba.au" len="17408" min="-1.269999" max="1.343039" rms="0.137565"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="2.03174603" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="14336">
<waveblock start="0">
<simpleblockfile filename="eff1ff3d.au" len="14336" min="-1.154202" max="1.230705" rms="0.072907"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="3.01859410" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="18944">
<waveblock start="0">
<simpleblockfile filename="eff1f3b6.au" len="18944" min="-1.430278" max="1.277689" rms="0.162329"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="1" linked="0" mute="0" solo="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12800">
<waveblock start="0">
<simpleblockfile filename="eff1f4a9.au" len="12800" min="-0.507655" max="0.715664" rms="0.044112"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="1.01006803" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="17408">
<waveblock start="0">
<simpleblockfile filename="eff1f808.au" len="17408" min="-1.273832" max="1.353467" rms="0.138377"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="2.03174603" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="14336">
<waveblock start="0">
<simpleblockfile filename="eff1f671.au" len="14336" min="-1.118351" max="1.221182" rms="0.073425"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="3.01859410" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="18944">
<waveblock start="0">
<simpleblockfile filename="eff1fc1b.au" len="18944" min="-1.431384" max="1.275673" rms="0.163134"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" isSelected="1" height="150" minimized="0" channel="0" linked="1" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0"/>
<wavetrack name="Audio Track" isSelected="1" height="150" minimized="0" channel="1" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0"/>
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="0" linked="1" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
@ -124,7 +192,7 @@
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="0" linked="1" mute="0" solo="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="0" linked="1" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="42496">
<waveblock start="0">
@ -134,7 +202,7 @@
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="1" linked="0" mute="0" solo="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<wavetrack name="Audio Track" isSelected="0" height="150" minimized="0" channel="1" linked="0" mute="1" solo="0" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="42496">
<waveblock start="0">

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

@ -55,6 +55,13 @@ const piece_types = {
"queen": "res://src/pieces/Queen.tscn",
}
const hit_sounds = [
"/root/Game/Hit1",
"/root/Game/Hit2",
"/root/Game/Hit3",
"/root/Game/Hit4",
]
func new_piece(piece_type, group, position = null):
if not piece_types.has(piece_type):
return null
@ -536,8 +543,11 @@ func _process(delta):
else:
# Deal damage
target_square['piece'].health -= square['piece'].damage
# @TODO Sound effect
# @TODO Visual indication of damage dealt
var idx = self.rng.randi() % self.hit_sounds.size()
get_node(self.hit_sounds[idx]).play()
target_square['piece'].set_status(
"-" + str(square['piece'].damage), 2, Color(1, 0, 0, 1), Color(1, 0, 0, 0)
)
# Bounce piece back
target_square = square
square['piece'] = null
@ -631,8 +641,11 @@ func _physics_process(delta):
print("ai loss Chance to play: ", c, " got index ", index_to_play)
get_node(self.on_ai_lose_piece[index_to_play]).play()
else:
# @TODO Play a sound effect
# @TODO Visual indication of damage dealt
var idx = self.rng.randi() % self.hit_sounds.size()
get_node(self.hit_sounds[idx]).play()
dest_square['piece'].set_status(
"-" + str(square['piece'].damage), 2, Color(1, 0, 0, 1), Color(1, 0, 0, 0)
)
dest_square['piece'].health -= square['piece'].damage
dest_square = square
square['piece'] = null

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=2]
[gd_scene load_steps=26 format=2]
[ext_resource path="res://src/Game.gd" type="Script" id=1]
[ext_resource path="res://src/Playfield.tscn" type="PackedScene" id=2]
@ -18,6 +18,10 @@
[ext_resource path="res://assets/export/skip_disabled.png" type="Texture" id=16]
[ext_resource path="res://assets/export/skip_hover.png" type="Texture" id=17]
[ext_resource path="res://src/PieceDetails.tscn" type="PackedScene" id=18]
[ext_resource path="res://assets/export/hit2.wav" type="AudioStream" id=19]
[ext_resource path="res://assets/export/hit1.wav" type="AudioStream" id=20]
[ext_resource path="res://assets/export/hit3.wav" type="AudioStream" id=21]
[ext_resource path="res://assets/export/hit4.wav" type="AudioStream" id=22]
[sub_resource type="DynamicFont" id=1]
size = 24
@ -235,6 +239,18 @@ margin_bottom = 14.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Hit1" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 20 )
[node name="Hit2" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 19 )
[node name="Hit3" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 21 )
[node name="Hit4" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 22 )
[connection signal="finished" from="EndSong" to="." method="_on_EndSong_finished"]
[connection signal="finished" from="Yammering" to="." method="_on_Yammering_finished"]
[connection signal="finished" from="Dust" to="." method="_on_Dust_finished"]

View File

@ -22,6 +22,20 @@ const CLICK_THRESHOLD = 0.15 # seconds
var last_click = null
var hold_started = false
var status_timer_max = 0
var status_timer = 0
var status_color_start = Color(1, 1, 1, 1)
var status_color_end = Color(1, 1, 1, 0)
func set_status(message, time, c1: Color = Color(1, 1, 1, 1), c2: Color = Color(1, 1, 1, 0)):
self.status_timer = time
self.status_timer_max = time
self.status_color_start = c1
self.status_color_end = c2
get_node("StatusChange").set_modulate(c1)
get_node("StatusChange").set_text(message)
get_node("StatusChange").set_visible(true)
# Called when the node enters the scene tree for the first time.
func _ready():
pass
@ -66,7 +80,13 @@ func _process(delta):
emit_signal("hold_start", self, null)
if self.hold_started:
self.set_global_position(get_viewport().get_mouse_position())
if self.status_timer > 0:
self.status_timer -= delta
if self.status_timer <= 0:
get_node("StatusChange").set_visible(false)
get_node("StatusChange").set_modulate(
lerp(self.status_color_end, self.status_color_start, self.status_timer / self.status_timer_max)
)
func cancel_hold():
self.last_click = null
self.hold_started = false

View File

@ -85,16 +85,15 @@ custom_fonts/font = ExtResource( 1 )
text = "1 "
[node name="UpHealth" type="Button" parent="Vbox"]
visible = false
margin_top = 219.0
margin_right = 190.0
margin_bottom = 239.0
text = "Increase health"
[node name="Damage" type="HBoxContainer" parent="Vbox"]
margin_top = 219.0
margin_top = 243.0
margin_right = 190.0
margin_bottom = 283.0
margin_bottom = 307.0
[node name="TextureRect" type="TextureRect" parent="Vbox/Damage"]
material = ExtResource( 3 )
@ -118,9 +117,9 @@ margin_bottom = 307.0
text = "Increase damage"
[node name="Kills" type="HBoxContainer" parent="Vbox"]
margin_top = 287.0
margin_top = 311.0
margin_right = 190.0
margin_bottom = 351.0
margin_bottom = 375.0
[node name="TextureRect" type="TextureRect" parent="Vbox/Kills"]
material = ExtResource( 3 )
@ -137,24 +136,23 @@ custom_fonts/font = ExtResource( 1 )
text = "1"
[node name="Jump" type="Label" parent="Vbox"]
margin_top = 355.0
margin_top = 379.0
margin_right = 190.0
margin_bottom = 379.0
margin_bottom = 403.0
custom_fonts/font = SubResource( 1 )
text = "Cannot jump"
[node name="CheckButton" type="CheckButton" parent="Vbox"]
visible = false
margin_top = 383.0
margin_top = 407.0
margin_right = 190.0
margin_bottom = 423.0
margin_bottom = 447.0
text = "Jump"
[node name="Powerup" type="Button" parent="Vbox"]
visible = false
margin_top = 383.0
margin_top = 427.0
margin_right = 190.0
margin_bottom = 403.0
margin_bottom = 447.0
text = "Spawn powerup"
[connection signal="pressed" from="Vbox/UpMovement" to="." method="_on_UpMovement_pressed"]
[connection signal="pressed" from="Vbox/UpHealth" to="." method="_on_UpHealth_pressed"]

View File

@ -1,25 +1,17 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://src/hilight.shader" type="Shader" id=1]
[ext_resource path="res://src/pieces/Piece.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/pieces/Pawn.gd" type="Script" id=2]
[ext_resource path="res://assets/export/pawn.png" type="Texture" id=3]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 1 )
shader_param/width = 2.0
shader_param/color = null
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 128, 128 )
[node name="Piece" type="Area2D"]
[node name="Piece" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Body" type="Sprite" parent="."]
material = SubResource( 1 )
[node name="Body" parent="." index="0"]
texture = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
modulate = Color( 0.345098, 0.980392, 0.0862745, 1 )
shape = SubResource( 2 )
[connection signal="input_event" from="." to="." method="_on_Piece_input_event"]
[node name="StatusChange" parent="." index="2"]
margin_left = 0.902771
margin_top = -73.0833
margin_right = 81.9028
margin_bottom = -0.0833435

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://src/Piece.gd" type="Script" id=1]
[ext_resource path="res://src/hilight.shader" type="Shader" id=2]
[ext_resource path="res://src/font_32.tres" type="DynamicFont" id=3]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 2 )
@ -9,7 +10,7 @@ shader_param/width = 2.0
shader_param/color = null
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 128, 128 )
extents = Vector2( 64, 64 )
[node name="Piece" type="Area2D"]
script = ExtResource( 1 )
@ -19,4 +20,16 @@ material = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )
[node name="StatusChange" type="Label" parent="."]
margin_left = 45.0
margin_top = -126.0
margin_right = 126.0
margin_bottom = -53.0
custom_fonts/font = ExtResource( 3 )
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="input_event" from="." to="." method="_on_Piece_input_event"]