mirror of
https://github.com/Escada-Games/diver-down.git
synced 2026-01-23 03:34:02 +00:00
Fixed emerging inside walls
This commit is contained in:
parent
aa1ce8a408
commit
cf01f940d5
2 changed files with 8 additions and 6 deletions
|
|
@ -56,11 +56,12 @@ func _physics_process(delta):
|
|||
|
||||
var vector_direction_input=Vector2(1 if Input.is_action_pressed('ui_right') else -1 if Input.is_action_pressed('ui_left') else 0, 1 if Input.is_action_pressed('ui_down') else -1 if Input.is_action_pressed('ui_up') else 0)
|
||||
last_horizontal_direction=vector_direction_input.x if vector_direction_input.x != 0 else last_horizontal_direction
|
||||
if vector_direction_input!=Vector2(): $dive_aim.rotation=vector_direction_input.angle()
|
||||
# if vector_direction_input!=Vector2(): $dive_aim.rotation=vector_direction_input.angle()
|
||||
|
||||
if self.active:
|
||||
if state==State_normal: _state_normal(delta,vector_direction_input)
|
||||
elif state==State_dive: _state_dive(delta,vector_direction_input)
|
||||
if vector_direction_input!=Vector2(): $dive_aim.rotation=vector_direction_input.angle()
|
||||
|
||||
func _state_normal(delta,vector_direction_input):
|
||||
set_collision_layer_bit(0, true)
|
||||
|
|
@ -88,7 +89,7 @@ func _state_normal(delta,vector_direction_input):
|
|||
if randf()<=0.5: $sounds/snd_dive.play()
|
||||
else: $sounds/snd_dive1.play()
|
||||
self.state=State_dive
|
||||
var cursor_position=dive_aim.get_node('position_2d').global_position-Vector2(0,1)
|
||||
var cursor_position=dive_aim.get_node('position_2d').global_position#-Vector2(0,1)
|
||||
var vector_target_position=Vector2(floor(cursor_position.x/global.tile_size.x)*global.tile_size.x,floor(cursor_position.y/global.tile_size.y)*global.tile_size.y)+global.tile_size/2
|
||||
$twn_dive.interpolate_property(self, 'global_position', self.global_position,vector_target_position, twn_duration, Tween.TRANS_QUART, Tween.EASE_OUT)
|
||||
$twn_dive.start()
|
||||
|
|
|
|||
|
|
@ -94,8 +94,9 @@ tracks/1/keys = {
|
|||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "walk"
|
||||
length = 0.4
|
||||
length = 0.6
|
||||
loop = true
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
|
|
@ -103,7 +104,7 @@ tracks/0/loop_wrap = true
|
|||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ),
|
||||
"times": PoolRealArray( 0, 0.15, 0.3, 0.45 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 2, 3, 4, 5 ]
|
||||
|
|
@ -127,7 +128,7 @@ tracks/2/loop_wrap = true
|
|||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.2 ),
|
||||
"times": PoolRealArray( 0, 0.3 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
|
|
@ -215,7 +216,7 @@ centered = false
|
|||
use_parent_material = true
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 9
|
||||
frame = 2
|
||||
frame = 4
|
||||
|
||||
[node name="timers" type="Node2D" parent="."]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue