Shake Camera on Damage and Minor Fixes
parent
ac56eb0b47
commit
e53edf82a3
|
@ -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]
|
||||
|
|
|
@ -22,7 +22,7 @@ script = ExtResource( 2 )
|
|||
use_parent_material = true
|
||||
frames = ExtResource( 1 )
|
||||
animation = "idle"
|
||||
frame = 1
|
||||
frame = 2
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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))
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -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
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue