diff --git a/src/models/player/Player.tscn b/src/models/player/Player.tscn index 044a616..982407d 100644 --- a/src/models/player/Player.tscn +++ b/src/models/player/Player.tscn @@ -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/player.gd" type="Script" id=2] [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/player/stars/stars_spriteframes.tres" type="SpriteFrames" id=5] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 3.5, 3.5 ) @@ -117,4 +118,11 @@ position = Vector2( 11, 24 ) z_index = -1 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"] diff --git a/src/models/player/sprites/player_spriteframes.tres b/src/models/player/sprites/player_spriteframes.tres index 05d506d..c6fb721 100644 --- a/src/models/player/sprites/player_spriteframes.tres +++ b/src/models/player/sprites/player_spriteframes.tres @@ -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/stun.png" type="Texture" id=2] [sub_resource type="AtlasTexture" id=7] atlas = ExtResource( 1 ) @@ -30,6 +31,22 @@ region = Rect2( 88, 0, 22, 25 ) atlas = ExtResource( 1 ) 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] animations = [ { "frames": [ SubResource( 7 ) ], @@ -41,4 +58,9 @@ animations = [ { "loop": true, "name": "run", "speed": 12.0 +}, { +"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ], +"loop": true, +"name": "stun", +"speed": 6.0 } ] diff --git a/src/models/player/sprites/stun.png b/src/models/player/sprites/stun.png new file mode 100644 index 0000000..bbae6ec Binary files /dev/null and b/src/models/player/sprites/stun.png differ diff --git a/src/models/player/sprites/stun.png.import b/src/models/player/sprites/stun.png.import new file mode 100644 index 0000000..dfd928b --- /dev/null +++ b/src/models/player/sprites/stun.png.import @@ -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 diff --git a/src/models/player/stars/stars.png b/src/models/player/stars/stars.png new file mode 100644 index 0000000..c3e149f Binary files /dev/null and b/src/models/player/stars/stars.png differ diff --git a/src/models/player/stars/stars.png.import b/src/models/player/stars/stars.png.import new file mode 100644 index 0000000..d29b3e6 --- /dev/null +++ b/src/models/player/stars/stars.png.import @@ -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 diff --git a/src/models/player/stars/stars_spriteframes.tres b/src/models/player/stars/stars_spriteframes.tres new file mode 100644 index 0000000..de4d396 --- /dev/null +++ b/src/models/player/stars/stars_spriteframes.tres @@ -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 +} ] diff --git a/src/scenes/game/Game.tscn b/src/scenes/game/Game.tscn index 69c4210..1de65bd 100644 --- a/src/scenes/game/Game.tscn +++ b/src/scenes/game/Game.tscn @@ -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/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://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/scenes/game/sprites/health/3.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/health/health.png" type="Texture" id=6] [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/sprites/ui_background.png" type="Texture" id=12] @@ -23,12 +20,36 @@ extents = Vector2( 10, 60 ) [sub_resource type="RectangleShape2D" id=3] 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] animations = [ { -"frames": [ ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 6 ) ], -"loop": true, -"name": "default", -"speed": 5.0 +"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": false, +"name": "idle", +"speed": 0.0 } ] [sub_resource type="Animation" id=5] @@ -162,7 +183,7 @@ margin_bottom = 40.0 [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] position = Vector2( 52, 148 ) frames = SubResource( 4 ) -frame = 3 +animation = "idle" centered = false [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] diff --git a/src/scenes/game/game.gd b/src/scenes/game/game.gd index c6c3895..0966f6a 100644 --- a/src/scenes/game/game.gd +++ b/src/scenes/game/game.gd @@ -14,7 +14,7 @@ var mob_threshold = [5, 7, 10, 7] func _ready(): Global.playing = true Global.play_time = 120 - Global.health = 1 + Global.health = 5 Global.add_health(0) func pause(): diff --git a/src/scenes/game/sprites/health/health.png b/src/scenes/game/sprites/health/health.png new file mode 100644 index 0000000..74740b8 Binary files /dev/null and b/src/scenes/game/sprites/health/health.png differ diff --git a/src/scenes/game/sprites/health/health.png.import b/src/scenes/game/sprites/health/health.png.import new file mode 100644 index 0000000..286c67f --- /dev/null +++ b/src/scenes/game/sprites/health/health.png.import @@ -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 diff --git a/src/scripts/global.gd b/src/scripts/global.gd index cda2a9f..9bf2152 100644 --- a/src/scripts/global.gd +++ b/src/scripts/global.gd @@ -5,7 +5,7 @@ var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn") var playing = false var play_time = .0 -var health = 2 +var health = 5 func game_start(): get_tree().change_scene_to(GAME_SCENE) @@ -15,7 +15,7 @@ func return_to_menu(): get_tree().change_scene_to(MENU_SCENE) 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 if health == 0: playing = false