From efacd635438a1e24a371f8f9910525291623e199 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 14:39:51 +0200 Subject: [PATCH 1/8] Fixed the random position move state --- src/Boss/SlimeBoss/SlimeBoss.tscn | 10 ++-- src/Boss/SlimeBoss/States/BossState.gd | 20 ++++++++ src/Boss/SlimeBoss/States/Charge/Sprint.gd | 23 +++++++++ src/Boss/SlimeBoss/States/FightStart.gd | 5 +- .../States/Roam/MoveToRandomPosition.gd | 21 +++++--- src/Boss/SlimeBoss/States/Roam/Wait.gd | 5 +- src/Player/Player.tscn | 6 +-- src/World.tscn | 51 ++++++++++++++++++- 8 files changed, 117 insertions(+), 24 deletions(-) create mode 100644 src/Boss/SlimeBoss/States/BossState.gd create mode 100644 src/Boss/SlimeBoss/States/Charge/Sprint.gd diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index cd64f46..6084cb4 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -477,11 +477,11 @@ one_shot = true script = ExtResource( 12 ) [node name="Sprite" type="Sprite" parent="."] -position = Vector2( 0, -28 ) -texture = ExtResource( 5 ) -vframes = 10 -hframes = 24 -frame = 2 +position = Vector2( -5, -28 ) +texture = ExtResource( 6 ) +vframes = 7 +hframes = 11 +frame = 50 [node name="Hitbox" parent="." instance=ExtResource( 2 )] visible = false diff --git a/src/Boss/SlimeBoss/States/BossState.gd b/src/Boss/SlimeBoss/States/BossState.gd new file mode 100644 index 0000000..2a6120a --- /dev/null +++ b/src/Boss/SlimeBoss/States/BossState.gd @@ -0,0 +1,20 @@ +extends "res://Overlap/StateMachine/State.gd" + +onready var animation_player = owner.get_node("AnimationPlayer") +onready var animation_tree = owner.get_node("AnimationTree") +onready var animation_playback = animation_tree.get("parameters/playback") + +var _animation_type = ANIMATION_TYPE.TREE + +enum ANIMATION_TYPE { + PLAYER, + TREE +} + +func set_animation_type(val): + print("wow") + _animation_type = val + animation_player.playback_active = _animation_type == ANIMATION_TYPE.PLAYER + animation_tree.active = _animation_type == ANIMATION_TYPE.TREE + + diff --git a/src/Boss/SlimeBoss/States/Charge/Sprint.gd b/src/Boss/SlimeBoss/States/Charge/Sprint.gd new file mode 100644 index 0000000..01f58fb --- /dev/null +++ b/src/Boss/SlimeBoss/States/Charge/Sprint.gd @@ -0,0 +1,23 @@ +extends "res://Boss/SlimeBoss/States/BossState.gd" + +export(float) var SPEED = 1000.0 + +var player_pos = owner.get_parent().get_node("Player").global_position +var direction = Vector2() + +func enter(): + # Set animation + set_animation_type(ANIMATION_TYPE.TREE) + animation_playback.play("move") + + direction = (player_pos - owner.global_position).normalized() + owner.set_particles_active(true) + +func exit(): + owner.set_particles_active(false) + +func update(delta): + owner.move_and_slide(SPEED * direction) + + if owner.get_slide_count() > 0 or owner.position.x > 1800: + emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/FightStart.gd b/src/Boss/SlimeBoss/States/FightStart.gd index b51aa26..a9fe892 100644 --- a/src/Boss/SlimeBoss/States/FightStart.gd +++ b/src/Boss/SlimeBoss/States/FightStart.gd @@ -1,7 +1,4 @@ -extends "res://Overlap/StateMachine/State.gd" - -onready var animation_player = owner.get_node("AnimationPlayer") -onready var animation_tree = owner.get_node("AnimationTree") +extends "BossState.gd" func enter(): animation_tree.active = false diff --git a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd index 16908d7..9f3870b 100644 --- a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd +++ b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd @@ -1,28 +1,35 @@ -extends "res://Overlap/StateMachine/State.gd" +extends "../BossState.gd" export(float) var ARRIVE_DISTANCE = 6.0 export(float) var SLOW_RADIUS = 200.0 -export(float) var MASS = 4.0 +export(float) var MASS = 5.0 export(float) var MAX_SPEED = 300.0 -export(float) var ROAM_RADIUS = 150.0 - +export(float) var ROAM_RADIUS = 200.0 +var time_since_start = 0 var target_position = Vector2() var start_position = Vector2() var velocity = Vector2() +var last_vel = Vector2() func enter(): + # Set animation + set_animation_type(ANIMATION_TYPE.TREE) + animation_playback.start("move") + + time_since_start = 0 start_position = get_parent().start_position target_position = calculate_new_target_position() - owner.get_node('AnimationPlayer').play('move') func update(delta): velocity = Steering.arrive_to(velocity, owner.global_position, target_position, MASS, SLOW_RADIUS, MAX_SPEED) - owner.move_and_slide(velocity) + time_since_start += delta + last_vel = owner.move_and_slide(velocity) + animation_tree.set("parameters/move/blend_position", last_vel) - if owner.global_position.distance_to(target_position) < ARRIVE_DISTANCE: + if owner.global_position.distance_to(target_position) < ARRIVE_DISTANCE or time_since_start > 2.0: emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/Roam/Wait.gd b/src/Boss/SlimeBoss/States/Roam/Wait.gd index dfc5be8..0bb9a9c 100644 --- a/src/Boss/SlimeBoss/States/Roam/Wait.gd +++ b/src/Boss/SlimeBoss/States/Roam/Wait.gd @@ -1,7 +1,8 @@ -extends "res://Overlap/StateMachine/State.gd" +extends "res://Boss/SlimeBoss/States/BossState.gd" func enter(): - owner.get_node('AnimationPlayer').play('idle') + set_animation_type(ANIMATION_TYPE.PLAYER) + # owner.get_node('AnimationPlayer').play('idle') $Timer.start() func update(delta): diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index b35f873..be52078 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -619,19 +619,17 @@ height = 0.2 radius = 4.03497 height = 9.42006 -[sub_resource type="CircleShape2D" id=51] +[sub_resource type="CircleShape2D" id=49] radius = 13.3924 [sub_resource type="DynamicFont" id=50] size = 12 font_data = ExtResource( 6 ) - [node name="Player" type="KinematicBody2D" groups=[ "hero", ]] collision_mask = 14 - script = ExtResource( 1 ) ROLL_SPEED = 120 FRICTION = 270 @@ -724,7 +722,7 @@ damage = 0.0 [node name="CollisionShape2D" parent="Pivot/SwordRange" index="0"] position = Vector2( 0, -4.56405 ) -shape = SubResource( 51 ) +shape = SubResource( 49 ) [node name="DebugLabel" type="Label" parent="."] margin_left = -8.12021 diff --git a/src/World.tscn b/src/World.tscn index beddf7c..9c0a259 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=13 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://World.gd" type="Script" id=2] @@ -8,7 +8,9 @@ [ext_resource path="res://Menus/DialogueBox/DialogueBox.tscn" type="PackedScene" id=6] [ext_resource path="res://Maps/Background/Background.tscn" type="PackedScene" id=7] [ext_resource path="res://Boss/SlimeBoss/SlimeBoss.tscn" type="PackedScene" id=8] +[ext_resource path="res://Fonts/Harmonic/Harmonic12.tres" type="DynamicFont" id=9] [ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=10] +[ext_resource path="res://Debug/BossStateDisplay.gd" type="Script" id=11] [ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18] [node name="World" type="Node2D"] @@ -21,7 +23,7 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 20 +frame = 50 [node name="FloorTileMap" type="TileMap" parent="."] visible = false @@ -45,6 +47,7 @@ position = Vector2( 265.543, -16 ) [node name="Player" parent="YSort" instance=ExtResource( 1 )] position = Vector2( 344, 125.768 ) scale = Vector2( 2, 2 ) +debug = true ROLL_SPEED = 140 FRICTION = 200 @@ -59,3 +62,47 @@ position = Vector2( 104, 80 ) visible = false [node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] + +[node name="DebugLabel" type="Control" parent="CanvasLayer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BossStateDisplay" type="Panel" parent="CanvasLayer/DebugLabel"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -80.0 +margin_bottom = 50.0 +script = ExtResource( 11 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/DebugLabel/BossStateDisplay"] +margin_right = 40.0 +margin_bottom = 40.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" type="Label" parent="CanvasLayer/DebugLabel/BossStateDisplay/VBoxContainer"] +margin_right = 40.0 +margin_bottom = 12.0 +custom_fonts/font = ExtResource( 9 ) +text = "Boss" + +[node name="Phase" type="Label" parent="CanvasLayer/DebugLabel/BossStateDisplay/VBoxContainer"] +margin_top = 16.0 +margin_right = 40.0 +margin_bottom = 28.0 +custom_fonts/font = ExtResource( 9 ) + +[node name="State" type="Label" parent="CanvasLayer/DebugLabel/BossStateDisplay/VBoxContainer"] +margin_top = 32.0 +margin_right = 40.0 +margin_bottom = 44.0 +custom_fonts/font = ExtResource( 9 ) +[connection signal="phase_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_phase_changed"] +[connection signal="state_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_state_changed"] From 75a5130121c65e298f76d822a7600f1a32cc7581 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 17:52:21 +0200 Subject: [PATCH 2/8] Progress on the boss --- src/Boss/SlimeBoss/SlimeBoss.tscn | 546 +++++++++++++++--- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 73 ++- src/Boss/SlimeBoss/States/BossState.gd | 50 +- src/Boss/SlimeBoss/States/Charge/Prepare.gd | 17 +- src/Boss/SlimeBoss/States/Charge/Sprint.gd | 14 +- src/Boss/SlimeBoss/States/FightStart.gd | 2 - src/Boss/SlimeBoss/States/ReturnToCenter.gd | 21 + .../States/Roam/MoveToRandomPosition.gd | 17 +- src/Boss/SlimeBoss/States/Stomp.gd | 18 + src/Boss/SlimeBoss/States/{Roam => }/Wait.gd | 2 - src/Effects/Charge/ChargeEffect.tscn | 20 + src/Effects/Charge/charge.png | Bin 0 -> 143 bytes src/Effects/Charge/charge.png.import | 34 ++ src/Overlap/Stats/Stats.gd | 3 + src/World.tscn | 6 +- 15 files changed, 671 insertions(+), 152 deletions(-) create mode 100644 src/Boss/SlimeBoss/States/ReturnToCenter.gd create mode 100644 src/Boss/SlimeBoss/States/Stomp.gd rename src/Boss/SlimeBoss/States/{Roam => }/Wait.gd (66%) create mode 100644 src/Effects/Charge/ChargeEffect.tscn create mode 100644 src/Effects/Charge/charge.png create mode 100644 src/Effects/Charge/charge.png.import diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index 6084cb4..585d874 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=31 format=2] +[gd_scene load_steps=36 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2] @@ -7,13 +7,22 @@ [ext_resource path="res://Boss/SlimeBoss/Animations/move_down.png" type="Texture" id=5] [ext_resource path="res://Boss/SlimeBoss/Animations/move_right.png" type="Texture" id=6] [ext_resource path="res://Boss/SlimeBoss/States/Roam/RoamSequence.gd" type="Script" id=7] -[ext_resource path="res://Boss/SlimeBoss/States/Roam/Wait.gd" type="Script" id=8] +[ext_resource path="res://Boss/SlimeBoss/States/Wait.gd" type="Script" id=8] [ext_resource path="res://Boss/SlimeBoss/States/FightStart.gd" type="Script" id=9] [ext_resource path="res://Boss/SlimeBoss/Animations/move_down_angry.png" type="Texture" id=10] [ext_resource path="res://Boss/SlimeBoss/Animations/move_up.png" type="Texture" id=11] [ext_resource path="res://Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd" type="Script" id=12] [ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=13] [ext_resource path="res://Boss/SlimeBoss/HeroCloseZone.gd" type="Script" id=14] +[ext_resource path="res://Overlap/StateMachine/SequenceState.gd" type="Script" id=15] +[ext_resource path="res://Boss/SlimeBoss/States/Charge/Prepare.gd" type="Script" id=16] +[ext_resource path="res://Boss/SlimeBoss/States/Charge/Sprint.gd" type="Script" id=17] +[ext_resource path="res://Effects/Charge/ChargeEffect.tscn" type="PackedScene" id=18] +[ext_resource path="res://Boss/SlimeBoss/States/ReturnToCenter.gd" type="Script" id=19] +[ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20] + +[sub_resource type="CircleShape2D" id=15] +radius = 60.0 [sub_resource type="CapsuleShape2D" id=1] radius = 18.0 @@ -31,7 +40,391 @@ radius = 8.0 height = 32.0 [sub_resource type="Animation" id=5] -resource_name = "FightStart" +resource_name = "ChargeDown" +length = 0.45 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.45 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ ExtResource( 5 ), ExtResource( 5 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 10 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 24 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ Vector2( 0, -28 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] +} + +[sub_resource type="Animation" id=6] +resource_name = "ChargeLeft" +length = 0.45 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.45 ), +"transitions": PoolRealArray( 2, 2 ), +"update": 0, +"values": [ ExtResource( 6 ), ExtResource( 6 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 7 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 11 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ Vector2( 5, -28 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] +} + +[sub_resource type="Animation" id=7] +resource_name = "ChargeRight" +length = 0.45 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.45 ), +"transitions": PoolRealArray( 2, 2 ), +"update": 0, +"values": [ ExtResource( 6 ), ExtResource( 6 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 7 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 11 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ Vector2( -5, -28 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] +} + +[sub_resource type="Animation" id=8] +resource_name = "ChargeUp" +length = 0.45 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.45 ), +"transitions": PoolRealArray( 36.7583, 36.7583 ), +"update": 0, +"values": [ ExtResource( 11 ), ExtResource( 11 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 7 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 11 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ Vector2( 0, -28 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] +} + +[sub_resource type="Animation" id=9] +resource_name = "Charging" +length = 1.9 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.175, 0.3, 0.65, 0.775, 1.05, 1.9 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ ExtResource( 5 ), ExtResource( 10 ), ExtResource( 5 ), ExtResource( 10 ), ExtResource( 5 ), ExtResource( 10 ), ExtResource( 5 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 10 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 24 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ Vector2( 0, -28 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.675, 0.7, 0.725, 0.75, 0.775, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.95, 0.975, 1, 1.025, 1.05, 1.075, 1.1, 1.125, 1.15, 1.175, 1.2, 1.225, 1.25, 1.275, 1.3, 1.325, 1.35, 1.375, 1.4, 1.425, 1.45, 1.475, 1.5, 1.525, 1.55, 1.575, 1.6, 1.625, 1.65, 1.675, 1.7, 1.725, 1.75, 1.775, 1.8, 1.825, 1.85, 1.875 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] +} + +[sub_resource type="Animation" id=10] length = 1.9 step = 0.025 tracks/0/type = "value" @@ -107,9 +500,8 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } -[sub_resource type="Animation" id=6] +[sub_resource type="Animation" id=11] length = 2.66666 -loop = true step = 0.0111111 tracks/0/type = "value" tracks/0/path = NodePath("Sprite:frame") @@ -130,10 +522,10 @@ tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ ExtResource( 5 ) ] +"times": PoolRealArray( 0, 2.66666 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ ExtResource( 5 ), ExtResource( 5 ) ] } tracks/2/type = "value" tracks/2/path = NodePath("Sprite:vframes") @@ -184,9 +576,8 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=7] +[sub_resource type="Animation" id=12] length = 1.28333 -loop = true step = 0.0166667 tracks/0/type = "value" tracks/0/path = NodePath("Sprite:frame") @@ -207,10 +598,10 @@ tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ ExtResource( 6 ) ] +"times": PoolRealArray( 0, 1.28333 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ ExtResource( 6 ), ExtResource( 6 ) ] } tracks/2/type = "value" tracks/2/path = NodePath("Sprite:vframes") @@ -261,9 +652,8 @@ tracks/5/keys = { "values": [ true ] } -[sub_resource type="Animation" id=8] +[sub_resource type="Animation" id=13] length = 1.28333 -loop = true step = 0.0166667 tracks/0/type = "value" tracks/0/path = NodePath("Sprite:frame") @@ -284,10 +674,10 @@ tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ ExtResource( 6 ) ] +"times": PoolRealArray( 0, 1.28334 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ ExtResource( 6 ), ExtResource( 6 ) ] } tracks/2/type = "value" tracks/2/path = NodePath("Sprite:vframes") @@ -338,9 +728,8 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=9] +[sub_resource type="Animation" id=14] length = 1.28333 -loop = true step = 0.0166667 tracks/0/type = "value" tracks/0/path = NodePath("Sprite:texture") @@ -349,10 +738,10 @@ tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { -"times": PoolRealArray( 0 ), -"transitions": PoolRealArray( 1 ), -"update": 1, -"values": [ ExtResource( 11 ) ] +"times": PoolRealArray( 0, 1.28334 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ ExtResource( 11 ), ExtResource( 11 ) ] } tracks/1/type = "value" tracks/1/path = NodePath("Sprite:vframes") @@ -415,37 +804,6 @@ tracks/5/keys = { "values": [ Vector2( 0, -28 ) ] } -[sub_resource type="AnimationNodeAnimation" id=10] -animation = "MoveRight" - -[sub_resource type="AnimationNodeAnimation" id=11] -animation = "MoveUp" - -[sub_resource type="AnimationNodeAnimation" id=12] -animation = "MoveDown" - -[sub_resource type="AnimationNodeAnimation" id=13] -animation = "MoveLeft" - -[sub_resource type="AnimationNodeBlendSpace2D" id=14] -blend_point_0/node = SubResource( 10 ) -blend_point_0/pos = Vector2( 1, 0 ) -blend_point_1/node = SubResource( 11 ) -blend_point_1/pos = Vector2( 0, -1.1 ) -blend_point_2/node = SubResource( 12 ) -blend_point_2/pos = Vector2( 0, 1.1 ) -blend_point_3/node = SubResource( 13 ) -blend_point_3/pos = Vector2( -1, 0 ) -min_space = Vector2( -1, -1.1 ) -max_space = Vector2( 1, 1.1 ) -blend_mode = 1 - -[sub_resource type="AnimationNodeStateMachine" id=15] -states/move/node = SubResource( 14 ) -states/move/position = Vector2( 143, 70 ) - -[sub_resource type="AnimationNodeStateMachinePlayback" id=16] - [node name="SlimeBoss" type="KinematicBody2D"] collision_layer = 4 collision_mask = 3 @@ -456,6 +814,12 @@ __meta__ = { [node name="Kind" parent="." instance=ExtResource( 13 )] +[node name="Effects" type="Node2D" parent="."] + +[node name="ChargeEffect" parent="Effects" instance=ExtResource( 18 )] +position = Vector2( 0, -8 ) +emitting = false + [node name="Stats" parent="." instance=ExtResource( 3 )] max_health = 3 @@ -476,15 +840,49 @@ one_shot = true [node name="MoveToRandomPosition" type="Node" parent="States/RoamSequence"] script = ExtResource( 12 ) +[node name="Timer" type="Timer" parent="States/RoamSequence/MoveToRandomPosition"] +one_shot = true + +[node name="ChargeSequence" type="Node" parent="States"] +script = ExtResource( 15 ) + +[node name="Charge" type="Node" parent="States/ChargeSequence"] +script = ExtResource( 16 ) + +[node name="Timer" type="Timer" parent="States/ChargeSequence/Charge"] +wait_time = 0.8 +one_shot = true + +[node name="Sprint" type="Node" parent="States/ChargeSequence"] +script = ExtResource( 17 ) + +[node name="Wait" type="Node" parent="States/ChargeSequence"] +script = ExtResource( 8 ) + +[node name="Timer" type="Timer" parent="States/ChargeSequence/Wait"] +wait_time = 0.25 +one_shot = true + +[node name="ReturnToCenter" type="Node" parent="States"] +script = ExtResource( 19 ) + +[node name="Stomp" type="Node" parent="States"] +script = ExtResource( 20 ) + [node name="Sprite" type="Sprite" parent="."] -position = Vector2( -5, -28 ) +position = Vector2( 5, -28 ) texture = ExtResource( 6 ) +flip_h = true vframes = 7 hframes = 11 -frame = 50 + +[node name="StompHitbox" parent="." instance=ExtResource( 2 )] + +[node name="CollisionShape2D" parent="StompHitbox" index="0"] +shape = SubResource( 15 ) +disabled = true [node name="Hitbox" parent="." instance=ExtResource( 2 )] -visible = false collision_layer = 4 [node name="CollisionShape2D" parent="Hitbox" index="0"] @@ -512,6 +910,7 @@ rotation = 1.5708 shape = SubResource( 4 ) [node name="DebugLabel" type="Label" parent="."] +visible = false margin_left = -42.2456 margin_top = -65.04 margin_right = 42.7544 @@ -523,22 +922,23 @@ __meta__ = { [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "MoveRight" -anims/FightStart = SubResource( 5 ) -anims/MoveDown = SubResource( 6 ) -anims/MoveLeft = SubResource( 7 ) -anims/MoveRight = SubResource( 8 ) -anims/MoveUp = SubResource( 9 ) - -[node name="AnimationTree" type="AnimationTree" parent="."] -tree_root = SubResource( 15 ) -anim_player = NodePath("../AnimationPlayer") -active = true -parameters/playback = SubResource( 16 ) -parameters/move/blend_position = Vector2( 0.210872, 0.275 ) +anims/ChargeDown = SubResource( 5 ) +anims/ChargeLeft = SubResource( 6 ) +anims/ChargeRight = SubResource( 7 ) +anims/ChargeUp = SubResource( 8 ) +anims/Charging = SubResource( 9 ) +anims/FightStart = SubResource( 10 ) +anims/MoveDown = SubResource( 11 ) +anims/MoveLeft = SubResource( 12 ) +anims/MoveRight = SubResource( 13 ) +anims/MoveUp = SubResource( 14 ) +[connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] [connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"] [connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"] +[editable path="StompHitbox"] + [editable path="Hitbox"] [editable path="Hurtbox"] diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index 8339fd4..51479b2 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -1,6 +1,5 @@ extends KinematicBody2D -onready var animation_playback = $AnimationTree.get("parameters/playback") signal target_position_changed signal state_changed(new_state_name) signal phase_changed(new_phase_name) @@ -8,7 +7,7 @@ signal phase_changed(new_phase_name) export(float) var MASS = 8.0 onready var start_global_position = global_position -var target_position = Vector2() +var last_look = Vector2() var state_active = null var sequence_cycles = 0 @@ -26,7 +25,7 @@ func _ready(): if get_parent().has_node('Player'): var player_node = get_parent().get_node('Player') player_node.connect('position_changed', self, '_on_target_position_changed') - target_position = player_node.global_position + # target_position = player_node.global_position for state_node in $States.get_children(): state_node.connect('finished', self, '_on_active_state_finished') @@ -51,6 +50,15 @@ func _on_Stats_no_health(): set_invincible(true) go_to_next_state($States/Die) +func _on_Stats_health_changed(new_health): + assert(new_health > -1) + assert(new_health < $Stats.max_health) + + if _phase == PHASES.PHASE_ONE and new_health == 2: + _change_phase(PHASES.PHASE_TWO) + if _phase == PHASES.PHASE_TWO and new_health == 1: + _change_phase(PHASES.PHASE_THREE) + func go_to_next_state(state_override=null): if state_active: @@ -63,18 +71,6 @@ func go_to_next_state(state_override=null): emit_signal("state_changed", state_active.name) state_active.enter() - -func _on_Health_health_changed(new_health): - $Tween.interpolate_property($Pivot, 'scale', Vector2(0.92, 1.12), Vector2(1.0, 1.0), 0.3, Tween.TRANS_ELASTIC, Tween.EASE_IN_OUT) - $Tween.interpolate_property($Pivot/Body, 'modulate', Color('#ff48de'), Color('#ffffff'), 0.2, Tween.TRANS_QUINT, Tween.EASE_IN) - $Tween.start() - - if _phase == PHASES.PHASE_ONE and new_health < 100: - _change_phase(PHASES.PHASE_TWO) - if _phase == PHASES.PHASE_TWO and new_health < 50: - _change_phase(PHASES.PHASE_THREE) - - func _change_phase(new_phase): var phase_name = "" match new_phase: @@ -92,20 +88,35 @@ func _change_phase(new_phase): _phase = new_phase -# The AI's brain. This function defines the flow of states -# That's a big advantage of the state pattern -# If it grows too big you can swap it with a node -# Or move the flow of states to a data file, like JSON or a text file +var angry_phases_done = 0 + func _decide_on_next_state(): # Battle start if state_active == null: set_invincible(true) return $States/FightStart if state_active == $States/FightStart: - set_invincible(false) - return $States/RoamSequence - if state_active == $States/RoamSequence: - return $States/FightStart + # set_invincible(false) + return $States/ChargeSequence + + if _phase == PHASES.PHASE_ONE: + if angry_phases_done < 1: + set_invincible(true) + sequence_cycles += 1 + if sequence_cycles < 4: + return $States/ChargeSequence + else: + angry_phases_done = 1 + sequence_cycles = 0 + return $States/ReturnToCenter + else: + if state_active == $States/ReturnToCenter: + return $States/Stomp # TODO: Maybe Stomp. + if state_active == $States/Stomp: + set_invincible(false) + return $States/RoamSequence + if state_active == $States/RoamSequence: + return $States/RoamSequence # # Death # if state_active == $States/Die: @@ -159,23 +170,11 @@ func _decide_on_next_state(): # return $States/Stomp -# Using a public method makes it so we can change the entire particle setup anytime -func set_particles_active(value): - $DustPuffsLarge.emitting = value - - -# Same thing here, we will likely need more collision shapes in the final version -# So using a function we can group these disabled toggles together func set_invincible(value): - $CollisionShape2D.disabled = value - $Hitbox/CollisionShape2D.disabled = value + # $CollisionShape2D.disabled = value + # $Hitbox/CollisionShape2D.disabled = value $Hurtbox/CollisionShape2D.disabled = value - -func _on_target_position_changed(new_position): - target_position = new_position - - func _on_Hurtbox_area_entered(area): $Stats.health -= area.damage diff --git a/src/Boss/SlimeBoss/States/BossState.gd b/src/Boss/SlimeBoss/States/BossState.gd index 2a6120a..4486d0d 100644 --- a/src/Boss/SlimeBoss/States/BossState.gd +++ b/src/Boss/SlimeBoss/States/BossState.gd @@ -1,20 +1,42 @@ extends "res://Overlap/StateMachine/State.gd" onready var animation_player = owner.get_node("AnimationPlayer") -onready var animation_tree = owner.get_node("AnimationTree") -onready var animation_playback = animation_tree.get("parameters/playback") -var _animation_type = ANIMATION_TYPE.TREE - -enum ANIMATION_TYPE { - PLAYER, - TREE -} - -func set_animation_type(val): - print("wow") - _animation_type = val - animation_player.playback_active = _animation_type == ANIMATION_TYPE.PLAYER - animation_tree.active = _animation_type == ANIMATION_TYPE.TREE +func play_directional_animation(name, vec): + var anim_name = name + get_nearest_diretion(vec) + if animation_player.current_animation != anim_name: + animation_player.play(anim_name) +func get_base_anim_name(name): + var base_name = name[0] + for i in range(1, len(name)): + if name[i] == name[i].to_upper(): + return base_name + + base_name += name[i] + +func get_nearest_diretion(vec): + var directions = { + "Up": Vector2(0, -1.1), + "Down": Vector2(0, 1.1), + "Left": Vector2(-1.0, 0), + "Right": Vector2(1.0, 0) + } + + var nearest_direction = "Left" + var smallest_distance = 999999999 + + for direction in directions.keys(): + var vector = directions.get(direction) + var distance = vec.distance_to(vector) + + if distance < smallest_distance: + nearest_direction = direction + smallest_distance = distance + + return nearest_direction + + + + diff --git a/src/Boss/SlimeBoss/States/Charge/Prepare.gd b/src/Boss/SlimeBoss/States/Charge/Prepare.gd index d616208..ba0fe4e 100644 --- a/src/Boss/SlimeBoss/States/Charge/Prepare.gd +++ b/src/Boss/SlimeBoss/States/Charge/Prepare.gd @@ -1,7 +1,16 @@ -extends "res://Overlap/StateMachine/State.gd" +extends "res://Boss/SlimeBoss/States/BossState.gd" + +onready var charge_effect = owner.get_node("Effects/ChargeEffect") func enter(): - owner.get_node('AnimationPlayer').play('prepare') + charge_effect.emitting = true + animation_player.play('Charging') + $Timer.start() -func _on_animation_finished(anim_name): - emit_signal('finished') +func exit(): + charge_effect.emitting = false + $Timer.stop() + +func update(delta): + if $Timer.time_left <= 0.0: + emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/Charge/Sprint.gd b/src/Boss/SlimeBoss/States/Charge/Sprint.gd index 01f58fb..bd81bfd 100644 --- a/src/Boss/SlimeBoss/States/Charge/Sprint.gd +++ b/src/Boss/SlimeBoss/States/Charge/Sprint.gd @@ -1,23 +1,19 @@ extends "res://Boss/SlimeBoss/States/BossState.gd" -export(float) var SPEED = 1000.0 +export(float) var SPEED = 800.0 -var player_pos = owner.get_parent().get_node("Player").global_position var direction = Vector2() func enter(): - # Set animation - set_animation_type(ANIMATION_TYPE.TREE) - animation_playback.play("move") - + var player_pos = owner.get_parent().get_node("Player").global_position direction = (player_pos - owner.global_position).normalized() - owner.set_particles_active(true) func exit(): - owner.set_particles_active(false) + owner.last_look = direction func update(delta): - owner.move_and_slide(SPEED * direction) + var last_vel = owner.move_and_slide(SPEED * direction) + play_directional_animation("Move", last_vel) if owner.get_slide_count() > 0 or owner.position.x > 1800: emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/FightStart.gd b/src/Boss/SlimeBoss/States/FightStart.gd index a9fe892..a456fd1 100644 --- a/src/Boss/SlimeBoss/States/FightStart.gd +++ b/src/Boss/SlimeBoss/States/FightStart.gd @@ -1,8 +1,6 @@ extends "BossState.gd" func enter(): - animation_tree.active = false - animation_player.playback_active = true animation_player.play('FightStart') func _on_animation_finished(anim_name): diff --git a/src/Boss/SlimeBoss/States/ReturnToCenter.gd b/src/Boss/SlimeBoss/States/ReturnToCenter.gd new file mode 100644 index 0000000..2bdd65d --- /dev/null +++ b/src/Boss/SlimeBoss/States/ReturnToCenter.gd @@ -0,0 +1,21 @@ +extends "res://Boss/SlimeBoss/States/BossState.gd" + +export(float) var MASS = 4.0 +export(float) var SLOW_RADIUS = 200.0 +export(float) var MAX_SPEED = 300.0 +export(float) var ARRIVE_DISTANCE = 6.0 + +var velocity = Vector2.ZERO +var center = Vector2.ZERO + +func update(delta): + velocity = Steering.arrive_to(velocity, + owner.global_position, + owner.start_global_position, + MASS, + SLOW_RADIUS, + MAX_SPEED) + play_directional_animation("Move", velocity) + owner.move_and_slide(velocity) + if owner.global_position.distance_to(owner.start_global_position) < ARRIVE_DISTANCE: + emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd index 9f3870b..9e0db85 100644 --- a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd +++ b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd @@ -14,22 +14,23 @@ var velocity = Vector2() var last_vel = Vector2() func enter(): - # Set animation - set_animation_type(ANIMATION_TYPE.TREE) - animation_playback.start("move") - - time_since_start = 0 start_position = get_parent().start_position target_position = calculate_new_target_position() + $Timer.start() + +func exit(): + owner.last_look = last_vel + $Timer.stop() func update(delta): + # Set animation velocity = Steering.arrive_to(velocity, owner.global_position, target_position, MASS, SLOW_RADIUS, MAX_SPEED) - time_since_start += delta last_vel = owner.move_and_slide(velocity) - animation_tree.set("parameters/move/blend_position", last_vel) - if owner.global_position.distance_to(target_position) < ARRIVE_DISTANCE or time_since_start > 2.0: + play_directional_animation("Move", last_vel) + + if owner.global_position.distance_to(target_position) < ARRIVE_DISTANCE or $Timer.time_left <= 0.0: emit_signal('finished') diff --git a/src/Boss/SlimeBoss/States/Stomp.gd b/src/Boss/SlimeBoss/States/Stomp.gd new file mode 100644 index 0000000..963acc6 --- /dev/null +++ b/src/Boss/SlimeBoss/States/Stomp.gd @@ -0,0 +1,18 @@ +extends "res://Boss/SlimeBoss/States/BossState.gd" + +onready var stomp_hitbox = owner.get_node("StompHitbox/CollisionShape2D") + +func enter(): + stomp_hitbox.disabled = false + +func exit(): + stomp_hitbox.disabled = true + +func update(delta): + play_directional_animation("Charge", owner.last_look) + +func _on_animation_finished(anim_name): + anim_name = get_base_anim_name(anim_name) + assert(anim_name == "Charge") + + emit_signal("finished") diff --git a/src/Boss/SlimeBoss/States/Roam/Wait.gd b/src/Boss/SlimeBoss/States/Wait.gd similarity index 66% rename from src/Boss/SlimeBoss/States/Roam/Wait.gd rename to src/Boss/SlimeBoss/States/Wait.gd index 0bb9a9c..06f57bf 100644 --- a/src/Boss/SlimeBoss/States/Roam/Wait.gd +++ b/src/Boss/SlimeBoss/States/Wait.gd @@ -1,8 +1,6 @@ extends "res://Boss/SlimeBoss/States/BossState.gd" func enter(): - set_animation_type(ANIMATION_TYPE.PLAYER) - # owner.get_node('AnimationPlayer').play('idle') $Timer.start() func update(delta): diff --git a/src/Effects/Charge/ChargeEffect.tscn b/src/Effects/Charge/ChargeEffect.tscn new file mode 100644 index 0000000..7ceec79 --- /dev/null +++ b/src/Effects/Charge/ChargeEffect.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Effects/Charge/charge.png" type="Texture" id=1] + +[sub_resource type="ParticlesMaterial" id=1] +emission_shape = 2 +emission_box_extents = Vector3( 50, 20, 1 ) +flag_disable_z = true +gravity = Vector3( 0, -40, 0 ) +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +tangential_accel = 80.0 +scale = 0.1 +scale_random = 1.0 + +[node name="ChargeEffect" type="Particles2D"] +amount = 20 +lifetime = 0.8 +process_material = SubResource( 1 ) +texture = ExtResource( 1 ) diff --git a/src/Effects/Charge/charge.png b/src/Effects/Charge/charge.png new file mode 100644 index 0000000000000000000000000000000000000000..5621cd59b77cdd0feaff9471ffe0d98b4a5f473c GIT binary patch literal 143 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|JUv|;LnNm5 z_B(Pl7zi+{?>jF4<-v8`8{#+qAL-`KUU+GzA4g}!#$2IEEDI*AEn_&fvEF%G?cD9@ q8EfQj{(BOoa4juq!=^cRYZxjlOcp;eJ0K1;l)=;0&t;ucLK6Vy$};5u literal 0 HcmV?d00001 diff --git a/src/Effects/Charge/charge.png.import b/src/Effects/Charge/charge.png.import new file mode 100644 index 0000000..4d791f9 --- /dev/null +++ b/src/Effects/Charge/charge.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/charge.png-ac36c6bab3ea421fea437d8d775673a9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Effects/Charge/charge.png" +dest_files=[ "res://.import/charge.png-ac36c6bab3ea421fea437d8d775673a9.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 +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/src/Overlap/Stats/Stats.gd b/src/Overlap/Stats/Stats.gd index c651303..3501e89 100644 --- a/src/Overlap/Stats/Stats.gd +++ b/src/Overlap/Stats/Stats.gd @@ -7,6 +7,7 @@ export(float) var max_speed := 125.0 onready var speed := max_speed setget set_speed signal no_health +signal health_changed func set_health(value): if value > max_health: @@ -15,6 +16,8 @@ func set_health(value): health = value if health < 1: emit_signal("no_health") + + emit_signal("health_changed", health) func set_speed(value): if value > max_speed: diff --git a/src/World.tscn b/src/World.tscn index 9c0a259..56ca9d2 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -23,7 +23,7 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 50 +frame = 5 [node name="FloorTileMap" type="TileMap" parent="."] visible = false @@ -45,14 +45,14 @@ __meta__ = { position = Vector2( 265.543, -16 ) [node name="Player" parent="YSort" instance=ExtResource( 1 )] -position = Vector2( 344, 125.768 ) +position = Vector2( 432, 168 ) scale = Vector2( 2, 2 ) debug = true ROLL_SPEED = 140 FRICTION = 200 [node name="SlimeBoss" parent="YSort" instance=ExtResource( 8 )] -position = Vector2( 104, 80 ) +position = Vector2( 240, 120 ) [node name="Grid" parent="." instance=ExtResource( 18 )] From 400f18c37b1fc93b555985524114f9117d6cdec9 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 18:17:54 +0200 Subject: [PATCH 3/8] Added more boss state machine --- src/Boss/SlimeBoss/SlimeBoss.tscn | 73 ++++++++++----------- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 30 ++++++++- src/World.tscn | 2 +- 3 files changed, 62 insertions(+), 43 deletions(-) diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index 585d874..bbdf2c1 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -21,26 +21,23 @@ [ext_resource path="res://Boss/SlimeBoss/States/ReturnToCenter.gd" type="Script" id=19] [ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20] -[sub_resource type="CircleShape2D" id=15] +[sub_resource type="CircleShape2D" id=1] radius = 60.0 -[sub_resource type="CapsuleShape2D" id=1] -radius = 18.0 -height = 18.0 +[sub_resource type="CircleShape2D" id=17] +radius = 16.0312 -[sub_resource type="CapsuleShape2D" id=2] -radius = 18.0 -height = 18.0 +[sub_resource type="CircleShape2D" id=16] +radius = 24.0208 -[sub_resource type="CircleShape2D" id=3] +[sub_resource type="CircleShape2D" id=4] radius = 150.0 -[sub_resource type="CapsuleShape2D" id=4] +[sub_resource type="CapsuleShape2D" id=5] radius = 8.0 height = 32.0 -[sub_resource type="Animation" id=5] -resource_name = "ChargeDown" +[sub_resource type="Animation" id=6] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -116,8 +113,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=6] -resource_name = "ChargeLeft" +[sub_resource type="Animation" id=7] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -193,8 +189,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=7] -resource_name = "ChargeRight" +[sub_resource type="Animation" id=8] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -270,8 +265,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=8] -resource_name = "ChargeUp" +[sub_resource type="Animation" id=9] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -347,8 +341,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=9] -resource_name = "Charging" +[sub_resource type="Animation" id=10] length = 1.9 step = 0.025 tracks/0/type = "value" @@ -424,7 +417,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } -[sub_resource type="Animation" id=10] +[sub_resource type="Animation" id=11] length = 1.9 step = 0.025 tracks/0/type = "value" @@ -500,7 +493,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } -[sub_resource type="Animation" id=11] +[sub_resource type="Animation" id=12] length = 2.66666 step = 0.0111111 tracks/0/type = "value" @@ -576,7 +569,7 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=12] +[sub_resource type="Animation" id=13] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -652,7 +645,7 @@ tracks/5/keys = { "values": [ true ] } -[sub_resource type="Animation" id=13] +[sub_resource type="Animation" id=14] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -728,7 +721,7 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=14] +[sub_resource type="Animation" id=15] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -806,7 +799,7 @@ tracks/5/keys = { [node name="SlimeBoss" type="KinematicBody2D"] collision_layer = 4 -collision_mask = 3 +collision_mask = 2 script = ExtResource( 4 ) __meta__ = { "_edit_group_": true @@ -879,7 +872,7 @@ hframes = 11 [node name="StompHitbox" parent="." instance=ExtResource( 2 )] [node name="CollisionShape2D" parent="StompHitbox" index="0"] -shape = SubResource( 15 ) +shape = SubResource( 1 ) disabled = true [node name="Hitbox" parent="." instance=ExtResource( 2 )] @@ -887,7 +880,7 @@ collision_layer = 4 [node name="CollisionShape2D" parent="Hitbox" index="0"] position = Vector2( 0, -15 ) -shape = SubResource( 1 ) +shape = SubResource( 17 ) [node name="Hurtbox" parent="." instance=ExtResource( 1 )] collision_layer = 4 @@ -895,19 +888,19 @@ collision_mask = 0 [node name="CollisionShape2D" parent="Hurtbox" index="0"] position = Vector2( 0, -15 ) -shape = SubResource( 2 ) +shape = SubResource( 16 ) [node name="HeroCloseZone" type="Area2D" parent="."] collision_layer = 0 script = ExtResource( 14 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="HeroCloseZone"] -shape = SubResource( 3 ) +shape = SubResource( 4 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( -1.52588e-05, 0 ) rotation = 1.5708 -shape = SubResource( 4 ) +shape = SubResource( 5 ) [node name="DebugLabel" type="Label" parent="."] visible = false @@ -922,16 +915,16 @@ __meta__ = { [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "MoveRight" -anims/ChargeDown = SubResource( 5 ) -anims/ChargeLeft = SubResource( 6 ) -anims/ChargeRight = SubResource( 7 ) -anims/ChargeUp = SubResource( 8 ) -anims/Charging = SubResource( 9 ) -anims/FightStart = SubResource( 10 ) -anims/MoveDown = SubResource( 11 ) -anims/MoveLeft = SubResource( 12 ) -anims/MoveRight = SubResource( 13 ) -anims/MoveUp = SubResource( 14 ) +anims/ChargeDown = SubResource( 6 ) +anims/ChargeLeft = SubResource( 7 ) +anims/ChargeRight = SubResource( 8 ) +anims/ChargeUp = SubResource( 9 ) +anims/Charging = SubResource( 10 ) +anims/FightStart = SubResource( 11 ) +anims/MoveDown = SubResource( 12 ) +anims/MoveLeft = SubResource( 13 ) +anims/MoveRight = SubResource( 14 ) +anims/MoveUp = SubResource( 15 ) [connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] [connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"] diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index 51479b2..5d8491b 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -96,14 +96,14 @@ func _decide_on_next_state(): set_invincible(true) return $States/FightStart if state_active == $States/FightStart: - # set_invincible(false) + set_invincible(false) return $States/ChargeSequence if _phase == PHASES.PHASE_ONE: if angry_phases_done < 1: set_invincible(true) sequence_cycles += 1 - if sequence_cycles < 4: + if sequence_cycles < 2: return $States/ChargeSequence else: angry_phases_done = 1 @@ -116,7 +116,33 @@ func _decide_on_next_state(): set_invincible(false) return $States/RoamSequence if state_active == $States/RoamSequence: + return $States/ChargeSequence + if state_active == $States/ChargeSequence: + return $States/Stomp + + if _phase == PHASES.PHASE_TWO: + if angry_phases_done < 2: + set_invincible(true) + if sequence_cycles < 4: + if state_active == $States/ChargeSequence: + return $States/Stomp + if state_active == $States/Stomp: + sequence_cycles += 1 + return $States/ChargeSequence + else: + angry_phases_done = 2 + sequence_cycles = 0 + return $States/ReturnToCenter + else: + if state_active == $States/ReturnToCenter: + return $States/Stomp # TODO: Maybe Stomp. + if state_active == $States/Stomp: + set_invincible(false) return $States/RoamSequence + if state_active == $States/RoamSequence: + return $States/ChargeSequence + if state_active == $States/ChargeSequence: + return $States/Stomp # # Death # if state_active == $States/Die: diff --git a/src/World.tscn b/src/World.tscn index 56ca9d2..85e2b4a 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -23,7 +23,7 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 5 +frame = 40 [node name="FloorTileMap" type="TileMap" parent="."] visible = false From 0eea6edee7d47cd6633fbf30024dac400a731247 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 19:23:51 +0200 Subject: [PATCH 4/8] Added stomp effect --- src/Boss/SlimeBoss/SlimeBoss.tscn | 7 +- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 24 ++++ src/Boss/SlimeBoss/States/Stomp.gd | 7 +- src/Effects/Stomp/StompEffect.gd | 9 ++ src/Effects/Stomp/StompEffect.tscn | 138 ++++++++++++++++++++ src/Effects/Stomp/stomp-splash.png | Bin 0 -> 8194 bytes src/Effects/Stomp/stomp-splash.png.import | 34 +++++ 7 files changed, 214 insertions(+), 5 deletions(-) create mode 100644 src/Effects/Stomp/StompEffect.gd create mode 100644 src/Effects/Stomp/StompEffect.tscn create mode 100644 src/Effects/Stomp/stomp-splash.png create mode 100644 src/Effects/Stomp/stomp-splash.png.import diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index bbdf2c1..18ce780 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=36 format=2] +[gd_scene load_steps=37 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2] @@ -20,6 +20,7 @@ [ext_resource path="res://Effects/Charge/ChargeEffect.tscn" type="PackedScene" id=18] [ext_resource path="res://Boss/SlimeBoss/States/ReturnToCenter.gd" type="Script" id=19] [ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20] +[ext_resource path="res://Effects/Stomp/StompEffect.tscn" type="PackedScene" id=21] [sub_resource type="CircleShape2D" id=1] radius = 60.0 @@ -813,6 +814,9 @@ __meta__ = { position = Vector2( 0, -8 ) emitting = false +[node name="StompEffect" parent="Effects" instance=ExtResource( 21 )] +visible = false + [node name="Stats" parent="." instance=ExtResource( 3 )] max_health = 3 @@ -925,6 +929,7 @@ anims/MoveDown = SubResource( 12 ) anims/MoveLeft = SubResource( 13 ) anims/MoveRight = SubResource( 14 ) anims/MoveUp = SubResource( 15 ) +[connection signal="animation_finished" from="Effects/StompEffect" to="States/Stomp" method="_on_StompEffect_animation_finished"] [connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] [connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"] diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index 5d8491b..09b0669 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -144,6 +144,30 @@ func _decide_on_next_state(): if state_active == $States/ChargeSequence: return $States/Stomp + if _phase == PHASES.PHASE_THREE: + if angry_phases_done < 2: + set_invincible(true) + if sequence_cycles < 6: + if state_active == $States/ChargeSequence: + return $States/Stomp + if state_active == $States/Stomp: + sequence_cycles += 1 + return $States/ChargeSequence + else: + angry_phases_done = 2 + sequence_cycles = 0 + return $States/ReturnToCenter + else: + if state_active == $States/ReturnToCenter: + return $States/Stomp # TODO: Maybe Stomp. + if state_active == $States/Stomp: + set_invincible(false) + return $States/RoamSequence + if state_active == $States/RoamSequence: + return $States/ChargeSequence + if state_active == $States/ChargeSequence: + return $States/Stomp + # # Death # if state_active == $States/Die: # queue_free() diff --git a/src/Boss/SlimeBoss/States/Stomp.gd b/src/Boss/SlimeBoss/States/Stomp.gd index 963acc6..922878f 100644 --- a/src/Boss/SlimeBoss/States/Stomp.gd +++ b/src/Boss/SlimeBoss/States/Stomp.gd @@ -1,9 +1,11 @@ extends "res://Boss/SlimeBoss/States/BossState.gd" onready var stomp_hitbox = owner.get_node("StompHitbox/CollisionShape2D") +onready var stomp_effect = owner.get_node("Effects/StompEffect") func enter(): stomp_hitbox.disabled = false + stomp_effect.stomp() func exit(): stomp_hitbox.disabled = true @@ -11,8 +13,5 @@ func exit(): func update(delta): play_directional_animation("Charge", owner.last_look) -func _on_animation_finished(anim_name): - anim_name = get_base_anim_name(anim_name) - assert(anim_name == "Charge") - +func _on_StompEffect_animation_finished(): emit_signal("finished") diff --git a/src/Effects/Stomp/StompEffect.gd b/src/Effects/Stomp/StompEffect.gd new file mode 100644 index 0000000..f6666c0 --- /dev/null +++ b/src/Effects/Stomp/StompEffect.gd @@ -0,0 +1,9 @@ +extends AnimatedSprite + +func stomp(): + visible = true + frame = 0 + play("stomp") + +func _animation_finished(): + visible = false diff --git a/src/Effects/Stomp/StompEffect.tscn b/src/Effects/Stomp/StompEffect.tscn new file mode 100644 index 0000000..aa7a14c --- /dev/null +++ b/src/Effects/Stomp/StompEffect.tscn @@ -0,0 +1,138 @@ +[gd_scene load_steps=34 format=2] + +[ext_resource path="res://Effects/Stomp/stomp-splash.png" type="Texture" id=1] +[ext_resource path="res://Effects/Stomp/StompEffect.gd" type="Script" id=2] + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 120, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 240, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=5] +atlas = ExtResource( 1 ) +region = Rect2( 360, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=6] +atlas = ExtResource( 1 ) +region = Rect2( 480, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=7] +atlas = ExtResource( 1 ) +region = Rect2( 600, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=8] +atlas = ExtResource( 1 ) +region = Rect2( 720, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=9] +atlas = ExtResource( 1 ) +region = Rect2( 840, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=10] +atlas = ExtResource( 1 ) +region = Rect2( 960, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=11] +atlas = ExtResource( 1 ) +region = Rect2( 1080, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=12] +atlas = ExtResource( 1 ) +region = Rect2( 1200, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=13] +atlas = ExtResource( 1 ) +region = Rect2( 1320, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=14] +atlas = ExtResource( 1 ) +region = Rect2( 1440, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=15] +atlas = ExtResource( 1 ) +region = Rect2( 1560, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=16] +atlas = ExtResource( 1 ) +region = Rect2( 1680, 0, 120, 120 ) + +[sub_resource type="AtlasTexture" id=17] +atlas = ExtResource( 1 ) +region = Rect2( 0, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=18] +atlas = ExtResource( 1 ) +region = Rect2( 120, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=19] +atlas = ExtResource( 1 ) +region = Rect2( 240, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=20] +atlas = ExtResource( 1 ) +region = Rect2( 360, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=21] +atlas = ExtResource( 1 ) +region = Rect2( 480, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=22] +atlas = ExtResource( 1 ) +region = Rect2( 600, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=23] +atlas = ExtResource( 1 ) +region = Rect2( 720, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=24] +atlas = ExtResource( 1 ) +region = Rect2( 840, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=25] +atlas = ExtResource( 1 ) +region = Rect2( 960, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=26] +atlas = ExtResource( 1 ) +region = Rect2( 1080, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=27] +atlas = ExtResource( 1 ) +region = Rect2( 1200, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=28] +atlas = ExtResource( 1 ) +region = Rect2( 1320, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=29] +atlas = ExtResource( 1 ) +region = Rect2( 1440, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=30] +atlas = ExtResource( 1 ) +region = Rect2( 1560, 120, 120, 120 ) + +[sub_resource type="AtlasTexture" id=31] +atlas = ExtResource( 1 ) +region = Rect2( 1680, 120, 120, 120 ) + +[sub_resource type="SpriteFrames" id=32] +animations = [ { +"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ) ], +"loop": false, +"name": "stomp", +"speed": 60.0 +} ] + +[node name="StompEffect" type="AnimatedSprite"] +frames = SubResource( 32 ) +animation = "stomp" +script = ExtResource( 2 ) +[connection signal="animation_finished" from="." to="." method="_animation_finished"] diff --git a/src/Effects/Stomp/stomp-splash.png b/src/Effects/Stomp/stomp-splash.png new file mode 100644 index 0000000000000000000000000000000000000000..a9beb59840ffa4fd35cd244864acb47ed296c21f GIT binary patch literal 8194 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 literal 0 HcmV?d00001 diff --git a/src/Effects/Stomp/stomp-splash.png.import b/src/Effects/Stomp/stomp-splash.png.import new file mode 100644 index 0000000..8ae506c --- /dev/null +++ b/src/Effects/Stomp/stomp-splash.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/stomp-splash.png-8255ebc3952d7a9d2ea05b169c877e7f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Effects/Stomp/stomp-splash.png" +dest_files=[ "res://.import/stomp-splash.png-8255ebc3952d7a9d2ea05b169c877e7f.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 +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 From b68689dfa0fccf58d4d31b67b9f9403b950f355f Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 19:50:34 +0200 Subject: [PATCH 5/8] Introduced bugs --- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 6 +++--- src/Boss/SlimeBoss/States/Charge/Sprint.gd | 2 +- src/Boss/SlimeBoss/States/ReturnToCenter.gd | 1 - src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd | 2 +- src/World.tscn | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index 09b0669..8c01e7a 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -145,7 +145,7 @@ func _decide_on_next_state(): return $States/Stomp if _phase == PHASES.PHASE_THREE: - if angry_phases_done < 2: + if angry_phases_done < 3: set_invincible(true) if sequence_cycles < 6: if state_active == $States/ChargeSequence: @@ -154,7 +154,7 @@ func _decide_on_next_state(): sequence_cycles += 1 return $States/ChargeSequence else: - angry_phases_done = 2 + angry_phases_done = 3 sequence_cycles = 0 return $States/ReturnToCenter else: @@ -167,7 +167,7 @@ func _decide_on_next_state(): return $States/ChargeSequence if state_active == $States/ChargeSequence: return $States/Stomp - + # # Death # if state_active == $States/Die: # queue_free() diff --git a/src/Boss/SlimeBoss/States/Charge/Sprint.gd b/src/Boss/SlimeBoss/States/Charge/Sprint.gd index bd81bfd..befd4eb 100644 --- a/src/Boss/SlimeBoss/States/Charge/Sprint.gd +++ b/src/Boss/SlimeBoss/States/Charge/Sprint.gd @@ -1,6 +1,6 @@ extends "res://Boss/SlimeBoss/States/BossState.gd" -export(float) var SPEED = 800.0 +export(float) var SPEED = 300.0 var direction = Vector2() diff --git a/src/Boss/SlimeBoss/States/ReturnToCenter.gd b/src/Boss/SlimeBoss/States/ReturnToCenter.gd index 2bdd65d..df2e5a4 100644 --- a/src/Boss/SlimeBoss/States/ReturnToCenter.gd +++ b/src/Boss/SlimeBoss/States/ReturnToCenter.gd @@ -6,7 +6,6 @@ export(float) var MAX_SPEED = 300.0 export(float) var ARRIVE_DISTANCE = 6.0 var velocity = Vector2.ZERO -var center = Vector2.ZERO func update(delta): velocity = Steering.arrive_to(velocity, diff --git a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd index 9e0db85..1b5c1cf 100644 --- a/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd +++ b/src/Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd @@ -4,7 +4,7 @@ export(float) var ARRIVE_DISTANCE = 6.0 export(float) var SLOW_RADIUS = 200.0 export(float) var MASS = 5.0 export(float) var MAX_SPEED = 300.0 -export(float) var ROAM_RADIUS = 200.0 +export(float) var ROAM_RADIUS = 100.0 var time_since_start = 0 diff --git a/src/World.tscn b/src/World.tscn index 85e2b4a..8603521 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -23,7 +23,7 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 40 +frame = 14 [node name="FloorTileMap" type="TileMap" parent="."] visible = false @@ -61,8 +61,6 @@ position = Vector2( 240, 120 ) [node name="DialogueBox" parent="CanvasLayer" instance=ExtResource( 6 )] visible = false -[node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] - [node name="DebugLabel" type="Control" parent="CanvasLayer"] anchor_right = 1.0 anchor_bottom = 1.0 @@ -104,5 +102,7 @@ margin_top = 32.0 margin_right = 40.0 margin_bottom = 44.0 custom_fonts/font = ExtResource( 9 ) + +[node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] [connection signal="phase_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_phase_changed"] [connection signal="state_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_state_changed"] From 8164b47301ec822dc285e6a20f8be086486ad0ea Mon Sep 17 00:00:00 2001 From: Jan Schuffenhauer Date: Mon, 20 Apr 2020 21:09:13 +0200 Subject: [PATCH 6/8] Fixed StateBug --- src/Boss/SlimeBoss/SlimeBoss.tscn | 97 ++++++++++----------- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 60 ++----------- src/Overlap/StateMachine/SequenceState.gd | 1 - src/Player/Player.tscn | 2 +- src/World.tscn | 2 +- 5 files changed, 57 insertions(+), 105 deletions(-) diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index 18ce780..a7624fb 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=37 format=2] +[gd_scene load_steps=35 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2] @@ -13,7 +13,6 @@ [ext_resource path="res://Boss/SlimeBoss/Animations/move_up.png" type="Texture" id=11] [ext_resource path="res://Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd" type="Script" id=12] [ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=13] -[ext_resource path="res://Boss/SlimeBoss/HeroCloseZone.gd" type="Script" id=14] [ext_resource path="res://Overlap/StateMachine/SequenceState.gd" type="Script" id=15] [ext_resource path="res://Boss/SlimeBoss/States/Charge/Prepare.gd" type="Script" id=16] [ext_resource path="res://Boss/SlimeBoss/States/Charge/Sprint.gd" type="Script" id=17] @@ -22,23 +21,23 @@ [ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20] [ext_resource path="res://Effects/Stomp/StompEffect.tscn" type="PackedScene" id=21] -[sub_resource type="CircleShape2D" id=1] -radius = 60.0 +[sub_resource type="CapsuleShape2D" id=15] +radius = 30.0 +height = 50.0 -[sub_resource type="CircleShape2D" id=17] -radius = 16.0312 +[sub_resource type="CapsuleShape2D" id=16] +radius = 13.0 +height = 30.0 -[sub_resource type="CircleShape2D" id=16] -radius = 24.0208 +[sub_resource type="CapsuleShape2D" id=17] +radius = 15.0 +height = 35.0 -[sub_resource type="CircleShape2D" id=4] -radius = 150.0 - -[sub_resource type="CapsuleShape2D" id=5] +[sub_resource type="CapsuleShape2D" id=4] radius = 8.0 height = 32.0 -[sub_resource type="Animation" id=6] +[sub_resource type="Animation" id=5] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -114,7 +113,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=7] +[sub_resource type="Animation" id=6] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -190,7 +189,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=8] +[sub_resource type="Animation" id=7] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -266,7 +265,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=9] +[sub_resource type="Animation" id=8] length = 0.45 step = 0.025 tracks/0/type = "value" @@ -342,7 +341,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1 ] } -[sub_resource type="Animation" id=10] +[sub_resource type="Animation" id=9] length = 1.9 step = 0.025 tracks/0/type = "value" @@ -418,7 +417,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } -[sub_resource type="Animation" id=11] +[sub_resource type="Animation" id=10] length = 1.9 step = 0.025 tracks/0/type = "value" @@ -494,7 +493,7 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } -[sub_resource type="Animation" id=12] +[sub_resource type="Animation" id=11] length = 2.66666 step = 0.0111111 tracks/0/type = "value" @@ -570,7 +569,7 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=13] +[sub_resource type="Animation" id=12] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -646,7 +645,7 @@ tracks/5/keys = { "values": [ true ] } -[sub_resource type="Animation" id=14] +[sub_resource type="Animation" id=13] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -722,7 +721,7 @@ tracks/5/keys = { "values": [ false ] } -[sub_resource type="Animation" id=15] +[sub_resource type="Animation" id=14] length = 1.28333 step = 0.0166667 tracks/0/type = "value" @@ -815,7 +814,7 @@ position = Vector2( 0, -8 ) emitting = false [node name="StompEffect" parent="Effects" instance=ExtResource( 21 )] -visible = false +frame = 29 [node name="Stats" parent="." instance=ExtResource( 3 )] max_health = 3 @@ -867,44 +866,40 @@ script = ExtResource( 19 ) script = ExtResource( 20 ) [node name="Sprite" type="Sprite" parent="."] -position = Vector2( 5, -28 ) -texture = ExtResource( 6 ) -flip_h = true -vframes = 7 -hframes = 11 +position = Vector2( 0, -28 ) +texture = ExtResource( 5 ) +vframes = 10 +hframes = 24 [node name="StompHitbox" parent="." instance=ExtResource( 2 )] [node name="CollisionShape2D" parent="StompHitbox" index="0"] -shape = SubResource( 1 ) +position = Vector2( 0, 10 ) +rotation = 1.5708 +shape = SubResource( 15 ) disabled = true [node name="Hitbox" parent="." instance=ExtResource( 2 )] collision_layer = 4 [node name="CollisionShape2D" parent="Hitbox" index="0"] -position = Vector2( 0, -15 ) -shape = SubResource( 17 ) +position = Vector2( 0, -5 ) +rotation = 1.5708 +shape = SubResource( 16 ) [node name="Hurtbox" parent="." instance=ExtResource( 1 )] collision_layer = 4 collision_mask = 0 [node name="CollisionShape2D" parent="Hurtbox" index="0"] -position = Vector2( 0, -15 ) -shape = SubResource( 16 ) - -[node name="HeroCloseZone" type="Area2D" parent="."] -collision_layer = 0 -script = ExtResource( 14 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="HeroCloseZone"] -shape = SubResource( 4 ) +position = Vector2( 0, -5 ) +rotation = 1.5708 +shape = SubResource( 17 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( -1.52588e-05, 0 ) rotation = 1.5708 -shape = SubResource( 5 ) +shape = SubResource( 4 ) [node name="DebugLabel" type="Label" parent="."] visible = false @@ -919,16 +914,16 @@ __meta__ = { [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "MoveRight" -anims/ChargeDown = SubResource( 6 ) -anims/ChargeLeft = SubResource( 7 ) -anims/ChargeRight = SubResource( 8 ) -anims/ChargeUp = SubResource( 9 ) -anims/Charging = SubResource( 10 ) -anims/FightStart = SubResource( 11 ) -anims/MoveDown = SubResource( 12 ) -anims/MoveLeft = SubResource( 13 ) -anims/MoveRight = SubResource( 14 ) -anims/MoveUp = SubResource( 15 ) +anims/ChargeDown = SubResource( 5 ) +anims/ChargeLeft = SubResource( 6 ) +anims/ChargeRight = SubResource( 7 ) +anims/ChargeUp = SubResource( 8 ) +anims/Charging = SubResource( 9 ) +anims/FightStart = SubResource( 10 ) +anims/MoveDown = SubResource( 11 ) +anims/MoveLeft = SubResource( 12 ) +anims/MoveRight = SubResource( 13 ) +anims/MoveUp = SubResource( 14 ) [connection signal="animation_finished" from="Effects/StompEffect" to="States/Stomp" method="_on_StompEffect_animation_finished"] [connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index 8c01e7a..f520e32 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -51,27 +51,28 @@ func _on_Stats_no_health(): go_to_next_state($States/Die) func _on_Stats_health_changed(new_health): - assert(new_health > -1) - assert(new_health < $Stats.max_health) - if _phase == PHASES.PHASE_ONE and new_health == 2: _change_phase(PHASES.PHASE_TWO) - if _phase == PHASES.PHASE_TWO and new_health == 1: + elif _phase == PHASES.PHASE_TWO and new_health == 1: _change_phase(PHASES.PHASE_THREE) + elif _phase == PHASES.PHASE_THREE and new_health < 1: + queue_free() func go_to_next_state(state_override=null): if state_active: state_active.exit() - if state_override != null: state_active = state_override else: state_active = _decide_on_next_state() + emit_signal("state_changed", state_active.name) + state_active.enter() func _change_phase(new_phase): + set_invincible(true) var phase_name = "" match new_phase: PHASES.PHASE_ONE: @@ -96,7 +97,6 @@ func _decide_on_next_state(): set_invincible(true) return $States/FightStart if state_active == $States/FightStart: - set_invincible(false) return $States/ChargeSequence if _phase == PHASES.PHASE_ONE: @@ -129,6 +129,7 @@ func _decide_on_next_state(): if state_active == $States/Stomp: sequence_cycles += 1 return $States/ChargeSequence + return $States/ChargeSequence else: angry_phases_done = 2 sequence_cycles = 0 @@ -153,6 +154,7 @@ func _decide_on_next_state(): if state_active == $States/Stomp: sequence_cycles += 1 return $States/ChargeSequence + return $States/ChargeSequence else: angry_phases_done = 3 sequence_cycles = 0 @@ -173,51 +175,7 @@ func _decide_on_next_state(): # queue_free() # return $States/Dead # -# # PHASE ONE -# if _phase == PHASES.PHASE_ONE: -# if state_active == $States/RoamSequence: -# sequence_cycles += 1 -# if sequence_cycles < 2: -# return $States/RoamSequence -# else: -# sequence_cycles = 0 -# return $States/Stomp -# if state_active == $States/Stomp: -# return $States/RoamSequence -# -# # PHASE TWO -# elif _phase == PHASES.PHASE_TWO: -# if state_active == $States/RoamSequence: -# return $States/Stomp -# if state_active == $States/Stomp: -# if sequence_cycles < 2: -# sequence_cycles += 1 -# return $States/Stomp -# else: -# sequence_cycles = 0 -# return $States/ChargeSequence -# if state_active == $States/ChargeSequence: -# return $States/RoamSequence -# -# -# # PHASE THREE -# elif _phase == PHASES.PHASE_THREE: -# if state_active == $States/RoamSequence: -# return $States/Stomp -# if state_active == $States/Stomp: -# if sequence_cycles < 2: -# sequence_cycles += 1 -# return $States/Stomp -# else: -# sequence_cycles = 0 -# return $States/ChargeSequence -# if state_active == $States/ChargeSequence: -# if sequence_cycles < 2: -# sequence_cycles += 1 -# return $States/ChargeSequence -# else: -# sequence_cycles = 0 -# return $States/Stomp + func set_invincible(value): diff --git a/src/Overlap/StateMachine/SequenceState.gd b/src/Overlap/StateMachine/SequenceState.gd index e9e68e7..37cb924 100644 --- a/src/Overlap/StateMachine/SequenceState.gd +++ b/src/Overlap/StateMachine/SequenceState.gd @@ -31,7 +31,6 @@ func _on_state_active_finished(): func go_to_next_state_in_sequence(): state_active.exit() - var new_state_index = (state_active.get_index() + 1) % get_child_count() if new_state_index == 0: emit_signal('finished') diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index be52078..44c99d4 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -736,7 +736,7 @@ __meta__ = { } [node name="Stats" parent="." instance=ExtResource( 5 )] -max_health = 5 +max_health = 999999 [node name="AnimationStates" type="Node" parent="."] script = ExtResource( 15 ) diff --git a/src/World.tscn b/src/World.tscn index 8603521..ad9ba6b 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -23,7 +23,7 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 14 +frame = 12 [node name="FloorTileMap" type="TileMap" parent="."] visible = false From 0db9fe763656985f00784cbc6e97367d91794459 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 21:22:01 +0200 Subject: [PATCH 7/8] Added the edges --- src/Maps/Tilesets/Edge/tileset_edge.png | Bin 0 -> 739 bytes .../Tilesets/Edge/tileset_edge.png.import | 34 +++ src/World.tscn | 234 +++++++++++++++++- 3 files changed, 264 insertions(+), 4 deletions(-) create mode 100644 src/Maps/Tilesets/Edge/tileset_edge.png create mode 100644 src/Maps/Tilesets/Edge/tileset_edge.png.import diff --git a/src/Maps/Tilesets/Edge/tileset_edge.png b/src/Maps/Tilesets/Edge/tileset_edge.png new file mode 100644 index 0000000000000000000000000000000000000000..f2990d49b9cd32aa415da2606c07b7d2f71097b5 GIT binary patch literal 739 zcmeAS@N?(olHy`uVBq!ia0vp^4M6O`!3HERU8}DLQjEnx?oJHr&dI!FU|^c->Eakt zG3V{Iw>(A2V9=|Sc*`86%CjE_d65HM$-8_4Z<)XY> zICRo^-t4i@Obsw-Km0U^r9&spzWL@p2Ak5)O?R2I^FB9eGi>g=xrgC4qYvMKHthzB zWoG&(m^va1XNw2$O_1Bf{N>Cu))#yUK=Ov?f(6d=n5HmqxF|9~MwfZ=;j@e}!3@&x zL@s2T&*%+fJh_nTKq^DY4$lSIq6gZv8t$bq<^Var=JT1eH!Nc?d*U=fr{S#N=0fAc zMgO#wejVhMsa=zJ_)Y=?le+_Fi)cxlK!FR3j?9Kl#WHCYw)N95bxr&1{*EK(JZsI) zpLVQ#q;S|uFbKJYoDw4rMEb!lB{hjUD$G3A5 zZ&kSQonlOQ`!2z{>Gt)xX7eUCN3pup|2hBTf1Q1)4RiZe$&}QZn-(saTJE`;mDelW zPTXhSB5Uw&!M4NOba%hJAp2NyAz$OuKblHBX^lbGUhLu%47~m_&B5@1wac1Ul1(pO z@2ay1$x1t1-pcyUK{IuSxPAxwIlX(!w=^AnqgZ2Dy@0p*^5^YrA`Gmt-`Q&STdD{2 zYUUJ|EfC9R>ie~a|9j33Hm`&6-{XYNch4-;Ze%DZD|9MbxTjU2A%=@Bt8|@O^|zeA z=Ytz=SeG!?{Q2U@=g^|pu>1CJ2Bvp$leavas>C$cP68wu6B~buvEu@3LHX{Jj19hW z3|C|ptmN*rbr3&rb!!oWS_$J7ey1?!Z~65_jNE(t78>n5YryT;bUrbctux%6$)k^D xf()mErI16BO2ZQmhLaN+CMh$j5H0bCE$o)*9=>jsUBFb!;OXk;vd$@?2>@SOI4S@D literal 0 HcmV?d00001 diff --git a/src/Maps/Tilesets/Edge/tileset_edge.png.import b/src/Maps/Tilesets/Edge/tileset_edge.png.import new file mode 100644 index 0000000..ec0e916 --- /dev/null +++ b/src/Maps/Tilesets/Edge/tileset_edge.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/tileset_edge.png-9676f4036529ea7cfae58e9cbb837b60.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Maps/Tilesets/Edge/tileset_edge.png" +dest_files=[ "res://.import/tileset_edge.png-9676f4036529ea7cfae58e9cbb837b60.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 +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/src/World.tscn b/src/World.tscn index 8603521..dc5984e 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=23 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://World.gd" type="Script" id=2] @@ -11,8 +11,226 @@ [ext_resource path="res://Fonts/Harmonic/Harmonic12.tres" type="DynamicFont" id=9] [ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=10] [ext_resource path="res://Debug/BossStateDisplay.gd" type="Script" id=11] +[ext_resource path="res://Maps/Tilesets/Edge/tileset_edge.png" type="Texture" id=12] [ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18] +[sub_resource type="ConvexPolygonShape2D" id=2] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=3] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=4] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=5] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=6] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=7] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=8] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="ConvexPolygonShape2D" id=9] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + +[sub_resource type="TileSet" id=1] +1/name = "tileset_edge.png 1" +1/texture = ExtResource( 12 ) +1/tex_offset = Vector2( 0, 0 ) +1/modulate = Color( 1, 1, 1, 1 ) +1/region = Rect2( 0, -32, 96, 32 ) +1/tile_mode = 1 +1/autotile/bitmask_mode = 0 +1/autotile/bitmask_flags = [ ] +1/autotile/icon_coordinate = Vector2( 0, 0 ) +1/autotile/tile_size = Vector2( 32, 32 ) +1/autotile/spacing = 0 +1/autotile/occluder_map = [ ] +1/autotile/navpoly_map = [ ] +1/autotile/priority_map = [ ] +1/autotile/z_index_map = [ ] +1/occluder_offset = Vector2( 0, 0 ) +1/navigation_offset = Vector2( 0, 0 ) +1/shape_offset = Vector2( 0, 0 ) +1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +1/shape_one_way = false +1/shape_one_way_margin = 0.0 +1/shapes = [ ] +1/z_index = 0 +2/name = "tileset_edge.png 2" +2/texture = ExtResource( 12 ) +2/tex_offset = Vector2( 0, 0 ) +2/modulate = Color( 1, 1, 1, 1 ) +2/region = Rect2( 0, 0, 32, 32 ) +2/tile_mode = 0 +2/occluder_offset = Vector2( 0, 0 ) +2/navigation_offset = Vector2( 0, 0 ) +2/shape_offset = Vector2( 0, 0 ) +2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +2/shape = SubResource( 2 ) +2/shape_one_way = false +2/shape_one_way_margin = 1.0 +2/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 2 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +2/z_index = 0 +3/name = "tileset_edge.png 3" +3/texture = ExtResource( 12 ) +3/tex_offset = Vector2( 0, 0 ) +3/modulate = Color( 1, 1, 1, 1 ) +3/region = Rect2( 32, 0, 32, 32 ) +3/tile_mode = 0 +3/occluder_offset = Vector2( 0, 0 ) +3/navigation_offset = Vector2( 0, 0 ) +3/shape_offset = Vector2( 0, 0 ) +3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +3/shape = SubResource( 3 ) +3/shape_one_way = false +3/shape_one_way_margin = 1.0 +3/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 3 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +3/z_index = 0 +4/name = "tileset_edge.png 4" +4/texture = ExtResource( 12 ) +4/tex_offset = Vector2( 0, 0 ) +4/modulate = Color( 1, 1, 1, 1 ) +4/region = Rect2( 64, 0, 32, 32 ) +4/tile_mode = 0 +4/occluder_offset = Vector2( 0, 0 ) +4/navigation_offset = Vector2( 0, 0 ) +4/shape_offset = Vector2( 0, 0 ) +4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +4/shape = SubResource( 4 ) +4/shape_one_way = false +4/shape_one_way_margin = 1.0 +4/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 4 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +4/z_index = 0 +5/name = "tileset_edge.png 5" +5/texture = ExtResource( 12 ) +5/tex_offset = Vector2( 0, 0 ) +5/modulate = Color( 1, 1, 1, 1 ) +5/region = Rect2( 96, 0, 32, 32 ) +5/tile_mode = 0 +5/occluder_offset = Vector2( 0, 0 ) +5/navigation_offset = Vector2( 0, 0 ) +5/shape_offset = Vector2( 0, 0 ) +5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +5/shape = SubResource( 5 ) +5/shape_one_way = false +5/shape_one_way_margin = 1.0 +5/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 5 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +5/z_index = 0 +6/name = "tileset_edge.png 6" +6/texture = ExtResource( 12 ) +6/tex_offset = Vector2( 0, 0 ) +6/modulate = Color( 1, 1, 1, 1 ) +6/region = Rect2( 0, 32, 32, 32 ) +6/tile_mode = 0 +6/occluder_offset = Vector2( 0, 0 ) +6/navigation_offset = Vector2( 0, 0 ) +6/shape_offset = Vector2( 0, 0 ) +6/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +6/shape = SubResource( 6 ) +6/shape_one_way = false +6/shape_one_way_margin = 1.0 +6/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 6 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +6/z_index = 0 +7/name = "tileset_edge.png 7" +7/texture = ExtResource( 12 ) +7/tex_offset = Vector2( 0, 0 ) +7/modulate = Color( 1, 1, 1, 1 ) +7/region = Rect2( 32, 32, 32, 32 ) +7/tile_mode = 0 +7/occluder_offset = Vector2( 0, 0 ) +7/navigation_offset = Vector2( 0, 0 ) +7/shape_offset = Vector2( 0, 0 ) +7/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +7/shape = SubResource( 7 ) +7/shape_one_way = false +7/shape_one_way_margin = 1.0 +7/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 7 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +7/z_index = 0 +8/name = "tileset_edge.png 8" +8/texture = ExtResource( 12 ) +8/tex_offset = Vector2( 0, 0 ) +8/modulate = Color( 1, 1, 1, 1 ) +8/region = Rect2( 64, 32, 32, 32 ) +8/tile_mode = 0 +8/occluder_offset = Vector2( 0, 0 ) +8/navigation_offset = Vector2( 0, 0 ) +8/shape_offset = Vector2( 0, 0 ) +8/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +8/shape = SubResource( 8 ) +8/shape_one_way = false +8/shape_one_way_margin = 1.0 +8/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 8 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +8/z_index = 0 +9/name = "tileset_edge.png 9" +9/texture = ExtResource( 12 ) +9/tex_offset = Vector2( 0, 0 ) +9/modulate = Color( 1, 1, 1, 1 ) +9/region = Rect2( 96, 32, 32, 32 ) +9/tile_mode = 0 +9/occluder_offset = Vector2( 0, 0 ) +9/navigation_offset = Vector2( 0, 0 ) +9/shape_offset = Vector2( 0, 0 ) +9/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +9/shape = SubResource( 9 ) +9/shape_one_way = false +9/shape_one_way_margin = 1.0 +9/shapes = [ { +"autotile_coord": Vector2( 0, 0 ), +"one_way": false, +"one_way_margin": 1.0, +"shape": SubResource( 9 ), +"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) +} ] +9/z_index = 0 + [node name="World" type="Node2D"] script = ExtResource( 2 ) @@ -23,22 +241,28 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 14 +frame = 20 [node name="FloorTileMap" type="TileMap" parent="."] -visible = false position = Vector2( 16, 16 ) tile_set = ExtResource( 3 ) cell_size = Vector2( 32, 32 ) collision_layer = 2 collision_mask = 0 format = 1 -tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, -1610612689, 196609, -65534, -1610612689, 196609, -65533, -1610612689, 196609, -65532, -1610612689, 196609, -65531, -1610612689, 196609, -65530, -1610612689, 196609, -65529, -1610612689, 196609, -65528, -1610612689, 196609, -65527, -1610612689, 196609, -65526, -1610612689, 196609, -65525, -1610612689, 196609, -65524, -1610612689, 196609, -65523, -1610612689, 196610, -65522, -1610612720, 131073, 65535, -1610612689, 65539, 14, -1610612689, 3, 131071, 47, 65539, 65550, -1610612689, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327694, -1610612689, 65539, 458751, -1610612689, 131076, 393216, -1610612689, 1, 393217, -1610612689, 1, 393218, -1610612689, 1, 393219, -1610612689, 1, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, -1610612689, 131079, 524287, -1610612689, 131072, 458752, 47, 131073, 458753, 47, 131073, 458754, 47, 131073, 458755, 47, 131073, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, -1610612689, 131074 ) +tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, -1610612689, 196609, -65534, -1610612689, 196609, -65533, -1610612689, 196609, -65532, -1610612689, 196609, -65531, -1610612689, 196609, -65530, -1610612689, 196609, -65529, -1610612689, 196609, -65528, -1610612689, 196609, -65527, -1610612689, 196609, -65526, -1610612689, 196609, -65525, -1610612689, 196609, -65524, -1610612689, 196609, -65523, -1610612689, 196610, -65522, -1610612720, 131073, 65535, -1610612689, 65539, 14, -1610612689, 3, 131071, 47, 65539, 65550, -1610612689, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327680, 16, 65536, 327681, 16, 65537, 327682, 16, 65538, 327683, 16, 131073, 327684, 16, 131073, 327685, 16, 131073, 327686, 16, 131073, 327687, 16, 131073, 327688, 16, 131073, 327689, 16, 131073, 327690, 16, 131073, 327691, 16, 131073, 327692, 16, 131073, 327693, 16, 131073, 327694, -1610612689, 65539, 458751, -1610612689, 65539, 393216, 16, 196608, 393217, 16, 196609, 393218, 16, 196610, 393219, -1610612689, 0, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, -1610612689, 131079, 524287, -1610612689, 196612, 458752, 47, 196609, 458753, 47, 196609, 458754, 47, 196609, 458755, 47, 196614, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, -1610612689, 131074 ) __meta__ = { "_edit_group_": true, "_edit_lock_": true } +[node name="Edge" type="TileMap" parent="."] +position = Vector2( 16, 16 ) +tile_set = SubResource( 1 ) +cell_size = Vector2( 32, 32 ) +format = 1 +tile_data = PoolIntArray( -1, 5, 0, -65536, 3, 0, -65535, 3, 0, -65534, 3, 0, -65533, 3, 0, -65532, 3, 0, -65531, 3, 0, -65530, 3, 0, -65529, 3, 0, -65528, 3, 0, -65527, 3, 0, -65526, 3, 0, -65525, 3, 0, -65524, 3, 0, -65523, 3, 0, -65522, 4, 0, 65535, 2, 0, 14, 6, 0, 131071, 2, 0, 65550, 6, 0, 196607, 2, 0, 131086, 6, 0, 262143, 2, 0, 196622, 6, 0, 327679, 2, 0, 262158, 6, 0, 393215, 9, 0, 327680, 7, 0, 327681, 7, 0, 327682, 7, 0, 327683, 7, 0, 327684, 7, 0, 327685, 7, 0, 327686, 7, 0, 327687, 7, 0, 327688, 7, 0, 327689, 7, 0, 327690, 7, 0, 327691, 7, 0, 327692, 7, 0, 327693, 7, 0, 327694, 8, 0, 458751, 0, 0 ) + [node name="YSort" type="YSort" parent="."] [node name="Bonfire" parent="YSort" instance=ExtResource( 10 )] @@ -62,6 +286,7 @@ position = Vector2( 240, 120 ) visible = false [node name="DebugLabel" type="Control" parent="CanvasLayer"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { @@ -104,5 +329,6 @@ margin_bottom = 44.0 custom_fonts/font = ExtResource( 9 ) [node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] +visible = false [connection signal="phase_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_phase_changed"] [connection signal="state_changed" from="YSort/SlimeBoss" to="CanvasLayer/DebugLabel/BossStateDisplay" method="_on_SlimeBoss_state_changed"] From 6e01f59bd62f50f238c9e11914c9ced62e5ef110 Mon Sep 17 00:00:00 2001 From: Paul Norberger Date: Mon, 20 Apr 2020 21:46:16 +0200 Subject: [PATCH 8/8] Boss can die now --- src/Boss/SlimeBoss/SlimeBoss.tscn | 149 ++++++++++++++++++-- src/Boss/SlimeBoss/SlimeBossStateMachine.gd | 12 +- src/Boss/SlimeBoss/States/Die.gd | 7 + src/World.tscn | 47 +++--- 4 files changed, 175 insertions(+), 40 deletions(-) create mode 100644 src/Boss/SlimeBoss/States/Die.gd diff --git a/src/Boss/SlimeBoss/SlimeBoss.tscn b/src/Boss/SlimeBoss/SlimeBoss.tscn index a7624fb..1dabf04 100644 --- a/src/Boss/SlimeBoss/SlimeBoss.tscn +++ b/src/Boss/SlimeBoss/SlimeBoss.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=2] +[gd_scene load_steps=39 format=2] [ext_resource path="res://Overlap/HurtHit_Box/Hurtbox.tscn" type="PackedScene" id=1] [ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2] @@ -13,6 +13,7 @@ [ext_resource path="res://Boss/SlimeBoss/Animations/move_up.png" type="Texture" id=11] [ext_resource path="res://Boss/SlimeBoss/States/Roam/MoveToRandomPosition.gd" type="Script" id=12] [ext_resource path="res://Overlap/Kind.tscn" type="PackedScene" id=13] +[ext_resource path="res://Boss/SlimeBoss/States/Die.gd" type="Script" id=14] [ext_resource path="res://Overlap/StateMachine/SequenceState.gd" type="Script" id=15] [ext_resource path="res://Boss/SlimeBoss/States/Charge/Prepare.gd" type="Script" id=16] [ext_resource path="res://Boss/SlimeBoss/States/Charge/Sprint.gd" type="Script" id=17] @@ -20,18 +21,19 @@ [ext_resource path="res://Boss/SlimeBoss/States/ReturnToCenter.gd" type="Script" id=19] [ext_resource path="res://Boss/SlimeBoss/States/Stomp.gd" type="Script" id=20] [ext_resource path="res://Effects/Stomp/StompEffect.tscn" type="PackedScene" id=21] +[ext_resource path="res://Boss/SlimeBoss/States/BossState.gd" type="Script" id=22] -[sub_resource type="CapsuleShape2D" id=15] +[sub_resource type="CapsuleShape2D" id=1] radius = 30.0 height = 50.0 -[sub_resource type="CapsuleShape2D" id=16] +[sub_resource type="CapsuleShape2D" id=2] radius = 13.0 height = 30.0 -[sub_resource type="CapsuleShape2D" id=17] -radius = 15.0 -height = 35.0 +[sub_resource type="CapsuleShape2D" id=3] +radius = 20.0 +height = 30.0 [sub_resource type="CapsuleShape2D" id=4] radius = 8.0 @@ -417,6 +419,95 @@ tracks/5/keys = { "values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ] } +[sub_resource type="Animation" id=15] +resource_name = "Die" +length = 0.6 +step = 0.025 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:texture") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ ExtResource( 10 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:vframes") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 10 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("Sprite:hframes") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 24 ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0, 0.55 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 0, -28 ), Vector2( 0, -1.90735e-06 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("Sprite:flip_h") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("Sprite:frame") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 2, 3, 4 ] +} +tracks/6/type = "value" +tracks/6/path = NodePath("Sprite:scale") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/keys = { +"times": PoolRealArray( 0, 0.55 ), +"transitions": PoolRealArray( 1, 1.93187 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1e-05, 1e-05 ) ] +} + [sub_resource type="Animation" id=10] length = 1.9 step = 0.025 @@ -797,6 +888,34 @@ tracks/5/keys = { "values": [ Vector2( 0, -28 ) ] } +[sub_resource type="Animation" id=16] +resource_name = "__INIT__" +length = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 0, -28 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Sprite:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} + [node name="SlimeBoss" type="KinematicBody2D"] collision_layer = 4 collision_mask = 2 @@ -814,6 +933,7 @@ position = Vector2( 0, -8 ) emitting = false [node name="StompEffect" parent="Effects" instance=ExtResource( 21 )] +visible = false frame = 29 [node name="Stats" parent="." instance=ExtResource( 3 )] @@ -865,9 +985,15 @@ script = ExtResource( 19 ) [node name="Stomp" type="Node" parent="States"] script = ExtResource( 20 ) +[node name="Die" type="Node" parent="States"] +script = ExtResource( 14 ) + +[node name="Death" type="Node" parent="States"] +script = ExtResource( 22 ) + [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0, -28 ) -texture = ExtResource( 5 ) +texture = ExtResource( 10 ) vframes = 10 hframes = 24 @@ -876,7 +1002,7 @@ hframes = 24 [node name="CollisionShape2D" parent="StompHitbox" index="0"] position = Vector2( 0, 10 ) rotation = 1.5708 -shape = SubResource( 15 ) +shape = SubResource( 1 ) disabled = true [node name="Hitbox" parent="." instance=ExtResource( 2 )] @@ -885,16 +1011,15 @@ collision_layer = 4 [node name="CollisionShape2D" parent="Hitbox" index="0"] position = Vector2( 0, -5 ) rotation = 1.5708 -shape = SubResource( 16 ) +shape = SubResource( 2 ) [node name="Hurtbox" parent="." instance=ExtResource( 1 )] collision_layer = 4 collision_mask = 0 [node name="CollisionShape2D" parent="Hurtbox" index="0"] -position = Vector2( 0, -5 ) rotation = 1.5708 -shape = SubResource( 17 ) +shape = SubResource( 3 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( -1.52588e-05, 0 ) @@ -919,11 +1044,13 @@ anims/ChargeLeft = SubResource( 6 ) anims/ChargeRight = SubResource( 7 ) anims/ChargeUp = SubResource( 8 ) anims/Charging = SubResource( 9 ) +anims/Die = SubResource( 15 ) anims/FightStart = SubResource( 10 ) anims/MoveDown = SubResource( 11 ) anims/MoveLeft = SubResource( 12 ) anims/MoveRight = SubResource( 13 ) anims/MoveUp = SubResource( 14 ) +anims/__INIT__ = SubResource( 16 ) [connection signal="animation_finished" from="Effects/StompEffect" to="States/Stomp" method="_on_StompEffect_animation_finished"] [connection signal="health_changed" from="Stats" to="." method="_on_Stats_health_changed"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] diff --git a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd index f520e32..f2adad6 100644 --- a/src/Boss/SlimeBoss/SlimeBossStateMachine.gd +++ b/src/Boss/SlimeBoss/SlimeBossStateMachine.gd @@ -56,7 +56,7 @@ func _on_Stats_health_changed(new_health): elif _phase == PHASES.PHASE_TWO and new_health == 1: _change_phase(PHASES.PHASE_THREE) elif _phase == PHASES.PHASE_THREE and new_health < 1: - queue_free() + go_to_next_state($States/Die) func go_to_next_state(state_override=null): @@ -98,6 +98,10 @@ func _decide_on_next_state(): return $States/FightStart if state_active == $States/FightStart: return $States/ChargeSequence + # Death + if state_active == $States/Die: + queue_free() + # return $States/Dead if _phase == PHASES.PHASE_ONE: if angry_phases_done < 1: @@ -170,11 +174,7 @@ func _decide_on_next_state(): if state_active == $States/ChargeSequence: return $States/Stomp -# # Death -# if state_active == $States/Die: -# queue_free() -# return $States/Dead -# + diff --git a/src/Boss/SlimeBoss/States/Die.gd b/src/Boss/SlimeBoss/States/Die.gd new file mode 100644 index 0000000..697ab47 --- /dev/null +++ b/src/Boss/SlimeBoss/States/Die.gd @@ -0,0 +1,7 @@ +extends "res://Boss/SlimeBoss/States/BossState.gd" + +func enter(): + animation_player.play("Die") + +func _on_animation_finished(anim_name): + emit_signal("finished") diff --git a/src/World.tscn b/src/World.tscn index b5adae8..0effdc8 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -14,6 +14,9 @@ [ext_resource path="res://Maps/Tilesets/Edge/tileset_edge.png" type="Texture" id=12] [ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18] +[sub_resource type="ConvexPolygonShape2D" id=1] +points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) + [sub_resource type="ConvexPolygonShape2D" id=2] points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) @@ -35,10 +38,7 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) [sub_resource type="ConvexPolygonShape2D" id=8] points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) -[sub_resource type="ConvexPolygonShape2D" id=9] -points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) - -[sub_resource type="TileSet" id=1] +[sub_resource type="TileSet" id=9] 1/name = "tileset_edge.png 1" 1/texture = ExtResource( 12 ) 1/tex_offset = Vector2( 0, 0 ) @@ -72,14 +72,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 2/navigation_offset = Vector2( 0, 0 ) 2/shape_offset = Vector2( 0, 0 ) 2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -2/shape = SubResource( 2 ) +2/shape = SubResource( 1 ) 2/shape_one_way = false 2/shape_one_way_margin = 1.0 2/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 2 ), +"shape": SubResource( 1 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 2/z_index = 0 @@ -93,14 +93,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 3/navigation_offset = Vector2( 0, 0 ) 3/shape_offset = Vector2( 0, 0 ) 3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -3/shape = SubResource( 3 ) +3/shape = SubResource( 2 ) 3/shape_one_way = false 3/shape_one_way_margin = 1.0 3/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 3 ), +"shape": SubResource( 2 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 3/z_index = 0 @@ -114,14 +114,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 4/navigation_offset = Vector2( 0, 0 ) 4/shape_offset = Vector2( 0, 0 ) 4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -4/shape = SubResource( 4 ) +4/shape = SubResource( 3 ) 4/shape_one_way = false 4/shape_one_way_margin = 1.0 4/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 4 ), +"shape": SubResource( 3 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 4/z_index = 0 @@ -135,14 +135,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 5/navigation_offset = Vector2( 0, 0 ) 5/shape_offset = Vector2( 0, 0 ) 5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -5/shape = SubResource( 5 ) +5/shape = SubResource( 4 ) 5/shape_one_way = false 5/shape_one_way_margin = 1.0 5/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 5 ), +"shape": SubResource( 4 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 5/z_index = 0 @@ -156,14 +156,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 6/navigation_offset = Vector2( 0, 0 ) 6/shape_offset = Vector2( 0, 0 ) 6/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -6/shape = SubResource( 6 ) +6/shape = SubResource( 5 ) 6/shape_one_way = false 6/shape_one_way_margin = 1.0 6/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 6 ), +"shape": SubResource( 5 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 6/z_index = 0 @@ -177,14 +177,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 7/navigation_offset = Vector2( 0, 0 ) 7/shape_offset = Vector2( 0, 0 ) 7/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -7/shape = SubResource( 7 ) +7/shape = SubResource( 6 ) 7/shape_one_way = false 7/shape_one_way_margin = 1.0 7/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 7 ), +"shape": SubResource( 6 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 7/z_index = 0 @@ -198,14 +198,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 8/navigation_offset = Vector2( 0, 0 ) 8/shape_offset = Vector2( 0, 0 ) 8/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -8/shape = SubResource( 8 ) +8/shape = SubResource( 7 ) 8/shape_one_way = false 8/shape_one_way_margin = 1.0 8/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 8 ), +"shape": SubResource( 7 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 8/z_index = 0 @@ -219,14 +219,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) 9/navigation_offset = Vector2( 0, 0 ) 9/shape_offset = Vector2( 0, 0 ) 9/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) -9/shape = SubResource( 9 ) +9/shape = SubResource( 8 ) 9/shape_one_way = false 9/shape_one_way_margin = 1.0 9/shapes = [ { "autotile_coord": Vector2( 0, 0 ), "one_way": false, "one_way_margin": 1.0, -"shape": SubResource( 9 ), +"shape": SubResource( 8 ), "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) } ] 9/z_index = 0 @@ -241,16 +241,17 @@ region_enabled = true region_rect = Rect2( 0, 0, 1280, 720 ) [node name="Background" parent="." instance=ExtResource( 7 )] -frame = 0 +frame = 32 [node name="FloorTileMap" type="TileMap" parent="."] +visible = false position = Vector2( 16, 16 ) tile_set = ExtResource( 3 ) cell_size = Vector2( 32, 32 ) collision_layer = 2 collision_mask = 0 format = 1 -tile_data = PoolIntArray( -1, -1610612689, 4, -65536, -1610612689, 196609, -65535, -1610612689, 196609, -65534, -1610612689, 196609, -65533, -1610612689, 196609, -65532, -1610612689, 196609, -65531, -1610612689, 196609, -65530, -1610612689, 196609, -65529, -1610612689, 196609, -65528, -1610612689, 196609, -65527, -1610612689, 196609, -65526, -1610612689, 196609, -65525, -1610612689, 196609, -65524, -1610612689, 196609, -65523, -1610612689, 196610, -65522, -1610612720, 131073, 65535, -1610612689, 65539, 14, -1610612689, 3, 131071, 47, 65539, 65550, -1610612689, 65539, 196607, 47, 65539, 131086, -1610612689, 65539, 262143, 47, 65539, 196622, -1610612689, 65539, 327679, 47, 65539, 262158, -1610612689, 65539, 393215, 47, 65539, 327680, 16, 65536, 327681, 16, 65537, 327682, 16, 65538, 327683, 16, 131073, 327684, 16, 131073, 327685, 16, 131073, 327686, 16, 131073, 327687, 16, 131073, 327688, 16, 131073, 327689, 16, 131073, 327690, 16, 131073, 327691, 16, 131073, 327692, 16, 131073, 327693, 16, 131073, 327694, -1610612689, 65539, 458751, -1610612689, 65539, 393216, 16, 196608, 393217, 16, 196609, 393218, 16, 196610, 393219, -1610612689, 0, 393220, -1610612689, 1, 393221, -1610612689, 1, 393222, -1610612689, 1, 393223, -1610612689, 1, 393224, -1610612689, 1, 393225, -1610612689, 1, 393226, -1610612689, 1, 393227, -1610612689, 1, 393228, -1610612689, 1, 393229, -1610612689, 1, 393230, -1610612689, 131079, 524287, -1610612689, 196612, 458752, 47, 196609, 458753, 47, 196609, 458754, 47, 196609, 458755, 47, 196614, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, -1610612689, 131074 ) +tile_data = PoolIntArray( -1, 47, 4, -65536, 47, 196609, -65535, 47, 196609, -65534, 47, 196609, -65533, 47, 196609, -65532, 47, 196609, -65531, 47, 196609, -65530, 47, 196609, -65529, 47, 196609, -65528, 47, 196609, -65527, 47, 196609, -65526, 47, 196609, -65525, 47, 196609, -65524, 47, 196609, -65523, 47, 196609, -65522, 47, 7, 65535, 47, 65539, 14, 47, 65539, 131071, 47, 65539, 65550, 47, 65539, 196607, 47, 65539, 131086, 47, 65539, 262143, 47, 65539, 196622, 47, 65539, 327679, 47, 65539, 262158, 47, 65539, 393215, 47, 131076, 327680, 47, 1, 327681, 47, 1, 327682, 47, 1, 327683, 47, 1, 327684, 47, 1, 327685, 47, 1, 327686, 47, 1, 327687, 47, 1, 327688, 47, 1, 327689, 47, 1, 327690, 47, 1, 327691, 47, 1, 327692, 47, 1, 327693, 47, 1, 327694, 47, 131079, 458751, 47, 65536, 393216, 47, 65537, 393217, 47, 65537, 393218, 47, 65537, 393219, 47, 65537, 393220, 47, 65537, 393221, 47, 65537, 393222, 47, 65537, 393223, 47, 65537, 393224, 47, 65537, 393225, 47, 65537, 393226, 47, 65537, 393227, 47, 65537, 393228, 47, 65537, 393229, 47, 65537, 393230, 47, 65538, 524287, 47, 131072, 458752, 47, 131073, 458753, 47, 131073, 458754, 47, 131073, 458755, 47, 131073, 458756, 47, 131073, 458757, 47, 131073, 458758, 47, 131073, 458759, 47, 131073, 458760, 47, 131073, 458761, 47, 131073, 458762, 47, 131073, 458763, 47, 131073, 458764, 47, 131073, 458765, 47, 131073, 458766, 47, 131074 ) __meta__ = { "_edit_group_": true, "_edit_lock_": true @@ -258,7 +259,7 @@ __meta__ = { [node name="Edge" type="TileMap" parent="."] position = Vector2( 16, 16 ) -tile_set = SubResource( 1 ) +tile_set = SubResource( 9 ) cell_size = Vector2( 32, 32 ) format = 1 tile_data = PoolIntArray( -1, 5, 0, -65536, 3, 0, -65535, 3, 0, -65534, 3, 0, -65533, 3, 0, -65532, 3, 0, -65531, 3, 0, -65530, 3, 0, -65529, 3, 0, -65528, 3, 0, -65527, 3, 0, -65526, 3, 0, -65525, 3, 0, -65524, 3, 0, -65523, 3, 0, -65522, 4, 0, 65535, 2, 0, 14, 6, 0, 131071, 2, 0, 65550, 6, 0, 196607, 2, 0, 131086, 6, 0, 262143, 2, 0, 196622, 6, 0, 327679, 2, 0, 262158, 6, 0, 393215, 9, 0, 327680, 7, 0, 327681, 7, 0, 327682, 7, 0, 327683, 7, 0, 327684, 7, 0, 327685, 7, 0, 327686, 7, 0, 327687, 7, 0, 327688, 7, 0, 327689, 7, 0, 327690, 7, 0, 327691, 7, 0, 327692, 7, 0, 327693, 7, 0, 327694, 8, 0, 458751, 0, 0 )