Added CollisionLine, renamed folders

WorldChunkRefactoring
Martin Felis 2022-08-25 14:10:02 +02:00
parent 0b48746635
commit a9c7e62d06
22 changed files with 69 additions and 38 deletions

View File

@ -1,8 +1,8 @@
extends Node2D
onready var SimpleEntity = preload("res://Entities/SimpleEntity.tscn")
onready var WanderingEntity = preload("res://Entities/WanderingEntity.tscn")
onready var SimpleEntity = preload("res://entities/SimpleEntity.tscn")
onready var WanderingEntity = preload("res://entities/WanderingEntity.tscn")
onready var player_movable_target_label = $UI/PlayerMovableTarget
onready var player = $PlayerEntity
onready var entities = $Entities

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Entities/SimpleEntity.tscn" type="PackedScene" id=1]
[ext_resource path="res://Entities/PlayerEntity.tscn" type="PackedScene" id=2]
[ext_resource path="res://Assets/white.png" type="Texture" id=3]
[ext_resource path="res://Materials/PhysicsObjects.tres" type="Material" id=4]
[ext_resource path="res://entities/SimpleEntity.tscn" type="PackedScene" id=1]
[ext_resource path="res://entities/PlayerEntity.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/white.png" type="Texture" id=3]
[ext_resource path="res://materials/PhysicsObjects.tres" type="Material" id=4]
[ext_resource path="res://utils/CollisionLine.gd" type="Script" id=5]
[ext_resource path="res://Game.gd" type="Script" id=6]
[sub_resource type="RectangleShape2D" id=1]
@ -11,6 +12,10 @@ extents = Vector2( 57.5347, 51.5794 )
[sub_resource type="RectangleShape2D" id=2]
[sub_resource type="SegmentShape2D" id=3]
a = Vector2( 37, 302 )
b = Vector2( 34, 570 )
[node name="Game" type="Node2D"]
script = ExtResource( 6 )
@ -102,6 +107,13 @@ position = Vector2( 0.465286, 0.57938 )
z_as_relative = false
shape = SubResource( 1 )
[node name="CollisionLine" type="KinematicBody2D" parent="World"]
position = Vector2( 221, 205 )
script = ExtResource( 5 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="World/CollisionLine"]
shape = SubResource( 3 )
[node name="UI" type="CanvasLayer" parent="."]
[node name="PlayerMovableTarget" type="Label" parent="UI"]

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/pirate.svg-3b2dea93c8f9ecaa3dd364c5dc991522.stex"
path="res://.import/pirate.svg-b5137b2528ef058c6c14f8ea13b79308.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/pirate.svg"
dest_files=[ "res://.import/pirate.svg-3b2dea93c8f9ecaa3dd364c5dc991522.stex" ]
source_file="res://assets/pirate.svg"
dest_files=[ "res://.import/pirate.svg-b5137b2528ef058c6c14f8ea13b79308.stex" ]
[params]

View File

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 546 B

View File

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/white.png-63bf30d1e697e9c6c58b33e6327f2179.stex"
path="res://.import/white.png-936ea7d0834e1e21adf362ba74ff2135.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/white.png"
dest_files=[ "res://.import/white.png-63bf30d1e697e9c6c58b33e6327f2179.stex" ]
source_file="res://assets/white.png"
dest_files=[ "res://.import/white.png-936ea7d0834e1e21adf362ba74ff2135.stex" ]
[params]

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Components/ClickableComponent.gd" type="Script" id=1]
[ext_resource path="res://components/ClickableComponent.gd" type="Script" id=1]
[sub_resource type="CircleShape2D" id=1]
radius = 31.4006

View File

@ -1,6 +1,6 @@
extends Node2D
var SpringDamper = preload("res://Utils/SpringDamper.gd")
var SpringDamper = preload("res://utils/SpringDamper.gd")
export var target = Vector2 (0, 0)
export var pos = Vector2 (0, 0)

View File

@ -1,12 +1,12 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Entities/PlayerEntity.gd" type="Script" id=1]
[ext_resource path="res://Components/TintedSpriteComponent.gd" type="Script" id=2]
[ext_resource path="res://Components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://Components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://Components/MovableComponent.gd" type="Script" id=5]
[ext_resource path="res://Assets/pirate.svg" type="Texture" id=6]
[ext_resource path="res://Assets/white.png" type="Texture" id=8]
[ext_resource path="res://entities/PlayerEntity.gd" type="Script" id=1]
[ext_resource path="res://components/TintedSpriteComponent.gd" type="Script" id=2]
[ext_resource path="res://components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://components/MovableComponent.gd" type="Script" id=5]
[ext_resource path="res://assets/pirate.svg" type="Texture" id=6]
[ext_resource path="res://assets/white.png" type="Texture" id=8]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 40, 103 )

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Components/TintedSpriteComponent.gd" type="Script" id=1]
[ext_resource path="res://Entities/SimpleEntity.gd" type="Script" id=2]
[ext_resource path="res://Components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://Components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://components/TintedSpriteComponent.gd" type="Script" id=1]
[ext_resource path="res://entities/SimpleEntity.gd" type="Script" id=2]
[ext_resource path="res://components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://icon.png" type="Texture" id=5]
[node name="SimpleEntity" type="Node2D"]

View File

@ -1,11 +1,11 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Components/TintedSpriteComponent.gd" type="Script" id=1]
[ext_resource path="res://Entities/WanderingEntity.gd" type="Script" id=2]
[ext_resource path="res://Components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://Components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://components/TintedSpriteComponent.gd" type="Script" id=1]
[ext_resource path="res://entities/WanderingEntity.gd" type="Script" id=2]
[ext_resource path="res://components/ColorComponent.gd" type="Script" id=3]
[ext_resource path="res://components/ClickableComponent.tscn" type="PackedScene" id=4]
[ext_resource path="res://icon.png" type="Texture" id=5]
[ext_resource path="res://Components/MovableComponent.gd" type="Script" id=6]
[ext_resource path="res://components/MovableComponent.gd" type="Script" id=6]
[node name="WanderingEntity" type="Node2D"]
script = ExtResource( 2 )

View File

@ -9,28 +9,34 @@
config_version=4
_global_script_classes=[ {
"base": "Node",
"base": "Reference",
"class": "ClickableComponent",
"language": "GDScript",
"path": "res://Components/ClickableComponent.gd"
"path": "res://components/ClickableComponent.gd"
}, {
"base": "Node",
"base": "Reference",
"class": "CollisionLine",
"language": "GDScript",
"path": "res://utils/CollisionLine.gd"
}, {
"base": "Reference",
"class": "ColorComponent",
"language": "GDScript",
"path": "res://Components/ColorComponent.gd"
"path": "res://components/ColorComponent.gd"
}, {
"base": "Object",
"class": "SpringDamper",
"language": "GDScript",
"path": "res://Utils/SpringDamper.gd"
"path": "res://utils/SpringDamper.gd"
}, {
"base": "Sprite",
"base": "Reference",
"class": "TintedSpriteComponent",
"language": "GDScript",
"path": "res://Components/TintedSpriteComponent.gd"
"path": "res://components/TintedSpriteComponent.gd"
} ]
_global_script_class_icons={
"ClickableComponent": "",
"CollisionLine": "",
"ColorComponent": "",
"SpringDamper": "",
"TintedSpriteComponent": ""

13
utils/CollisionLine.gd Normal file
View File

@ -0,0 +1,13 @@
class_name CollisionLine
extends KinematicBody2D
onready var collision = $CollisionShape2D
func _ready():
pass
func _draw():
if collision.shape is SegmentShape2D:
var segment_shape = collision.shape
draw_line (segment_shape.get_a(), segment_shape.get_b(), Color(1, 1, 0))