Platform actor works when not being stood on.
This commit is contained in:
parent
c21818caf3
commit
7a2842b5ee
BIN
assets/elevator.png
Normal file
BIN
assets/elevator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
35
assets/elevator.png.import
Normal file
35
assets/elevator.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/elevator.png"
|
||||||
|
dest_files=[ "res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.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=true
|
||||||
|
svg/scale=1.0
|
||||||
|
|
@ -1,25 +1,82 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=13 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states2/move.gd" type="Script" id=2]
|
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states2/move.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states2/idle.gd" type="Script" id=3]
|
[ext_resource path="res://src/Actors/Platform/PlatformVMove/states2/idle.gd" type="Script" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="StreamTexture" id=1]
|
||||||
|
load_path = "res://.import/elevator.png-acbb9d6b280a7beb809eaa023b52f90b.stex"
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=2]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 0, 0, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=3]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 86, 0, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=4]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 172, 0, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=5]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 0, 44, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=6]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 86, 44, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=7]
|
||||||
|
atlas = SubResource( 1 )
|
||||||
|
region = Rect2( 172, 44, 86, 44 )
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=8]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 5.0
|
||||||
|
} ]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=9]
|
||||||
|
extents = Vector2( 38, 15.5 )
|
||||||
|
|
||||||
[node name="PlatformVMove" instance=ExtResource( 1 )]
|
[node name="PlatformVMove" instance=ExtResource( 1 )]
|
||||||
|
collision_layer = 1
|
||||||
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="." index="0"]
|
[node name="AnimatedSprite" parent="." index="0"]
|
||||||
frame = 0
|
frames = SubResource( 8 )
|
||||||
|
frame = 5
|
||||||
|
__meta__ = {
|
||||||
|
"_aseprite_wizard_config_": {
|
||||||
|
"layer": "",
|
||||||
|
"o_ex_p": "",
|
||||||
|
"o_folder": "res://assets",
|
||||||
|
"o_name": "",
|
||||||
|
"only_visible": true,
|
||||||
|
"op_exp": false,
|
||||||
|
"slice": "",
|
||||||
|
"source": "D:/Sync/Assets/Library/elevator.ase"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[node name="CollisionShape2D" parent="." index="1"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="1"]
|
||||||
position = Vector2( 0, 1 )
|
position = Vector2( 0, -3.5 )
|
||||||
|
shape = SubResource( 9 )
|
||||||
|
|
||||||
|
[node name="movement_state_machine" parent="." index="3"]
|
||||||
|
debug_state_machine = true
|
||||||
|
|
||||||
[node name="idle" parent="movement_state_machine" index="0"]
|
[node name="idle" parent="movement_state_machine" index="0"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
animation_sequence = [ ]
|
debug_state = true
|
||||||
fall_node = NodePath("")
|
timeout_seconds = 2.0
|
||||||
move_node = NodePath("")
|
move_speed = 0.0
|
||||||
|
|
||||||
[node name="move" parent="movement_state_machine" index="2"]
|
[node name="move" parent="movement_state_machine" index="2"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
animation_sequence = [ ]
|
debug_state = true
|
||||||
fall_node = NodePath("")
|
timeout_seconds = 1.0
|
||||||
idle_node = NodePath("")
|
move_speed = 30.0
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
extends StateAnimatedActor
|
extends StateAnimatedActor
|
||||||
|
|
||||||
export (NodePath) var fall_node
|
|
||||||
export (NodePath) var move_node
|
export (NodePath) var move_node
|
||||||
|
|
||||||
onready var fall_state: State = get_node(fall_node)
|
|
||||||
onready var move_state: State = get_node(move_node)
|
onready var move_state: State = get_node(move_node)
|
||||||
|
|
||||||
func enter() -> void:
|
func enter() -> void:
|
||||||
.enter()
|
.enter()
|
||||||
# parent.set_hurtbox(true)
|
# parent.set_hurtbox(true)
|
||||||
move_component.velocity.x = 0
|
|
||||||
if debug_state:
|
if debug_state:
|
||||||
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
|
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
|
||||||
|
state_timeout.start()
|
||||||
|
|
||||||
|
func process_frame(delta):
|
||||||
|
if state_timeout.time_left == 0:
|
||||||
|
return move_state
|
||||||
|
return null
|
||||||
|
|
||||||
func process_physics(delta: float) -> State:
|
func process_physics(delta: float) -> State:
|
||||||
|
|
||||||
|
|
@ -20,11 +23,4 @@ func process_physics(delta: float) -> State:
|
||||||
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
|
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
|
||||||
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
|
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
|
||||||
|
|
||||||
move_actor_as_desired(delta)
|
|
||||||
|
|
||||||
if move_component.velocity.x != 0.0:
|
|
||||||
return move_state
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
|
||||||
return fall_state
|
|
||||||
return null
|
return null
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,31 @@
|
||||||
extends StateAnimatedActor
|
extends StateAnimatedActor
|
||||||
|
|
||||||
export (NodePath) var fall_node
|
|
||||||
export (NodePath) var idle_node
|
export (NodePath) var idle_node
|
||||||
|
|
||||||
onready var fall_state: State = get_node(fall_node)
|
|
||||||
onready var idle_state: State = get_node(idle_node)
|
onready var idle_state: State = get_node(idle_node)
|
||||||
|
|
||||||
|
var flip_flop:bool = true
|
||||||
|
|
||||||
|
func enter() -> void:
|
||||||
|
.enter()
|
||||||
|
# parent.set_hurtbox(true)
|
||||||
|
if debug_state:
|
||||||
|
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
|
||||||
|
state_timeout.start()
|
||||||
|
|
||||||
|
|
||||||
func process_physics(delta: float) -> State:
|
func process_physics(delta: float) -> State:
|
||||||
|
|
||||||
move_actor_as_desired(delta)
|
if state_timeout.time_left == 0:
|
||||||
|
if flip_flop:
|
||||||
if move_component.velocity.x == 0.0:
|
move_component.velocity.y = move_speed
|
||||||
|
flip_flop = false
|
||||||
|
return idle_state
|
||||||
|
else:
|
||||||
|
move_component.velocity.y = move_speed * - 1
|
||||||
|
flip_flop = true
|
||||||
return idle_state
|
return idle_state
|
||||||
|
|
||||||
#Flip the character before tha actual move maybe.
|
move_component.velocity = parent.move_and_slide(move_component.velocity, Vector2(0, -1))
|
||||||
parent.transform.x.x = move_component.get_movement_direction()
|
|
||||||
|
|
||||||
if !parent.is_on_floor():
|
|
||||||
return fall_state
|
|
||||||
return null
|
return null
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
[gd_scene load_steps=17 format=2]
|
[gd_scene load_steps=18 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/Actors/Platform/PlatformVMove/PlatformVMove.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
|
[ext_resource path="res://assets/Tiles/Assets/Demo TileSet.tres" type="TileSet" id=2]
|
||||||
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=3]
|
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://src/Interactables/Chest.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/Interactables/Chest.tscn" type="PackedScene" id=4]
|
||||||
|
|
@ -174,3 +175,6 @@ collision_mask = 0
|
||||||
modulate = Color( 0.360784, 0.0901961, 0.0901961, 1 )
|
modulate = Color( 0.360784, 0.0901961, 0.0901961, 1 )
|
||||||
position = Vector2( 441, 283 )
|
position = Vector2( 441, 283 )
|
||||||
shape = SubResource( 6 )
|
shape = SubResource( 6 )
|
||||||
|
|
||||||
|
[node name="PlatformVMove" parent="." instance=ExtResource( 1 )]
|
||||||
|
position = Vector2( 359, 319 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user