Fixed diving outside walls I guess

This commit is contained in:
Delta-key 2020-07-06 22:40:51 -03:00
parent 4316edb249
commit aa1ce8a408
5 changed files with 15 additions and 13 deletions

View file

@ -42,10 +42,13 @@ func _ready():
func _physics_process(delta):
$sprite.flip_h=false if(last_horizontal_direction==1) else true
if self.is_on_floor():
anim="idle" if abs(vectorVelocity.x)<=10 else "walk"
if state==State_dive:
anim="idle"
else:
anim="going_up" if vectorVelocity.y<0 else "goind_down"
if self.is_on_floor():
anim="idle" if abs(vectorVelocity.x)<=10 else "walk"
else:
anim="going_up" if vectorVelocity.y<0 else "goind_down"
if($animation_player.current_animation!=anim): $animation_player.play(anim)
if flag_constant_spritetrail: _create_spritetrail()

View file

@ -161,10 +161,11 @@ func _process(delta):
else:
$dive_aim/polygon_2d.color=red if $dive_aim.get_overlapping_bodies().size()>0 else green
else:
$dive_aim/polygon_2d.color=red"
$dive_aim/polygon_2d.color=red
"
[sub_resource type="RectangleShape2D" id=8]
extents = Vector2( 1, 1 )
extents = Vector2( 0.1, 0.1 )
[node name="player" type="KinematicBody2D"]
z_as_relative = false
@ -247,11 +248,10 @@ vertex_colors = PoolColorArray( 0.3, 0.3, 0.3, 0.9, 0.3, 0.3, 0.3, 0.5, 0.3, 0.3
[node name="collision_polygon_2d" type="CollisionPolygon2D" parent="dive_aim/dive_aim"]
polygon = PoolVector2Array( 0, 0, -1, -1, -1, 1 )
disabled = true
[node name="collision_shape_2d" type="CollisionShape2D" parent="dive_aim/dive_aim"]
position = Vector2( -1, 0 )
shape = SubResource( 8 )
disabled = true
[node name="position_2d" type="Position2D" parent="dive_aim/dive_aim"]

View file

@ -6,7 +6,7 @@
[sub_resource type="GDScript" id=1]
script/source = "extends BackBufferCopy
var duration=3
var strength=0.00033
var strength=0.00043
func _ready():
$twnStrength.interpolate_property($sprite.material,\"shader_param/strength\",strength,0,duration,Tween.TRANS_QUINT,Tween.EASE_OUT)
$twnStrength.interpolate_property($sprite,\"modulate:a\",0.8,0,duration,Tween.TRANS_QUINT,Tween.EASE_OUT)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://Scenes/bg_layer.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/twn_stagefadein.tscn" type="PackedScene" id=2]
@ -11,7 +11,6 @@
[ext_resource path="res://Scenes/str_stagename.tscn" type="PackedScene" id=9]
[ext_resource path="res://Scenes/grass.tscn" type="PackedScene" id=10]
[ext_resource path="res://Scenes/vine.tscn" type="PackedScene" id=11]
[ext_resource path="res://Scenes/spherizeShader.tscn" type="PackedScene" id=12]
[ext_resource path="res://Resources/SFX/Laser_shoot 6.wav" type="AudioStream" id=13]
[ext_resource path="res://Resources/spherizeShader.tres" type="Material" id=14]
@ -161,6 +160,3 @@ position = Vector2( 120, 40 )
[node name="snd_debug" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 13 )
bus = "sfx"
[node name="spriteShader" parent="." instance=ExtResource( 12 )]
position = Vector2( 164.211, 93.6844 )

View file

@ -86,6 +86,9 @@ func _process(delta):
[node name="stage" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="tilemap" type="TileMap" parent="stage"]
position = Vector2( 0, 1 )