mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-24 21:54:18 +00:00
🧹 Move behaviours to a different dir
This commit is contained in:
parent
46220e8bdf
commit
a5d1a25ba5
26 changed files with 65 additions and 45 deletions
|
@ -12,15 +12,21 @@ _global_script_classes=[ {
|
|||
"base": "Node",
|
||||
"class": "Alliance",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/entities/behaviours/Alliance.gd"
|
||||
"path": "res://src/behaviours/Alliance.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "AttractedToMovement",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/behaviours/movement/AttractedToMovement.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Ownership",
|
||||
"language": "GDScript",
|
||||
"path": "res://src/entities/behaviours/Ownership.gd"
|
||||
"path": "res://src/behaviours/Ownership.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Alliance": "",
|
||||
"AttractedToMovement": "",
|
||||
"Ownership": ""
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/Alliance.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/Alliance.gd" type="Script" id=1]
|
||||
|
||||
[node name="Alliance" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,13 +1,16 @@
|
|||
extends Node
|
||||
|
||||
# TODO
|
||||
|
||||
export var branch: PackedScene
|
||||
export var branch_container_node_path: NodePath
|
||||
|
||||
|
||||
export var branch: PackedScene = preload("res://src/entities/Pickup.tscn")
|
||||
export var branch_container_node_path: String = "../.."
|
||||
onready var branch_container_node: Node = get_node(branch_container_node_path)
|
||||
onready var source: Node2D = get_parent()
|
||||
|
||||
|
||||
func BranchSpawn():
|
||||
func _ready():
|
||||
var new_branch = branch.instance()
|
||||
new_branch.set_position(source.global_position)
|
||||
branch_container_node.add_child(new_branch)
|
6
src/behaviours/BranchSpawn.tscn
Normal file
6
src/behaviours/BranchSpawn.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/BranchSpawn.gd" type="Script" id=1]
|
||||
|
||||
[node name="BranchSpawn" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,12 +1,15 @@
|
|||
extends Node
|
||||
|
||||
onready var target: KinematicBody2D = get_parent()
|
||||
export var movement_per_second: float = 400.0
|
||||
|
||||
|
||||
signal hit(collision)
|
||||
|
||||
|
||||
export var movement_per_second: float
|
||||
|
||||
|
||||
onready var target: KinematicBody2D = get_parent()
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
var direction = Vector2(cos(target.rotation), sin(target.rotation))
|
||||
var collision: KinematicCollision2D = target.move_and_collide(direction * movement_per_second * delta)
|
|
@ -1,10 +1,14 @@
|
|||
extends Node
|
||||
|
||||
|
||||
export var bullet: PackedScene = preload("res://src/entities/Bullet.tscn")
|
||||
export var bullet_container_node_path: String = "../.."
|
||||
export var bullet: PackedScene
|
||||
export var bullet_container_node_path: String
|
||||
|
||||
|
||||
onready var bullet_container_node: Node = get_node(bullet_container_node_path)
|
||||
onready var source: Node2D = get_parent()
|
||||
|
||||
|
||||
var _timer : Timer = null
|
||||
|
||||
func _ready():
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/BulletSpawn.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/BulletSpawn.gd" type="Script" id=1]
|
||||
|
||||
[node name="BulletSpawn" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/Damageable.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/Damageable.gd" type="Script" id=1]
|
||||
|
||||
[node name="Damageable" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/ErraticMovement.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/ErraticMovement.gd" type="Script" id=1]
|
||||
|
||||
[node name="ErraticMovement" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/Ownership.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/Ownership.gd" type="Script" id=1]
|
||||
|
||||
[node name="Ownership" type="Node"]
|
||||
script = ExtResource( 1 )
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://src/entities/behaviours/PlayerMovement.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/behaviours/PlayerMovement.gd" type="Script" id=1]
|
||||
|
||||
[node name="PlayerMovement" type="Node"]
|
||||
script = ExtResource( 1 )
|
11
src/entities/AbstractEntity.tscn
Normal file
11
src/entities/AbstractEntity.tscn
Normal file
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://src/behaviours/Damageable.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/behaviours/Alliance.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="AbstractEntity" type="KinematicBody2D"]
|
||||
collision_layer = 3
|
||||
|
||||
[node name="Alliance" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Damageable" parent="." instance=ExtResource( 1 )]
|
|
@ -1,8 +1,8 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://src/mechanics/Arrow.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/behaviours/BulletMovement.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/entities/behaviours/Ownership.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/behaviours/BulletMovement.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/behaviours/Ownership.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/entities/Bullet.gd" type="Script" id=4]
|
||||
[ext_resource path="res://src/sounds/Arrow.mp3" type="AudioStream" id=5]
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://src/mechanics/Black.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/behaviours/ErraticMovement.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/entities/behaviours/AttractedTo.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/entities/behaviours/Damageable.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/entities/behaviours/Alliance.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://src/behaviours/ErraticMovement.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/behaviours/movement/AttractedToMovement.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/behaviours/Damageable.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/behaviours/Alliance.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://src/entities/Enemy.gd" type="Script" id=6]
|
||||
[ext_resource path="res://src/entities/behaviours/BranchSpawn.gd" type="Script" id=7]
|
||||
[ext_resource path="res://src/behaviours/BranchSpawn.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource path="res://src/mechanics/Branch1.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/Pickup.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/entities/behaviours/SpriteRandomRotation.gd" type="Script" id=3]
|
||||
[ext_resource path="res://src/behaviours/SpriteRandomRotation.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
|
|
@ -1,31 +1,18 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/entities/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/entities/behaviours/BulletSpawn.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://src/entities/behaviours/Damageable.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://src/entities/behaviours/Alliance.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://src/behaviours/PlayerMovement.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://src/entities/AbstractEntity.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
collision_layer = 3
|
||||
collision/safe_margin = 0.02
|
||||
[node name="Player" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
[node name="Shape" type="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Shape"]
|
||||
[node name="Sprite" type="Sprite" parent="Shape" index="0"]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="PlayerMovement" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="BulletSpawn" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Damageable" parent="." instance=ExtResource( 4 )]
|
||||
health = 5
|
||||
max_health = 5
|
||||
|
||||
[node name="Alliance" parent="." instance=ExtResource( 5 )]
|
||||
alliance = 1
|
||||
[node name="PlayerMovement" parent="." index="1" instance=ExtResource( 2 )]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
[ext_resource path="res://src/ui/TimeSurvived.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://src/entities/Pickup.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://src/entities/pickupeffects/ChangeFireIntensity.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://src/entities/behaviours/EnemySpawn.gd" type="Script" id=10]
|
||||
[ext_resource path="res://src/behaviours/EnemySpawn.gd" type="Script" id=10]
|
||||
[ext_resource path="res://src/levels/PhaseOneMusic.gd" type="Script" id=11]
|
||||
[ext_resource path="res://src/ui/HealthBar.tscn" type="PackedScene" id=14]
|
||||
|
||||
|
|
Loading…
Reference in a new issue