Added a simple tileset, and started working on the world.

This commit is contained in:
Relintai 2019-12-22 18:29:26 +01:00
parent a1bc2a96b3
commit 6e22c897fc
17 changed files with 217 additions and 91 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/tiles.png-e2511033dcd256f37e06e0319c180cc2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://data/tilesets/tiles.png"
dest_files=[ "res://.import/tiles.png-e2511033dcd256f37e06e0319c180cc2.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=false
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@ -0,0 +1,50 @@
[gd_resource type="TileSet" load_steps=5 format=2]
[ext_resource path="res://data/tilesets/tiles.png" type="Texture" id=1]
[sub_resource type="NavigationPolygon" id=1]
vertices = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
[sub_resource type="NavigationPolygon" id=2]
vertices = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
[sub_resource type="NavigationPolygon" id=3]
vertices = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
[resource]
0/name = "Grass"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 32, 32, 32, 32 )
0/tile_mode = 0
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/navigation = SubResource( 1 )
0/shapes = [ ]
0/z_index = 0
1/name = "Grass Variant"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 96, 0, 32, 32 )
1/tile_mode = 0
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/navigation = SubResource( 2 )
1/shapes = [ ]
1/z_index = 0
2/name = "Grass Variant 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 96, 32, 32, 32 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/navigation = SubResource( 3 )
2/shapes = [ ]
2/z_index = 0

View File

@ -7,8 +7,6 @@ enum GenType {
}
export(MeshDataResource) var prop_mesht : MeshDataResource
export(int) var gen_type : int = GenType.NORMAL
export(int) var _level_seed : int

View File

@ -1,74 +0,0 @@
extends Spatial
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
export (float) var max_camera_distance : float = 20.0
var target_camera_distance : float = 6.0
var camera_distance : float = target_camera_distance
var camera : Camera
var x_rot : float = 0.0
var y_rot : float = 0.0
var player : Entity
func _ready() -> void:
camera = $Camera
camera.translation.z = target_camera_distance
player = get_node("..")
set_physics_process(true)
func _physics_process(delta):
var pos : Vector3 = to_global(Vector3())
var space_state = get_world().direct_space_state
var result : Dictionary = space_state.intersect_ray(pos, to_global(Vector3(0, 0, target_camera_distance)), [player], player.collision_mask)
if result:
camera_distance = (result.position - pos).length() - 0.2
else:
camera_distance = target_camera_distance
camera.translation.z = camera_distance
func camera_distance_set_delta(delta : float) -> void:
target_camera_distance += delta
if target_camera_distance > max_camera_distance:
target_camera_distance = max_camera_distance
elif target_camera_distance < 0:
target_camera_distance = 0
func rotate_delta(x_delta : float, y_delta : float) -> void:
x_rot += y_delta
y_rot += x_delta
x_rot = clamp(x_rot, -90, 90)
if y_rot >= 360:
y_rot = y_rot - 360
if y_rot < 0:
y_rot = y_rot + 360
rotation_degrees = Vector3(x_rot, y_rot, 0.0)
func get_y_rot() -> float:
return y_rot
func set_y_rot(yrot : float) -> void:
y_rot = yrot
rotation_degrees = Vector3(x_rot, y_rot, 0.0)
func a_process(delta : float) -> void:
y_rot += delta
rotation_degrees = Vector3(x_rot, y_rot, 0.0)

View File

@ -1,6 +1,29 @@
extends CharacterSkeleton
class_name CharacterSkeleton2D
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
# Copyright (c) 2019 Péter Magyar
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export (NodePath) var front_node_path : NodePath = ""
export (NodePath) var front_animation_player_path : NodePath = ""
export (NodePath) var front_animation_tree_path : NodePath = ""

View File

@ -1,8 +1,27 @@
extends Entity
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
# Copyright (c) 2019 Péter Magyar
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
export (float) var MOUSE_SENSITIVITY : float = 0.05
export (String) var map_path : String

View File

@ -1,6 +1,29 @@
extends CharacterBones
class_name HumanoidCharacterBones2D
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
# Copyright (c) 2019 Péter Magyar
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
enum HumanoidBones {
HUMANOID_BONE_HIP = 0,
HUMANOID_BONE_TORSO = 1,

View File

@ -10,8 +10,6 @@ radius = 20.0
[node name="Mob" type="Entity" groups=[
"mobs",
]]
collision_layer = 3
collision_mask = 3
character_skeleton_path = NodePath("Character")
script = ExtResource( 2 )

View File

@ -1,8 +1,27 @@
extends Entity
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
# Copyright (c) 2019 Péter Magyar
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Declare member variables here. Examples:
# var a = 2

View File

@ -215,7 +215,7 @@ func _unhandled_input(event: InputEvent) -> void:
func target(position : Vector2):
var space_state = get_world_2d().direct_space_state
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], 2)
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], get_collision_layer())
#var results = space_state.intersect_point(position, 32, [], 2)
if results:
@ -231,7 +231,7 @@ func target(position : Vector2):
func cmouseover(event):
var space_state = get_world_2d().direct_space_state
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], 2)
var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], get_collision_layer())
#var results = space_state.intersect_point(position, 32, [], 2)
if results:

View File

@ -10,8 +10,6 @@ radius = 8.0
[node name="Player" type="Entity" groups=[
"players",
]]
collision_layer = 3
collision_mask = 3
character_skeleton_path = NodePath("Character")
script = ExtResource( 2 )

View File

@ -291,6 +291,7 @@ actionbar_1_12={
quality/driver/driver_name="GLES2"
quality/driver/fallback_to_gles2=true
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
quality/directional_shadow/size.mobile=1024
quality/shading/force_vertex_shading=true

View File

@ -1,4 +1,10 @@
extends Navigation2D
extends Node2D
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
export(PackedScene) var world_layer : PackedScene
export(bool) var editor_generate : bool = false setget set_editor_generate, get_editor_generate
export(bool) var show_loading_screen : bool = true
@ -12,8 +18,17 @@ var _player_file_name : String
var _player : Entity
func _ready():
get_layer(2)
pass # Replace with function body.
func get_layer(index : int) -> Navigation2D:
var ch : Navigation2D = get_child(index)
return ch
func load_character(file_name: String) -> void:
_player_file_name = file_name
_player = Entities.load_player(file_name, Vector2(5, 5), 1) as Entity

View File

@ -1,8 +1,13 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/World.gd" type="Script" id=1]
[ext_resource path="res://world/WorldLayer.tscn" type="PackedScene" id=2]
[ext_resource path="res://world/WorldLayer.gd" type="Script" id=3]
[node name="World" type="Navigation2D" groups=[
[node name="World" type="Node2D" groups=[
"save",
]]
script = ExtResource( 1 )
[node name="WorldLayer" parent="." instance=ExtResource( 2 )]
script = ExtResource( 3 )

6
game/world/WorldLayer.gd Normal file
View File

@ -0,0 +1,6 @@
extends Navigation2D
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

File diff suppressed because one or more lines are too long