change health sprite & player stun

main
Just Dzhi 2023-10-02 14:26:11 +04:00
parent 149601f946
commit e186e7f72b
12 changed files with 198 additions and 15 deletions

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=10 format=2]
[ext_resource path="res://src/models/player/sprites/player_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/player/sprites/player_spriteframes.tres" type="SpriteFrames" id=1]
[ext_resource path="res://src/models/player/player.gd" type="Script" id=2] [ext_resource path="res://src/models/player/player.gd" type="Script" id=2]
[ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3] [ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3]
[ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=4] [ext_resource path="res://src/models/shadow/shadow.png" type="Texture" id=4]
[ext_resource path="res://src/models/player/stars/stars_spriteframes.tres" type="SpriteFrames" id=5]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 3.5, 3.5 ) extents = Vector2( 3.5, 3.5 )
@ -117,4 +118,11 @@ position = Vector2( 11, 24 )
z_index = -1 z_index = -1
texture = ExtResource( 4 ) texture = ExtResource( 4 )
[node name="Stars" type="AnimatedSprite" parent="."]
visible = false
position = Vector2( 11, 2 )
frames = ExtResource( 5 )
animation = "idle"
playing = true
[connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"] [connection signal="area_entered" from="EnemyCollision" to="." method="area_entered"]

View File

@ -1,6 +1,7 @@
[gd_resource type="SpriteFrames" load_steps=9 format=2] [gd_resource type="SpriteFrames" load_steps=14 format=2]
[ext_resource path="res://src/models/player/sprites/run.png" type="Texture" id=1] [ext_resource path="res://src/models/player/sprites/run.png" type="Texture" id=1]
[ext_resource path="res://src/models/player/sprites/stun.png" type="Texture" id=2]
[sub_resource type="AtlasTexture" id=7] [sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 1 ) atlas = ExtResource( 1 )
@ -30,6 +31,22 @@ region = Rect2( 88, 0, 22, 25 )
atlas = ExtResource( 1 ) atlas = ExtResource( 1 )
region = Rect2( 110, 0, 22, 25 ) region = Rect2( 110, 0, 22, 25 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 22, 25 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 2 )
region = Rect2( 22, 0, 22, 25 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 2 )
region = Rect2( 44, 0, 22, 25 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 2 )
region = Rect2( 66, 0, 22, 25 )
[resource] [resource]
animations = [ { animations = [ {
"frames": [ SubResource( 7 ) ], "frames": [ SubResource( 7 ) ],
@ -41,4 +58,9 @@ animations = [ {
"loop": true, "loop": true,
"name": "run", "name": "run",
"speed": 12.0 "speed": 12.0
}, {
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
"loop": true,
"name": "stun",
"speed": 6.0
} ] } ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stun.png-23b096e8d312acd6a28c91fb8ab5c222.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/player/sprites/stun.png"
dest_files=[ "res://.import/stun.png-23b096e8d312acd6a28c91fb8ab5c222.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stars.png-b2958306b49f2e13efebd45a97e5ffdb.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/models/player/stars/stars.png"
dest_files=[ "res://.import/stars.png-b2958306b49f2e13efebd45a97e5ffdb.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -0,0 +1,27 @@
[gd_resource type="SpriteFrames" load_steps=6 format=2]
[ext_resource path="res://src/models/player/stars/stars.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 22, 12 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 22, 0, 22, 12 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 44, 0, 22, 12 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 66, 0, 22, 12 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
"loop": true,
"name": "idle",
"speed": 9.0
} ]

View File

@ -1,14 +1,11 @@
[gd_scene load_steps=22 format=2] [gd_scene load_steps=25 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1] [ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2] [ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
[ext_resource path="res://src/scenes/game/spell_holder.gd" type="Script" id=3] [ext_resource path="res://src/scenes/game/spell_holder.gd" type="Script" id=3]
[ext_resource path="res://res/themes/8px.tres" type="Theme" id=4] [ext_resource path="res://res/themes/8px.tres" type="Theme" id=4]
[ext_resource path="res://src/models/player/Player.tscn" type="PackedScene" id=5] [ext_resource path="res://src/models/player/Player.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/scenes/game/sprites/health/3.png" type="Texture" id=6] [ext_resource path="res://src/scenes/game/sprites/health/health.png" type="Texture" id=6]
[ext_resource path="res://src/scenes/game/sprites/health/1.png" type="Texture" id=7]
[ext_resource path="res://src/scenes/game/sprites/health/2.png" type="Texture" id=8]
[ext_resource path="res://src/scenes/game/sprites/health/0.png" type="Texture" id=9]
[ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10] [ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10]
[ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11] [ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11]
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12] [ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
@ -23,12 +20,36 @@ extents = Vector2( 10, 60 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 140, 10.125 ) extents = Vector2( 140, 10.125 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 6 )
region = Rect2( 155, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 6 )
region = Rect2( 124, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 6 )
region = Rect2( 93, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 6 )
region = Rect2( 62, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 6 )
region = Rect2( 31, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 6 )
region = Rect2( 0, 0, 31, 11 )
[sub_resource type="SpriteFrames" id=4] [sub_resource type="SpriteFrames" id=4]
animations = [ { animations = [ {
"frames": [ ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 6 ) ], "frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": true, "loop": false,
"name": "default", "name": "idle",
"speed": 5.0 "speed": 0.0
} ] } ]
[sub_resource type="Animation" id=5] [sub_resource type="Animation" id=5]
@ -162,7 +183,7 @@ margin_bottom = 40.0
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"]
position = Vector2( 52, 148 ) position = Vector2( 52, 148 )
frames = SubResource( 4 ) frames = SubResource( 4 )
frame = 3 animation = "idle"
centered = false centered = false
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]

View File

@ -14,7 +14,7 @@ var mob_threshold = [5, 7, 10, 7]
func _ready(): func _ready():
Global.playing = true Global.playing = true
Global.play_time = 120 Global.play_time = 120
Global.health = 1 Global.health = 5
Global.add_health(0) Global.add_health(0)
func pause(): func pause():

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/health.png-aa01204bac81642585b9aa219221f4c5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/scenes/game/sprites/health/health.png"
dest_files=[ "res://.import/health.png-aa01204bac81642585b9aa219221f4c5.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -5,7 +5,7 @@ var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn")
var playing = false var playing = false
var play_time = .0 var play_time = .0
var health = 2 var health = 5
func game_start(): func game_start():
get_tree().change_scene_to(GAME_SCENE) get_tree().change_scene_to(GAME_SCENE)
@ -15,7 +15,7 @@ func return_to_menu():
get_tree().change_scene_to(MENU_SCENE) get_tree().change_scene_to(MENU_SCENE)
func add_health(amount): func add_health(amount):
health = clamp(health + amount, 0, 3) health = clamp(health + amount, 0, 5)
get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health
if health == 0: if health == 0:
playing = false playing = false