Add computers and sprinting
This commit is contained in:
parent
3c813d98e4
commit
23b0112b45
12 changed files with 310 additions and 29 deletions
45
Actors/Objects/Computer/Computer.gd
Normal file
45
Actors/Objects/Computer/Computer.gd
Normal file
|
@ -0,0 +1,45 @@
|
|||
tool
|
||||
|
||||
extends StaticBody2D
|
||||
|
||||
enum Direction { LEFT, RIGHT, UP, DOWN }
|
||||
enum ComputerType { ShipCommand, Comms, Medical, Research, ShipEngine, Atmos }
|
||||
|
||||
export(Direction) var direction = Direction.DOWN setget set_direction
|
||||
export(ComputerType) var computer_type = ComputerType.ShipCommand setget set_type
|
||||
|
||||
var screen_region_offset = Vector2.ZERO
|
||||
|
||||
func set_type(val):
|
||||
computer_type = val
|
||||
match computer_type:
|
||||
ComputerType.ShipCommand:
|
||||
screen_region_offset = Vector2(0, 0)
|
||||
ComputerType.Comms:
|
||||
screen_region_offset = Vector2(0, 32)
|
||||
ComputerType.Medical:
|
||||
screen_region_offset = Vector2(0, 64)
|
||||
ComputerType.Research:
|
||||
screen_region_offset = Vector2(128, 0)
|
||||
ComputerType.ShipEngine:
|
||||
screen_region_offset = Vector2(128, 224)
|
||||
ComputerType.Atmos:
|
||||
screen_region_offset = Vector2(0, 256)
|
||||
# Refresh sprite
|
||||
set_direction(direction)
|
||||
|
||||
func set_direction(dir):
|
||||
direction = dir
|
||||
match direction:
|
||||
Direction.DOWN:
|
||||
$computer.region_rect.position = Vector2(0, 0)
|
||||
$computer/screen.region_rect.position = screen_region_offset + Vector2(0, 0)
|
||||
Direction.UP:
|
||||
$computer.region_rect.position = Vector2(0, 32)
|
||||
$computer/screen.region_rect.position = screen_region_offset + Vector2(32, 0)
|
||||
Direction.LEFT:
|
||||
$computer.region_rect.position = Vector2(32, 32)
|
||||
$computer/screen.region_rect.position = screen_region_offset + Vector2(96, 0)
|
||||
Direction.RIGHT:
|
||||
$computer.region_rect.position = Vector2(32, 0)
|
||||
$computer/screen.region_rect.position = screen_region_offset + Vector2(64, 0)
|
65
Actors/Objects/Computer/Computer.tscn
Normal file
65
Actors/Objects/Computer/Computer.tscn
Normal file
|
@ -0,0 +1,65 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Graphics/tgstation/computer-screens.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Graphics/tgstation/computer.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Actors/Objects/Computer/Computer.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "off"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("computer/screen:modulate")
|
||||
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": [ Color( 0, 0, 0, 1 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "on"
|
||||
length = 5.5
|
||||
loop = true
|
||||
step = 0.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("computer/screen:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.63955, 0.93955, 2.44742, 2.74742, 4.94041, 4.98068, 5.01527, 5.0544, 5.08947 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 0.682353, 0.682353, 0.682353, 1 ), Color( 1, 1, 1, 1 ), Color( 0.682353, 0.682353, 0.682353, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0.584314, 0.584314, 0.584314, 1 ), Color( 1, 1, 1, 1 ), Color( 0.584314, 0.584314, 0.584314, 1 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="Computer" type="StaticBody2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="computer" type="Sprite" parent="."]
|
||||
texture = ExtResource( 2 )
|
||||
centered = false
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[node name="screen" type="Sprite" parent="computer"]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 16, 16 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "on"
|
||||
anims/off = SubResource( 2 )
|
||||
anims/on = SubResource( 3 )
|
|
@ -3,11 +3,11 @@
|
|||
[ext_resource path="res://Actors/Objects/Door/Door.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Graphics/tgstation/opening-sheet.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 64, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 32, 32, 32, 32 )
|
||||
|
||||
|
@ -15,22 +15,22 @@ region = Rect2( 32, 32, 32, 32 )
|
|||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 32, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=6]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 5 ), SubResource( 4 ), SubResource( 3 ), SubResource( 2 ), SubResource( 1 ) ],
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
|
||||
"loop": false,
|
||||
"name": "close",
|
||||
"speed": 20.0
|
||||
}, {
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
|
||||
"frames": [ SubResource( 5 ), SubResource( 4 ), SubResource( 3 ), SubResource( 2 ), SubResource( 1 ) ],
|
||||
"loop": false,
|
||||
"name": "open",
|
||||
"speed": 20.0
|
||||
|
@ -39,7 +39,7 @@ animations = [ {
|
|||
[sub_resource type="RectangleShape2D" id=7]
|
||||
extents = Vector2( 16, 16 )
|
||||
|
||||
[node name="Node2D" type="StaticBody2D"]
|
||||
[node name="Door" type="StaticBody2D"]
|
||||
input_pickable = true
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
|
|
@ -1,21 +1,78 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
const SPEED = 320.0
|
||||
const BASE_SPEED = 300.0
|
||||
const EPSILON = 0.1
|
||||
const MAX_STAMINA = 3.0
|
||||
const BOOST_COEFF = 50.0
|
||||
const STAMINA_RECOVER_RATE = 0.3
|
||||
|
||||
var velocity = Vector2.ZERO
|
||||
var grip = 1.0
|
||||
var stamina = MAX_STAMINA
|
||||
var speed_boost = 0
|
||||
|
||||
export(NodePath) var mapNode
|
||||
onready var map = get_node(mapNode) as Map
|
||||
|
||||
export var is_controlled = false setget set_is_controlled
|
||||
|
||||
func _ready():
|
||||
$Camera.current = is_controlled
|
||||
|
||||
func _physics_process(_delta):
|
||||
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)
|
||||
|
||||
# Check sprinting
|
||||
var speed = BASE_SPEED
|
||||
if Input.is_action_pressed("sprint"):
|
||||
if motion.length() > EPSILON and stamina > 0:
|
||||
speed_boost += BOOST_COEFF * delta * ease(stamina/MAX_STAMINA, 1.1)
|
||||
stamina -= delta
|
||||
update()
|
||||
else:
|
||||
if stamina < MAX_STAMINA:
|
||||
stamina += delta * STAMINA_RECOVER_RATE
|
||||
update()
|
||||
|
||||
# Apply friction to speed boost and the boost itself, if any
|
||||
if speed_boost > 0:
|
||||
speed_boost /= 2
|
||||
speed *= 1.0 + speed_boost
|
||||
if speed_boost < EPSILON:
|
||||
speed_boost = 0
|
||||
|
||||
# Set velocity
|
||||
velocity = velocity * (1.0-grip) + motion.clamped(1.0) * speed * grip
|
||||
velocity = move_and_slide(velocity)
|
||||
|
||||
# Check what tile I'm on
|
||||
var tilemap = map.tilemap as TileMap
|
||||
var cell = tilemap.get_cellv(tilemap.world_to_map(transform.origin))
|
||||
match cell:
|
||||
-1: # I'm in outer space!
|
||||
grip = 0
|
||||
_:
|
||||
grip = 1
|
||||
|
||||
func set_is_controlled(val):
|
||||
is_controlled = val
|
||||
$Camera.current = val
|
||||
|
||||
func _draw():
|
||||
if stamina+EPSILON < MAX_STAMINA:
|
||||
draw_circle_arc_poly(Vector2(-10, -30), 6, 0, stamina/MAX_STAMINA * 360, Color.orange)
|
||||
|
||||
func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
|
||||
var nb_points = 32
|
||||
var points_arc = PoolVector2Array()
|
||||
points_arc.push_back(center)
|
||||
var colors = PoolColorArray([color])
|
||||
|
||||
for i in range(nb_points + 1):
|
||||
var angle_point = deg2rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
|
||||
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
|
||||
draw_polygon(points_arc, colors)
|
||||
|
|
BIN
Graphics/tgstation/computer-screens.png
Normal file
BIN
Graphics/tgstation/computer-screens.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
34
Graphics/tgstation/computer-screens.png.import
Normal file
34
Graphics/tgstation/computer-screens.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/computer-screens.png-7928a3d734fcaf9eb632492d13eb7e21.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Graphics/tgstation/computer-screens.png"
|
||||
dest_files=[ "res://.import/computer-screens.png-7928a3d734fcaf9eb632492d13eb7e21.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/computer.png
Normal file
BIN
Graphics/tgstation/computer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
34
Graphics/tgstation/computer.png.import
Normal file
34
Graphics/tgstation/computer.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/computer.png-aa76233a47920b82550cd93d2eb283bb.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Graphics/tgstation/computer.png"
|
||||
dest_files=[ "res://.import/computer.png-aa76233a47920b82550cd93d2eb283bb.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
|
|
@ -3,9 +3,9 @@
|
|||
[ext_resource path="res://Graphics/tgstation/2x2.tres" type="TileSet" id=1]
|
||||
[ext_resource path="res://Graphics/tgstation/1x1.tres" type="TileSet" id=2]
|
||||
[ext_resource path="res://Scenes/Rendering/MapTiles.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Graphics/tgstation/objects.tres" type="TileSet" id=4]
|
||||
[ext_resource path="res://Actors/Objects/Door/Door.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://Scenes/Map.gd" type="Script" id=5]
|
||||
[ext_resource path="res://Scenes/Maps/Objects.gd" type="Script" id=6]
|
||||
[ext_resource path="res://Actors/Objects/Computer/Computer.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://Graphics/space.png" type="Texture" id=7]
|
||||
|
||||
[node name="map" type="Node2D"]
|
||||
|
@ -23,21 +23,38 @@ cell_size = Vector2( 32, 32 )
|
|||
cell_quadrant_size = 32
|
||||
occluder_light_mask = -2147483647
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 262137, 2, 0, 262138, 2, 0, 262139, 2, 0, 262140, 2, 0, 262141, 2, 0, 262142, 2, 0, 262143, 2, 0, 196608, 2, 0, 196609, 2, 0, 196610, 2, 0, 196611, 2, 0, 196612, 2, 0, 196613, 2, 0, 196614, 2, 0, 196615, 2, 0, 196616, 2, 0, 196617, 2, 0, 196618, 2, 0, 196619, 2, 0, 196620, 2, 0, 196621, 2, 0, 196622, 2, 0, 196623, 2, 0, 196624, 2, 0, 196625, 2, 0, 196626, 2, 0, 196627, 2, 0, 327673, 2, 0, 327674, 1, 0, 327675, 1, 0, 327676, 1, 0, 327677, 1, 0, 327678, 1, 0, 327679, 2, 0, 262144, 1, 0, 262145, 1, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262158, 1, 0, 262159, 1, 0, 262160, 1, 0, 262161, 1, 0, 262162, 1, 0, 262163, 3, 0, 393209, 2, 0, 393210, 1, 0, 393211, 1, 0, 393212, 1, 0, 393213, 1, 0, 393214, 1, 0, 393215, 2, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 1, 0, 327692, 1, 0, 327693, 2, 0, 327694, 1, 0, 327695, 1, 0, 327696, 1, 0, 327697, 1, 0, 327698, 1, 0, 327699, 3, 0, 458745, 2, 0, 458746, 1, 0, 458747, 1, 0, 458748, 1, 0, 458749, 1, 0, 458750, 1, 0, 458751, 1, 0, 393216, 1, 0, 393217, 1, 0, 393218, 1, 0, 393219, 1, 0, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 1, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 393229, 1, 0, 393230, 1, 0, 393231, 1, 0, 393232, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 3, 0, 524281, 2, 0, 524282, 1, 0, 524283, 1, 0, 524284, 1, 0, 524285, 1, 0, 524286, 1, 0, 524287, 3, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 3, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 2, 0, 589817, 2, 0, 589818, 1, 0, 589819, 1, 0, 589820, 1, 0, 589821, 1, 0, 589822, 1, 0, 589823, 3, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524292, 1, 0, 524293, 1, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 3, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 2, 0, 655353, 2, 0, 655354, 1, 0, 655355, 1, 0, 655356, 1, 0, 655357, 1, 0, 655358, 1, 0, 655359, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 1, 0, 589831, 1, 0, 589832, 1, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 589837, 1, 0, 589838, 1, 0, 589839, 1, 0, 589840, 1, 0, 589841, 1, 0, 589842, 1, 0, 589843, 3, 0, 720889, 2, 0, 720890, 1, 0, 720891, 1, 0, 720892, 1, 0, 720893, 1, 0, 720894, 1, 0, 720895, 2, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 1, 0, 655372, 1, 0, 655373, 2, 0, 655374, 1, 0, 655375, 1, 0, 655376, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 3, 0, 786425, 2, 0, 786426, 1, 0, 786427, 1, 0, 786428, 1, 0, 786429, 1, 0, 786430, 1, 0, 786431, 2, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720900, 1, 0, 720901, 1, 0, 720902, 1, 0, 720903, 1, 0, 720904, 1, 0, 720905, 1, 0, 720906, 1, 0, 720907, 1, 0, 720908, 1, 0, 720909, 2, 0, 720910, 1, 0, 720911, 1, 0, 720912, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 3, 0, 851961, 2, 0, 851962, 2, 0, 851963, 2, 0, 851964, 2, 0, 851965, 2, 0, 851966, 2, 0, 851967, 2, 0, 786432, 2, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 2, 0, 786437, 2, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 2, 0, 786442, 2, 0, 786443, 2, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 2, 0, 786449, 2, 0, 786450, 2, 0, 786451, 2, 0 )
|
||||
tile_data = PoolIntArray( 262137, 2, 0, 262138, 2, 0, 262139, 2, 0, 262140, 2, 0, 262141, 2, 0, 262142, 2, 0, 262143, 2, 0, 196608, 2, 0, 196609, 2, 0, 196610, 2, 0, 196611, 2, 0, 196612, 2, 0, 196613, 2, 0, 196614, 2, 0, 196615, 2, 0, 196616, 2, 0, 196617, 2, 0, 196618, 2, 0, 196619, 2, 0, 196620, 2, 0, 196621, 2, 0, 196622, 2, 0, 196623, 2, 0, 196624, 2, 0, 196625, 2, 0, 196626, 2, 0, 196627, 2, 0, 327673, 2, 0, 327674, 1, 0, 327675, 1, 0, 327676, 1, 0, 327677, 1, 0, 327678, 1, 0, 327679, 2, 0, 262144, 1, 0, 262145, 1, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262158, 1, 0, 262159, 1, 0, 262160, 1, 0, 262161, 1, 0, 262162, 1, 0, 262163, 3, 0, 393209, 2, 0, 393210, 1, 0, 393211, 1, 0, 393212, 1, 0, 393213, 1, 0, 393214, 1, 0, 393215, 2, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 1, 0, 327692, 1, 0, 327693, 2, 0, 327694, 1, 0, 327695, 1, 0, 327696, 1, 0, 327697, 1, 0, 327698, 1, 0, 327699, 3, 0, 458745, 2, 0, 458746, 1, 0, 458747, 1, 0, 458748, 1, 0, 458749, 1, 0, 458750, 1, 0, 458751, 1, 0, 393216, 1, 0, 393217, 1, 0, 393218, 1, 0, 393219, 1, 0, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 1, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 393229, 1, 0, 393230, 1, 0, 393231, 1, 0, 393232, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 3, 0, 524281, 2, 0, 524282, 1, 0, 524283, 1, 0, 524284, 1, 0, 524285, 1, 0, 524286, 1, 0, 524287, 3, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 3, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 2, 0, 589817, 2, 0, 589818, 1, 0, 589819, 1, 0, 589820, 1, 0, 589821, 1, 0, 589822, 1, 0, 589823, 3, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524292, 1, 0, 524293, 1, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 3, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 2, 0, 655353, 2, 0, 655354, 1, 0, 655355, 1, 0, 655356, 1, 0, 655357, 1, 0, 655358, 1, 0, 655359, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 1, 0, 589831, 1, 0, 589832, 1, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 589837, 1, 0, 589838, 1, 0, 589839, 1, 0, 589840, 1, 0, 589841, 1, 0, 589842, 1, 0, 589843, 3, 0, 720889, 2, 0, 720890, 1, 0, 720891, 1, 0, 720892, 1, 0, 720893, 1, 0, 720894, 1, 0, 720895, 2, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 1, 0, 655372, 1, 0, 655373, 2, 0, 655374, 1, 0, 655375, 1, 0, 655376, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 3, 0, 786425, 2, 0, 786426, 1, 0, 786427, 1, 0, 786428, 1, 0, 786429, 1, 0, 786430, 1, 0, 786431, 2, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720900, 1, 0, 720901, 1, 0, 720902, 1, 0, 720903, 1, 0, 720904, 1, 0, 720905, 1, 0, 720906, 1, 0, 720907, 1, 0, 720908, 1, 0, 720909, 2, 0, 720910, 1, 0, 720911, 1, 0, 720912, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 3, 0, 851961, 2, 0, 851962, 2, 0, 851963, 2, 0, 851964, 2, 0, 851965, 2, 0, 851966, 2, 0, 851967, 2, 0, 786432, 2, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 2, 0, 786437, 1, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 2, 0, 786442, 2, 0, 786443, 2, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 2, 0, 786449, 2, 0, 786450, 2, 0, 786451, 2, 0 )
|
||||
script = ExtResource( 3 )
|
||||
extended_tilemap_node = NodePath("../1x1")
|
||||
|
||||
[node name="Objects" type="TileMap" parent="."]
|
||||
tile_set = ExtResource( 4 )
|
||||
cell_size = Vector2( 32, 32 )
|
||||
cell_quadrant_size = 32
|
||||
occluder_light_mask = -2147483647
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 458751, 3, 0, 393229, 3, 0, 655359, 3, 0, 589837, 3, 0 )
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="1x1" type="TileMap" parent="."]
|
||||
light_mask = 2
|
||||
tile_set = ExtResource( 2 )
|
||||
cell_size = Vector2( 16, 16 )
|
||||
format = 1
|
||||
|
||||
[node name="objects" type="Node2D" parent="."]
|
||||
|
||||
[node name="BridgeDoor" parent="objects" instance=ExtResource( 4 )]
|
||||
position = Vector2( 416, 192 )
|
||||
|
||||
[node name="BridgeDoor2" parent="objects" instance=ExtResource( 4 )]
|
||||
position = Vector2( 416, 288 )
|
||||
|
||||
[node name="EngineDoor" parent="objects" instance=ExtResource( 4 )]
|
||||
position = Vector2( -32, 192 )
|
||||
|
||||
[node name="EngineDoor2" parent="objects" instance=ExtResource( 4 )]
|
||||
position = Vector2( -32, 288 )
|
||||
|
||||
[node name="Airlock" parent="objects" instance=ExtResource( 4 )]
|
||||
position = Vector2( 160, 384 )
|
||||
|
||||
[node name="ControlComp" parent="objects" instance=ExtResource( 6 )]
|
||||
position = Vector2( 576, 256 )
|
||||
direction = 0
|
||||
|
||||
[node name="CommsComp" parent="objects" instance=ExtResource( 6 )]
|
||||
position = Vector2( 576, 224 )
|
||||
direction = 0
|
||||
computer_type = 1
|
||||
|
|
|
@ -4,6 +4,7 @@ class_name Occluder
|
|||
|
||||
const MAX_LENGTH = 200
|
||||
const EPSILON = 0.1
|
||||
const DEBUG = false
|
||||
|
||||
var ignore_sides = [false, false, false, false]
|
||||
var size = Vector2(32, 32)
|
||||
|
@ -32,11 +33,20 @@ func _draw():
|
|||
var previous = (current - 1) % polygon.size()
|
||||
|
||||
if not ignore_sides[current] and not edges[current]:
|
||||
draw_polygon([
|
||||
var points = [
|
||||
(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])
|
||||
]
|
||||
draw_polygon(points, [Color.black])
|
||||
if DEBUG:
|
||||
draw_polyline(points, Color.rebeccapurple)
|
||||
else:
|
||||
if DEBUG:
|
||||
if ignore_sides[current]:
|
||||
draw_line(polygon[current], polygon[next], Color.red, 1)
|
||||
else:
|
||||
draw_line(polygon[current], polygon[next], Color.yellow, 2)
|
||||
|
||||
func _process(_delta):
|
||||
update()
|
||||
|
|
|
@ -15,6 +15,7 @@ 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 )
|
||||
position = Vector2( 206.017, 250.966 )
|
||||
z_index = 1
|
||||
mapNode = NodePath("../map")
|
||||
is_controlled = true
|
||||
|
|
|
@ -43,28 +43,46 @@ window/size/height=800
|
|||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
"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":16777221,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_select={
|
||||
"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":32,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_cancel={
|
||||
"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":16777217,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
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)
|
||||
]
|
||||
}
|
||||
sprint={
|
||||
"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":16777237,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue