diff --git a/res/themes/default.tres b/res/themes/default.tres index 41f81a2..f806a20 100644 --- a/res/themes/default.tres +++ b/res/themes/default.tres @@ -3,7 +3,6 @@ [ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1] [sub_resource type="DynamicFont" id=1] -size = 8 font_data = ExtResource( 1 ) [resource] diff --git a/src/models/enemies/bat/Bat.tscn b/src/models/enemies/bat/Bat.tscn index 24db929..fed6873 100644 --- a/src/models/enemies/bat/Bat.tscn +++ b/src/models/enemies/bat/Bat.tscn @@ -22,7 +22,7 @@ script = ExtResource( 2 ) use_parent_material = true frames = ExtResource( 1 ) animation = "idle" -frame = 1 +frame = 2 playing = true centered = false diff --git a/src/models/enemies/ghost/ghost.gd b/src/models/enemies/ghost/ghost.gd index 1c9d17d..dcdd6d6 100644 --- a/src/models/enemies/ghost/ghost.gd +++ b/src/models/enemies/ghost/ghost.gd @@ -34,8 +34,8 @@ func _physics_process(delta): global_position = global_position.move_toward(dash_target, 10) if global_position == dash_target: dashing = false - $AudioDash.play() afterdash = true + if afterdash: afterdash_timer += delta if afterdash_timer >= 1: diff --git a/src/models/player/player.gd b/src/models/player/player.gd index 4466554..35db92e 100644 --- a/src/models/player/player.gd +++ b/src/models/player/player.gd @@ -63,6 +63,7 @@ func area_entered(area): Global.add_health(-1) invincible = true invincibility_timer = .0 + get_tree().get_root().get_node("Game/View/Camera2D").current = true func get_recharge(): return 2.0 @@ -122,7 +123,11 @@ func _physics_process(delta): if area.get_parent().is_in_group("trash_drop"): slowed = true break + if area.get_parent().is_in_group("enemy") and not invincible: + area_entered(area) + if invincible and invincibility_timer >= 0.3: + get_tree().get_root().get_node("Game/View/Camera2D").current = false if invincible and invincibility_timer >= 0.9: invincible = false diff --git a/src/scenes/game/Game.tscn b/src/scenes/game/Game.tscn index 710326d..230dede 100644 --- a/src/scenes/game/Game.tscn +++ b/src/scenes/game/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=31 format=2] +[gd_scene load_steps=33 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] @@ -19,6 +19,8 @@ [ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17] [ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18] [ext_resource path="res://src/scenes/game/sprites/stun/stun_placeholder_spriteframes.tres" type="SpriteFrames" id=19] +[ext_resource path="res://src/scenes/game/camera.gd" type="Script" id=20] +[ext_resource path="res://src/scenes/game/sprites/shake_border.png" type="Texture" id=21] [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 10, 60 ) @@ -30,14 +32,14 @@ extents = Vector2( 140, 10.125 ) atlas = ExtResource( 6 ) region = Rect2( 155, 0, 31, 11 ) -[sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 6 ) -region = Rect2( 93, 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 ) @@ -52,10 +54,10 @@ region = Rect2( 0, 0, 31, 11 ) [sub_resource type="SpriteFrames" id=4] animations = [ { -"frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], -"loop": false, -"name": "idle", -"speed": 0.0 +"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": true, +"name": "default", +"speed": 5.0 } ] [sub_resource type="Animation" id=5] @@ -96,6 +98,11 @@ script = ExtResource( 11 ) [node name="Background" type="Node2D" parent="View"] +[node name="ShakeBorder" type="Sprite" parent="View/Background"] +texture = ExtResource( 21 ) +centered = false +offset = Vector2( -3, -3 ) + [node name="Stones" type="Sprite" parent="View/Background"] z_index = -2 texture = ExtResource( 1 ) @@ -154,9 +161,12 @@ radial_accel = 4.0 radial_accel_random = 1.0 color = Color( 0.133333, 0.133333, 0.137255, 1 ) +[node name="Camera2D" type="Camera2D" parent="View"] +position = Vector2( 160, 90 ) +script = ExtResource( 20 ) + [node name="UIWrapper" type="CanvasLayer" parent="."] layer = 3 -follow_viewport_enable = true [node name="UI" type="Control" parent="UIWrapper"] margin_right = 320.0 @@ -219,7 +229,6 @@ margin_bottom = 40.0 [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] position = Vector2( 52, 156 ) frames = SubResource( 4 ) -animation = "idle" centered = false [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] diff --git a/src/scenes/game/camera.gd b/src/scenes/game/camera.gd new file mode 100644 index 0000000..4d8ae89 --- /dev/null +++ b/src/scenes/game/camera.gd @@ -0,0 +1,6 @@ +extends Camera2D + +var shake_amount = 2 + +func _process(delta): + set_offset(Vector2(rand_range(-1.0, 1.0) * shake_amount, rand_range(-1.0, 1.0) * shake_amount)) diff --git a/src/scenes/game/sprites/shake_border.png b/src/scenes/game/sprites/shake_border.png new file mode 100644 index 0000000..7b792ab Binary files /dev/null and b/src/scenes/game/sprites/shake_border.png differ diff --git a/src/scenes/game/sprites/shake_border.png.import b/src/scenes/game/sprites/shake_border.png.import new file mode 100644 index 0000000..6c61585 --- /dev/null +++ b/src/scenes/game/sprites/shake_border.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/shake_border.png-b999b04bbadd93aa205e8f30b37b7f73.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/scenes/game/sprites/shake_border.png" +dest_files=[ "res://.import/shake_border.png-b999b04bbadd93aa205e8f30b37b7f73.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 1e0788c..8ba297b 100644 --- a/src/scripts/global.gd +++ b/src/scripts/global.gd @@ -19,6 +19,7 @@ func add_health(amount): get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health if health == 0: playing = false + get_tree().get_root().get_node("Game/View/Enemies").free() var animplayer = get_tree().get_root().get_node("Game/UIWrapper/UI/Gameover/AnimationPlayer") animplayer.play("gameover") yield(animplayer, "animation_finished")