First commit

This commit is contained in:
Hamcha 2020-07-06 14:38:05 +02:00
commit ba89ea8b49
30 changed files with 960 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.import
export

21
Actors/Player/Player.gd Executable file
View File

@ -0,0 +1,21 @@
extends KinematicBody2D
const SPEED = 320.0
const EPSILON = 0.1
export var is_controlled = false setget set_is_controlled
func _ready():
$Camera.current = is_controlled
func _physics_process(_delta):
var motion = Vector2(
Input.get_action_strength("ui_right")-Input.get_action_strength("ui_left"),
Input.get_action_strength("ui_down")-Input.get_action_strength("ui_up"))
if motion.length() > EPSILON:
$Sprite/AnimationTree.set("parameters/direction/blend_position", motion)
move_and_slide(motion.clamped(1.0) * SPEED)
func set_is_controlled(val):
is_controlled = val
$Camera.current = val

19
Actors/Player/Player.tscn Executable file
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Graphics/tgstation/sprites/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Actors/Player/Player.gd" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 10.4436
height = 5.44386
[node name="Player" type="KinematicBody2D"]
script = ExtResource( 2 )
[node name="Camera" type="Camera2D" parent="."]
[node name="Sprite" parent="." instance=ExtResource( 1 )]
position = Vector2( 0, -3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

233
Graphics/tgstation/1x1.tres Normal file
View File

@ -0,0 +1,233 @@
[gd_resource type="TileSet" load_steps=36 format=2]
[ext_resource path="res://Graphics/tgstation/walls.png" type="Texture" id=1]
[sub_resource type="OccluderPolygon2D" id=1]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=2]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=3]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=4]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=5]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=6]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=7]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=8]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=9]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=10]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=11]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=12]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=13]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=14]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=15]
polygon = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="OccluderPolygon2D" id=16]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="OccluderPolygon2D" id=17]
polygon = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=18]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=19]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=20]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=21]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=22]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=23]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=24]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=25]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=26]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=27]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=28]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=29]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=30]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=31]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=32]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=33]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[sub_resource type="ConvexPolygonShape2D" id=34]
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
[resource]
0/name = "Wall"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 64, 80 )
0/tile_mode = 1
0/autotile/bitmask_mode = 0
0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 69, Vector2( 0, 1 ), 65, Vector2( 0, 2 ), 1, Vector2( 0, 3 ), 5, Vector2( 0, 4 ), 5, Vector2( 1, 0 ), 261, Vector2( 1, 1 ), 260, Vector2( 1, 2 ), 4, Vector2( 1, 3 ), 325, Vector2( 1, 4 ), 65, Vector2( 2, 0 ), 64, Vector2( 2, 1 ), 320, Vector2( 2, 2 ), 320, Vector2( 2, 3 ), 324, Vector2( 2, 4 ), 260, Vector2( 3, 0 ), 256, Vector2( 3, 1 ), 321 ]
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ Vector2( 0, 0 ), SubResource( 1 ), Vector2( 0, 1 ), SubResource( 2 ), Vector2( 0, 2 ), SubResource( 3 ), Vector2( 0, 3 ), SubResource( 4 ), Vector2( 0, 4 ), SubResource( 5 ), Vector2( 1, 0 ), SubResource( 6 ), Vector2( 1, 1 ), SubResource( 7 ), Vector2( 1, 2 ), SubResource( 8 ), Vector2( 1, 3 ), SubResource( 9 ), Vector2( 1, 4 ), SubResource( 10 ), Vector2( 2, 0 ), SubResource( 11 ), Vector2( 2, 1 ), SubResource( 12 ), Vector2( 2, 2 ), SubResource( 13 ), Vector2( 2, 3 ), SubResource( 14 ), Vector2( 2, 4 ), SubResource( 15 ), Vector2( 3, 0 ), SubResource( 16 ), Vector2( 3, 1 ), SubResource( 17 ) ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 18 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 23 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 24 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 25 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 26 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 27 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 28 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 29 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 30 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 31 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 32 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 33 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 34 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0

View File

@ -0,0 +1,48 @@
[gd_resource type="TileSet" load_steps=5 format=2]
[ext_resource path="res://Graphics/tgstation/floor.png" type="Texture" id=1]
[ext_resource path="res://Graphics/tgstation/wall.png" type="Texture" id=2]
[sub_resource type="OccluderPolygon2D" id=1]
polygon = PoolVector2Array( 32, 32, 0, 32, 0, 0, 32, 0 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 32, 32, 0, 32, 0, 0, 32, 0 )
[resource]
1/name = "Floor"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 0, 0, 32, 32 )
1/tile_mode = 0
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 = "Wall"
2/texture = ExtResource( 2 )
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/occluder = SubResource( 1 )
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

