Fix for Actor template, clean up to build things from new template.
This commit is contained in:
parent
a7b1922a0e
commit
31c49ef828
|
|
@ -11,9 +11,9 @@ onready var movement_animations: AnimatedSprite = $AnimatedSprite
|
||||||
|
|
||||||
onready var sound_effect_player: AudioStreamPlayer = $SE_Player
|
onready var sound_effect_player: AudioStreamPlayer = $SE_Player
|
||||||
|
|
||||||
onready var movement_component: MovementComponent = $Controllers/move_component
|
onready var movement_component: MovementComponent = $movement_component
|
||||||
|
|
||||||
onready var movement_state_machine: StateMachineAnimatedActor = $Controllers/state_machine
|
onready var movement_state_machine: StateMachineAnimatedActor = $movement_state_machine
|
||||||
|
|
||||||
var sound_effects_dict: Dictionary
|
var sound_effects_dict: Dictionary
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=35 format=2]
|
[gd_scene load_steps=34 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/enemyB/Enemy2-KinematicBody2D.gd" type="Script" id=1]
|
[ext_resource path="res://src/enemyB/Enemy2-KinematicBody2D.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://src/enemyB/states/fall.gd" type="Script" id=2]
|
[ext_resource path="res://src/enemyB/states/fall.gd" type="Script" id=2]
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
[ext_resource path="res://src/enemyB/states/wander.gd" type="Script" id=6]
|
[ext_resource path="res://src/enemyB/states/wander.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://src/enemyB/states/idle.gd" type="Script" id=7]
|
[ext_resource path="res://src/enemyB/states/idle.gd" type="Script" id=7]
|
||||||
[ext_resource path="res://src/enemyB/states/attack.gd" type="Script" id=8]
|
[ext_resource path="res://src/enemyB/states/attack.gd" type="Script" id=8]
|
||||||
[ext_resource path="res://src/playerB/Gun.gd" type="Script" id=9]
|
|
||||||
[ext_resource path="res://src/enemyB/states/hurt.gd" type="Script" id=10]
|
[ext_resource path="res://src/enemyB/states/hurt.gd" type="Script" id=10]
|
||||||
[ext_resource path="res://src/enemyB/enemy_move_component.gd" type="Script" id=11]
|
[ext_resource path="res://src/enemyB/enemy_move_component.gd" type="Script" id=11]
|
||||||
|
|
||||||
|
|
@ -132,7 +131,6 @@ script = ExtResource( 1 )
|
||||||
position = Vector2( 8, -8 )
|
position = Vector2( 8, -8 )
|
||||||
frames = SubResource( 168 )
|
frames = SubResource( 168 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 1
|
|
||||||
playing = true
|
playing = true
|
||||||
flip_h = true
|
flip_h = true
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
|
@ -224,20 +222,6 @@ self_modulate = Color( 1, 0, 0, 1 )
|
||||||
position = Vector2( 0, -1 )
|
position = Vector2( 0, -1 )
|
||||||
shape = SubResource( 148 )
|
shape = SubResource( 148 )
|
||||||
|
|
||||||
[node name="Gun" type="Position2D" parent="."]
|
|
||||||
physics_interpolation_mode = 1
|
|
||||||
position = Vector2( 25, -5 )
|
|
||||||
script = ExtResource( 9 )
|
|
||||||
|
|
||||||
[node name="Cooldown" type="Timer" parent="Gun"]
|
|
||||||
wait_time = 0.5
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="Line2D" type="Line2D" parent="Gun"]
|
|
||||||
points = PoolVector2Array( -5, 0, 5, 0 )
|
|
||||||
width = 2.0
|
|
||||||
default_color = Color( 1, 0.607843, 0, 1 )
|
|
||||||
|
|
||||||
[node name="PlayerDetection" type="RayCast2D" parent="."]
|
[node name="PlayerDetection" type="RayCast2D" parent="."]
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 20, 0 )
|
cast_to = Vector2( 20, 0 )
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
[gd_scene load_steps=23 format=2]
|
[gd_scene load_steps=22 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/enemyC/idle.gd" type="Script" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="StreamTexture" id=1]
|
[sub_resource type="StreamTexture" id=1]
|
||||||
load_path = "res://.import/botEnemy.png-46efd539a38730ff15fb4ddb087329c6.stex"
|
load_path = "res://.import/botEnemy.png-46efd539a38730ff15fb4ddb087329c6.stex"
|
||||||
|
|
@ -112,7 +111,7 @@ animations = [ {
|
||||||
position = Vector2( 11, -7 )
|
position = Vector2( 11, -7 )
|
||||||
frames = SubResource( 20 )
|
frames = SubResource( 20 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 0
|
frame = 1
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_aseprite_wizard_config_": {
|
"_aseprite_wizard_config_": {
|
||||||
"layer": "",
|
"layer": "",
|
||||||
|
|
@ -129,13 +128,8 @@ __meta__ = {
|
||||||
[node name="CollisionShape2D" parent="." index="1"]
|
[node name="CollisionShape2D" parent="." index="1"]
|
||||||
position = Vector2( -0.5, -2 )
|
position = Vector2( -0.5, -2 )
|
||||||
|
|
||||||
[node name="idle" parent="Controllers/state_machine" index="0"]
|
[node name="idle" parent="movement_state_machine" index="0"]
|
||||||
script = ExtResource( 2 )
|
animation_sequence = [ "idle" ]
|
||||||
animation_sequence = [ ]
|
|
||||||
fall_node = NodePath("")
|
[node name="fall" parent="movement_state_machine" index="1"]
|
||||||
jump_node = NodePath("")
|
|
||||||
move_node = NodePath("")
|
|
||||||
fire_node = NodePath("")
|
|
||||||
|
|
||||||
[node name="fall" parent="Controllers/state_machine" index="1"]
|
|
||||||
animation_sequence = [ "idle" ]
|
animation_sequence = [ "idle" ]
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
extends Position2D
|
|
||||||
# Represents a weapon that spawns and shoots bullets.
|
|
||||||
# The Cooldown timer controls the cooldown duration between shots.
|
|
||||||
|
|
||||||
|
|
||||||
const BULLET_VELOCITY = 350
|
|
||||||
const Bullet = preload("res://src/Projectile.tscn")
|
|
||||||
|
|
||||||
#onready var sound_shoot = $Shoot
|
|
||||||
onready var timer = $Cooldown
|
|
||||||
onready var offset_position = Vector2(transform.origin.x, transform.origin.y)
|
|
||||||
|
|
||||||
# This method is only called by Player.gd.
|
|
||||||
func shoot(direction = 1):
|
|
||||||
#self.set_position(Vector2(position.x * direction, position.y))
|
|
||||||
#transform.x = transform.x * direction
|
|
||||||
#Transform2D.FLIP_Y
|
|
||||||
#transform.origin.x = transform.origin.x * direction
|
|
||||||
# if direction < 0:
|
|
||||||
# var t = Transform2D()
|
|
||||||
# # Translation
|
|
||||||
# t.origin = Vector2(position.x * -1, position.y)
|
|
||||||
# transform = t
|
|
||||||
# elif direction > 0:
|
|
||||||
# var t = Transform2D()
|
|
||||||
# # Translation
|
|
||||||
# t.origin = Vector2(position.x, position.y)
|
|
||||||
# transform = t
|
|
||||||
|
|
||||||
print("Fire Debug: ", direction, " Gun position: ", position, transform.origin)
|
|
||||||
# position.x = position.x * direction #shifting position before fire was unreliable
|
|
||||||
if not timer.is_stopped():
|
|
||||||
return false
|
|
||||||
var bullet = Bullet.instance()
|
|
||||||
# if (direction > 0):
|
|
||||||
# bullet.global_position = global_position
|
|
||||||
# else:
|
|
||||||
# bullet.global_position = global_position - Vector2(position.x * 2, 0)
|
|
||||||
bullet.global_position = global_position
|
|
||||||
bullet.linear_velocity = Vector2(direction * BULLET_VELOCITY, 0)
|
|
||||||
|
|
||||||
bullet.set_as_toplevel(true)
|
|
||||||
add_child(bullet)
|
|
||||||
# sound_shoot.play()
|
|
||||||
timer.start()
|
|
||||||
return true
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
[ext_resource path="res://src/playerC/player_move_component.gd" type="Script" id=6]
|
[ext_resource path="res://src/playerC/player_move_component.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://src/playerC/states/jump.gd" type="Script" id=7]
|
[ext_resource path="res://src/playerC/states/jump.gd" type="Script" id=7]
|
||||||
[ext_resource path="res://src/playerC/states/hurt.gd" type="Script" id=8]
|
[ext_resource path="res://src/playerC/states/hurt.gd" type="Script" id=8]
|
||||||
[ext_resource path="res://src/playerC/Gun.gd" type="Script" id=9]
|
[ext_resource path="res://src/Gun.gd" type="Script" id=9]
|
||||||
[ext_resource path="res://src/playerC/states/fire.gd" type="Script" id=10]
|
[ext_resource path="res://src/playerC/states/fire.gd" type="Script" id=10]
|
||||||
[ext_resource path="res://src/playerC/resources/FrameSounds.gd" type="Script" id=11]
|
[ext_resource path="res://src/playerC/resources/FrameSounds.gd" type="Script" id=11]
|
||||||
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=12]
|
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=12]
|
||||||
|
|
@ -441,16 +441,14 @@ __meta__ = {
|
||||||
position = Vector2( 0, -3.5 )
|
position = Vector2( 0, -3.5 )
|
||||||
shape = SubResource( 74 )
|
shape = SubResource( 74 )
|
||||||
|
|
||||||
[node name="Controllers" type="Node" parent="."]
|
[node name="movement_component" type="Node" parent="."]
|
||||||
|
|
||||||
[node name="move_component" type="Node" parent="Controllers"]
|
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="state_machine" type="Node" parent="Controllers"]
|
[node name="movement_state_machine" type="Node" parent="."]
|
||||||
script = ExtResource( 14 )
|
script = ExtResource( 14 )
|
||||||
starting_state = NodePath("idle")
|
starting_state = NodePath("idle")
|
||||||
|
|
||||||
[node name="idle" type="Node" parent="Controllers/state_machine"]
|
[node name="idle" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
move_speed = 90.0
|
move_speed = 90.0
|
||||||
animation_sequence = [ "idle" ]
|
animation_sequence = [ "idle" ]
|
||||||
|
|
@ -459,7 +457,7 @@ fall_node = NodePath("../fall")
|
||||||
move_node = NodePath("../move")
|
move_node = NodePath("../move")
|
||||||
fire_node = NodePath("../fire")
|
fire_node = NodePath("../fire")
|
||||||
|
|
||||||
[node name="jump" type="Node" parent="Controllers/state_machine"]
|
[node name="jump" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 7 )
|
script = ExtResource( 7 )
|
||||||
move_speed = 90.0
|
move_speed = 90.0
|
||||||
animation_sequence = [ "jump" ]
|
animation_sequence = [ "jump" ]
|
||||||
|
|
@ -468,7 +466,7 @@ fall_node = NodePath("../fall")
|
||||||
move_node = NodePath("../move")
|
move_node = NodePath("../move")
|
||||||
jump_force = 270.0
|
jump_force = 270.0
|
||||||
|
|
||||||
[node name="move" type="Node" parent="Controllers/state_machine"]
|
[node name="move" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
move_speed = 90.0
|
move_speed = 90.0
|
||||||
animation_sequence = [ "step", "run" ]
|
animation_sequence = [ "step", "run" ]
|
||||||
|
|
@ -477,21 +475,21 @@ fall_node = NodePath("../fall")
|
||||||
idle_node = NodePath("../idle")
|
idle_node = NodePath("../idle")
|
||||||
dash_node = NodePath(".")
|
dash_node = NodePath(".")
|
||||||
|
|
||||||
[node name="fall" type="Node" parent="Controllers/state_machine"]
|
[node name="fall" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
move_speed = 90.0
|
move_speed = 90.0
|
||||||
animation_sequence = [ "jump" ]
|
animation_sequence = [ "jump" ]
|
||||||
idle_node = NodePath("../idle")
|
idle_node = NodePath("../idle")
|
||||||
move_node = NodePath("../move")
|
move_node = NodePath("../move")
|
||||||
|
|
||||||
[node name="hurt" type="Node" parent="Controllers/state_machine"]
|
[node name="hurt" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 8 )
|
script = ExtResource( 8 )
|
||||||
timeout_seconds = 1.0
|
timeout_seconds = 1.0
|
||||||
move_speed = -25.0
|
move_speed = -25.0
|
||||||
animation_sequence = [ "hit" ]
|
animation_sequence = [ "hit" ]
|
||||||
idle_node = NodePath("../idle")
|
idle_node = NodePath("../idle")
|
||||||
|
|
||||||
[node name="fire" type="Node" parent="Controllers/state_machine"]
|
[node name="fire" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 10 )
|
script = ExtResource( 10 )
|
||||||
timeout_seconds = 1.0
|
timeout_seconds = 1.0
|
||||||
animation_sequence = [ "fire" ]
|
animation_sequence = [ "fire" ]
|
||||||
|
|
@ -500,7 +498,7 @@ idle_node = NodePath("../idle")
|
||||||
fall_node = NodePath("../fall")
|
fall_node = NodePath("../fall")
|
||||||
move_node = NodePath("../move")
|
move_node = NodePath("../move")
|
||||||
|
|
||||||
[node name="attack" type="Node" parent="Controllers/state_machine"]
|
[node name="attack" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 13 )
|
script = ExtResource( 13 )
|
||||||
animation_name = "_fire"
|
animation_name = "_fire"
|
||||||
timeout_seconds = 2.0
|
timeout_seconds = 2.0
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
extends MovementComponent
|
|
||||||
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
extends StateMachineAnimatedActor
|
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
[gd_scene load_steps=16 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/components/Hurtbox_Component.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/templates/Actor/ActorStateMachineAnimatedActor.gd" type="Script" id=2]
|
[ext_resource path="res://src/state_machine_animated_actor.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://src/templates/Actor/states/fall.gd" type="Script" id=3]
|
[ext_resource path="res://src/templates/Actor/states/fall.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://src/templates/Actor/states/idle.gd" type="Script" id=4]
|
[ext_resource path="res://src/templates/Actor/states/idle.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://src/templates/Actor/ActorMovementComponent.gd" type="Script" id=5]
|
[ext_resource path="res://src/movement_component.gd" type="Script" id=5]
|
||||||
[ext_resource path="res://src/templates/Actor/resources/Smiley.png" type="Texture" id=6]
|
[ext_resource path="res://src/templates/Actor/resources/Smiley.png" type="Texture" id=6]
|
||||||
[ext_resource path="res://src/templates/Actor/ActorTemplate.gd" type="Script" id=12]
|
[ext_resource path="res://src/templates/Actor/ActorTemplate.gd" type="Script" id=12]
|
||||||
|
|
||||||
|
|
@ -69,25 +69,23 @@ __meta__ = {
|
||||||
position = Vector2( 0, -3.5 )
|
position = Vector2( 0, -3.5 )
|
||||||
shape = SubResource( 74 )
|
shape = SubResource( 74 )
|
||||||
|
|
||||||
[node name="Controllers" type="Node" parent="."]
|
[node name="movement_component" type="Node" parent="."]
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
[node name="state_machine" type="Node" parent="Controllers"]
|
[node name="movement_state_machine" type="Node" parent="."]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
starting_state = NodePath("idle")
|
starting_state = NodePath("idle")
|
||||||
|
|
||||||
[node name="idle" type="Node" parent="Controllers/state_machine"]
|
[node name="idle" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
animation_sequence = [ "default" ]
|
animation_sequence = [ "default" ]
|
||||||
fall_node = NodePath("../fall")
|
fall_node = NodePath("../fall")
|
||||||
|
|
||||||
[node name="fall" type="Node" parent="Controllers/state_machine"]
|
[node name="fall" type="Node" parent="movement_state_machine"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
animation_sequence = [ "default" ]
|
animation_sequence = [ "default" ]
|
||||||
idle_node = NodePath("../idle")
|
idle_node = NodePath("../idle")
|
||||||
|
|
||||||
[node name="move_component" type="Node" parent="Controllers"]
|
|
||||||
script = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." instance=ExtResource( 1 )]
|
[node name="Hurtbox_Component" parent="." instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="SE_Player" type="AudioStreamPlayer" parent="."]
|
[node name="SE_Player" type="AudioStreamPlayer" parent="."]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user