Add plating and separate layers
This commit is contained in:
parent
2e8ed847c9
commit
dee8e3d29d
12 changed files with 137 additions and 51 deletions
12
Actors/Player/Player.gd
Executable file → Normal file
12
Actors/Player/Player.gd
Executable file → Normal file
|
@ -12,7 +12,7 @@ var stamina = MAX_STAMINA
|
|||
var speed_boost = 0
|
||||
|
||||
export(NodePath) var mapNode
|
||||
onready var map = get_node(mapNode) as Map
|
||||
onready var map = get_node(mapNode) as GameMap
|
||||
|
||||
export var is_controlled = false setget set_is_controlled
|
||||
|
||||
|
@ -50,13 +50,11 @@ func _physics_process(delta):
|
|||
velocity = move_and_slide(velocity)
|
||||
|
||||
# Check what tile I'm on
|
||||
var tilemap = map.tilemap as TileMap
|
||||
grip = 0.0
|
||||
for tilemap in map.tilemaps:
|
||||
var cell = tilemap.get_cellv(tilemap.world_to_map(transform.origin))
|
||||
match cell:
|
||||
-1: # I'm in outer space!
|
||||
grip = 0
|
||||
_:
|
||||
grip = 1
|
||||
if cell >= 0:
|
||||
grip = 1.0
|
||||
|
||||
func set_is_controlled(val):
|
||||
is_controlled = val
|
||||
|
|
19
Graphics/tgstation/base.tres
Normal file
19
Graphics/tgstation/base.tres
Normal file
|
@ -0,0 +1,19 @@
|
|||
[gd_resource type="TileSet" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Graphics/tgstation/plating.png" type="Texture" id=1]
|
||||
|
||||
[resource]
|
||||
0/name = "Plating"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 32, 32 )
|
||||
0/tile_mode = 0
|
||||
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_one_way = false
|
||||
0/shape_one_way_margin = 0.0
|
||||
0/shapes = [ ]
|
||||
0/z_index = 0
|
19
Graphics/tgstation/floor.tres
Normal file
19
Graphics/tgstation/floor.tres
Normal file
|
@ -0,0 +1,19 @@
|
|||
[gd_resource type="TileSet" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Graphics/tgstation/floor.png" type="Texture" id=1]
|
||||
|
||||
[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
|
BIN
Graphics/tgstation/plating.png
Normal file
BIN
Graphics/tgstation/plating.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 363 B |
34
Graphics/tgstation/plating.png.import
Normal file
34
Graphics/tgstation/plating.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/plating.png-6c02ffa713ad1caa99591c65b875496f.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Graphics/tgstation/plating.png"
|
||||
dest_files=[ "res://.import/plating.png-6c02ffa713ad1caa99591c65b875496f.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
|
|
@ -1,6 +1,5 @@
|
|||
[gd_resource type="TileSet" load_steps=6 format=2]
|
||||
[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]
|
||||
[ext_resource path="res://Graphics/tgstation/window.png" type="Texture" id=3]
|
||||
|
||||
|
@ -11,20 +10,6 @@ points = PoolVector2Array( 32, 32, 0, 32, 0, 0, 32, 0 )
|
|||
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
|
||||
|
||||
[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 )
|
|
@ -1,7 +1,7 @@
|
|||
tool
|
||||
extends Node2D
|
||||
|
||||
class_name Map
|
||||
class_name GameMap
|
||||
|
||||
var ship_direction = 0
|
||||
var ship_speed = 1000
|
||||
|
@ -13,8 +13,7 @@ const SPEED_EASE = 0.5
|
|||
const DIRECTION_EASE = 0.5
|
||||
const EPSILON = 0.01
|
||||
|
||||
export(NodePath) var tilemap_path
|
||||
onready var tilemap = get_node(tilemap_path) as MapTiles
|
||||
var tilemaps = []
|
||||
|
||||
export var unlit = false setget set_unlit
|
||||
onready var darkness = $darkness
|
||||
|
|
9
Scenes/Maps/odyssey.gd
Normal file
9
Scenes/Maps/odyssey.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends GameMap
|
||||
|
||||
func _ready():
|
||||
tilemaps = [
|
||||
$base,
|
||||
$cables,
|
||||
$floor,
|
||||
$walls
|
||||
]
|
File diff suppressed because one or more lines are too long
|
@ -5,10 +5,6 @@ class_name MapTiles
|
|||
export(NodePath) var extended_tilemap_node
|
||||
export var occluders = ["Wall"]
|
||||
|
||||
export var replace_with = {
|
||||
"Window": "Floor"
|
||||
}
|
||||
|
||||
export var shadow_intensity = 0.2
|
||||
|
||||
onready var extended_tilemap = get_node(extended_tilemap_node) as TileMap
|
||||
|
@ -28,10 +24,6 @@ func convert_extended():
|
|||
if extended_id < 0:
|
||||
# Not found, skip it
|
||||
continue
|
||||
# Check if a replacement exists (for flooring)
|
||||
var replacement = -1
|
||||
if replace_with.has(name):
|
||||
replacement = tile_set.find_tile_by_name(replace_with[name])
|
||||
# Find all uses of this tile
|
||||
for cell in get_used_cells_by_id(id):
|
||||
var x = cell.x * 2
|
||||
|
@ -40,7 +32,7 @@ func convert_extended():
|
|||
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, replacement)
|
||||
set_cellv(cell, -1)
|
||||
extended_tilemap.update_bitmask_region()
|
||||
extended_tilemap.update_dirty_quadrants()
|
||||
|
||||
|
|
5
Scenes/World.gd
Executable file → Normal file
5
Scenes/World.gd
Executable file → Normal file
|
@ -6,7 +6,8 @@ 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
|
||||
onready var map = get_node(map_path) as GameMap
|
||||
|
||||
func _ready():
|
||||
map.tilemap.set_occluder_origin(player)
|
||||
for tilemap in map.tilemaps:
|
||||
tilemap.set_occluder_origin(player)
|
||||
|
|
|
@ -19,6 +19,11 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://Scenes/Game.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "GameMap",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scenes/Map.gd"
|
||||
}, {
|
||||
"base": "StaticBody2D",
|
||||
"class": "GameObjectComputer",
|
||||
"language": "GDScript",
|
||||
|
@ -49,11 +54,6 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://Scenes/World.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "Map",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scenes/Map.gd"
|
||||
}, {
|
||||
"base": "TileMap",
|
||||
"class": "MapTiles",
|
||||
"language": "GDScript",
|
||||
|
@ -72,13 +72,13 @@ _global_script_classes=[ {
|
|||
_global_script_class_icons={
|
||||
"ActivationRange": "",
|
||||
"GameInstance": "",
|
||||
"GameMap": "",
|
||||
"GameObjectComputer": "",
|
||||
"GameObjectDoor": "",
|
||||
"GameObjectEngine": "",
|
||||
"GameObjectLightbulb": "",
|
||||
"GameUI": "",
|
||||
"GameWorld": "",
|
||||
"Map": "",
|
||||
"MapTiles": "",
|
||||
"Occluder": "",
|
||||
"UICommand": ""
|
||||
|
|
Reference in a new issue