BIN
Graphics/tgstation/floor.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/floor.png-3bcc52916d51a4ca8cbe3f63cd3f1ef7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/tgstation/floor.png"
dest_files=[ "res://.import/floor.png-3bcc52916d51a4ca8cbe3f63cd3f1ef7.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=true
svg/scale=1.0

BIN
Graphics/tgstation/player.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/player.png-2bc4dbaa0a130ff55afac0b8708317d4.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/tgstation/player.png"
dest_files=[ "res://.import/player.png-2bc4dbaa0a130ff55afac0b8708317d4.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=true
svg/scale=1.0

View File

@ -0,0 +1,106 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://Graphics/tgstation/player.png" type="Texture" id=1]
[sub_resource type="AnimationNodeAnimation" id=11]
animation = "left"
[sub_resource type="AnimationNodeAnimation" id=12]
animation = "right"
[sub_resource type="AnimationNodeAnimation" id=13]
animation = "up"
[sub_resource type="AnimationNodeAnimation" id=14]
animation = "down"
[sub_resource type="AnimationNodeBlendSpace2D" id=15]
blend_point_0/node = SubResource( 11 )
blend_point_0/pos = Vector2( -1, 0 )
blend_point_1/node = SubResource( 12 )
blend_point_1/pos = Vector2( 1, 0 )
blend_point_2/node = SubResource( 13 )
blend_point_2/pos = Vector2( 0, -1 )
blend_point_3/node = SubResource( 14 )
blend_point_3/pos = Vector2( 0, 1 )
blend_mode = 1
[sub_resource type="AnimationNodeBlendTree" id=16]
graph_offset = Vector2( -794.59, 0 )
nodes/direction/node = SubResource( 15 )
nodes/direction/position = Vector2( -160, 140 )
nodes/output/position = Vector2( 200, 140 )
node_connections = [ "output", 0, "direction" ]
[sub_resource type="Animation" id=7]
tracks/0/type = "value"
tracks/0/path = NodePath(".:region_rect")
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": [ Rect2( 0, 32, 32, 32 ) ]
}
[sub_resource type="Animation" id=8]
tracks/0/type = "value"
tracks/0/path = NodePath(".:region_rect")
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": [ Rect2( 0, 0, 32, 32 ) ]
}
[sub_resource type="Animation" id=9]
tracks/0/type = "value"
tracks/0/path = NodePath(".:region_rect")
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": [ Rect2( 32, 32, 32, 32 ) ]
}
[sub_resource type="Animation" id=10]
tracks/0/type = "value"
tracks/0/path = NodePath(".:region_rect")
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": [ Rect2( 32, 0, 32, 32 ) ]
}
[node name="Sprite" type="Sprite"]
texture = ExtResource( 1 )
region_enabled = true
region_rect = Rect2( 0, 32, 32, 32 )
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource( 16 )
anim_player = NodePath("../AnimationPlayer")
active = true
parameters/direction/blend_position = Vector2( -0.00416231, 0.751938 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/down = SubResource( 7 )
anims/left = SubResource( 8 )
anims/right = SubResource( 9 )
anims/up = SubResource( 10 )

BIN
Graphics/tgstation/wall.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/wall.png-e5c95676f513fa835a32b4600b4c3523.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/tgstation/wall.png"
dest_files=[ "res://.import/wall.png-e5c95676f513fa835a32b4600b4c3523.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=true
svg/scale=1.0

BIN
Graphics/tgstation/walls.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/walls.png-e453136f1b46942ddc6ca86403dc6223.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/tgstation/walls.png"
dest_files=[ "res://.import/walls.png-e453136f1b46942ddc6ca86403dc6223.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=true
svg/scale=1.0

BIN
Graphics/transparent.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

34
Graphics/transparent.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/transparent.png-1fa4de1c3f689a5fec6b3c5d5ff27197.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/transparent.png"
dest_files=[ "res://.import/transparent.png-1fa4de1c3f689a5fec6b3c5d5ff27197.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=true
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=true
svg/scale=1.0

BIN
Graphics/white.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

34
Graphics/white.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/white.png-2a69117bc9fb59df3ae112ae8fa17105.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/white.png"
dest_files=[ "res://.import/white.png-2a69117bc9fb59df3ae112ae8fa17105.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=true
svg/scale=1.0

6
Scenes/Map.gd Executable file
View File

@ -0,0 +1,6 @@
extends Node2D
class_name Map
export(NodePath) var tilemap_path
onready var tilemap = get_node(tilemap_path) as MapTiles

31
Scenes/Maps/odyssey.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,64 @@
extends TileMap
class_name MapTiles
export(NodePath) var extended_tilemap_node
export var occluders = ["Wall"]
export var shadow_intensity = 0.2
onready var extended_tilemap = get_node(extended_tilemap_node) as TileMap
func _ready():
# Make occluders for FOV
make_occluders()
# Convert 2x2 tiles to 1x1 if possible
convert_extended()
func convert_extended():
var extended = extended_tilemap.tile_set
for id in tile_set.get_tiles_ids():
var name = tile_set.tile_get_name(id)
var extended_id = extended.find_tile_by_name(name)
if extended_id < 0:
# Not found, skip it
continue
# Find all uses of this tile
for cell in get_used_cells_by_id(id):
var x = cell.x * 2
var y = cell.y * 2
extended_tilemap.set_cell(x, y, extended_id)
extended_tilemap.set_cell(x+1, y, extended_id)
extended_tilemap.set_cell(x, y+1, extended_id)
extended_tilemap.set_cell(x+1, y+1, extended_id)
set_cellv(cell, -1)
extended_tilemap.update_bitmask_region()
extended_tilemap.update_dirty_quadrants()
func make_occluders():
var occluder_ids = []
for occluder_name in occluders:
occluder_ids.push_back(tile_set.find_tile_by_name(occluder_name))
for id in tile_set.get_tiles_ids():
if occluder_ids.find(id) < 0:
# Not an occluder, skip it
continue
# Find all uses of this tile
for cell in get_used_cells_by_id(id):
# Check sides
var occluder = Occluder.new()
occluder.ignore_sides = [
occluder_ids.find(get_cell(cell.x, cell.y-1)) >= 0, # Top
occluder_ids.find(get_cell(cell.x+1, cell.y)) >= 0, # Right
occluder_ids.find(get_cell(cell.x, cell.y+1)) >= 0, # Bottom
occluder_ids.find(get_cell(cell.x-1, cell.y)) >= 0 # Left
]
occluder.transform.origin = map_to_world(cell)
add_child(occluder)
func set_occluder_origin(origin):
for child in get_children():
if child is Occluder:
child.origin = origin

View File

@ -0,0 +1,43 @@
extends Node2D
class_name Occluder
const MAX_LENGTH = 200
const EPSILON = 0.1
var ignore_sides = [false, false, false, false]
var size = Vector2(32, 32)
var origin = null
var polygon: PoolVector2Array = [Vector2.ZERO, Vector2(size.x, 0), Vector2(size.x, size.y), Vector2(0, size.y)]
func _draw():
if polygon == null:
return
if origin == null:
return
var player_position = origin.global_position - global_position
# Find what edges is the players looking at
var edges = [
player_position.y < 0, # TOP
player_position.x > size.x*2, # RIGHT
player_position.y > size.y*2, # BOTTOM
player_position.x < 0 # LEFT
]
for current in range(0, polygon.size()):
var next = (current + 1) % polygon.size()
var previous = (current - 1) % polygon.size()
if not ignore_sides[current] and not edges[current]:
draw_polygon([
(polygon[current] * 2.1 - origin.global_position + global_position) * MAX_LENGTH,
polygon[current], polygon[next],
(polygon[next] * 2.1 - origin.global_position + global_position) * MAX_LENGTH
], [Color.black])
func _process(_delta):
update()
z_index = 999

20
Scenes/Test.tscn Normal file
View File

@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Scenes/Maps/odyssey.tscn" type="PackedScene" id=1]
[ext_resource path="res://Actors/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/World.gd" type="Script" id=4]
[node name="scene" type="Node2D"]
[node name="world" type="Node2D" parent="."]
scale = Vector2( 2, 2 )
script = ExtResource( 4 )
player_path = NodePath("player")
map_path = NodePath("map")
[node name="map" parent="world" instance=ExtResource( 1 )]
[node name="player" parent="world" instance=ExtResource( 2 )]
position = Vector2( 281.46, 222.763 )
z_index = 1
is_controlled = true

10
Scenes/World.gd Executable file
View File

@ -0,0 +1,10 @@
extends Node2D
export(NodePath) var player_path
export(NodePath) var map_path
onready var player = get_node(player_path) as Node2D
onready var map = get_node(map_path) as Map
func _ready():
map.tilemap.set_occluder_origin(player)

BIN
Scenes/clown-dir1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

34
Scenes/clown-dir1.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/clown-dir1.png-e68e6055ec04fcffc8478b8968bf4987.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Scenes/clown-dir1.png"
dest_files=[ "res://.import/clown-dir1.png-e68e6055ec04fcffc8478b8968bf4987.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=true
svg/scale=1.0

8
default_env.tres Normal file
View File

@ -0,0 +1,8 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
ambient_light_energy = 0.0

BIN
icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
icon.png.import Executable file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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=true
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=true
svg/scale=1.0

77
project.godot Normal file
View File

@ -0,0 +1,77 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ {
"base": "Node2D",
"class": "Map",
"language": "GDScript",
"path": "res://Scenes/Map.gd"
}, {
"base": "TileMap",
"class": "MapTiles",
"language": "GDScript",
"path": "res://Scenes/Rendering/MapTiles.gd"
}, {
"base": "Node2D",
"class": "Occluder",
"language": "GDScript",
"path": "res://Scenes/Rendering/Occluder.gd"
} ]
_global_script_class_icons={
"Map": "",
"MapTiles": "",
"Occluder": ""
}
[application]
config/name="odyssey"
run/main_scene="res://Scenes/Test.tscn"
config/icon="res://icon.png"
[display]
window/size/width=1280
window/size/height=800
[input]
ui_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
}
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0, 0, 0, 1 )
environment/default_environment="res://default_env.tres"