mirror of
https://github.com/Relintai/broken_seals_2d.git
synced 2025-03-08 06:27:02 +01:00
Ported and updated entity scripts, also added my crappy test character, and a tileset from a test project while ago.
This commit is contained in:
parent
224c4f85a2
commit
161a881511
@ -55,7 +55,7 @@ func despawn_for(player : Entity, target: Entity) -> void:
|
||||
# print("despawnfor " + target.name)
|
||||
rpc_id(player.get_network_master(), "creceive_despawn_for", target.get_path())
|
||||
|
||||
remote func creceive_spawn_for(data: String, global_name : String, position: Vector3) -> void:
|
||||
remote func creceive_spawn_for(data: String, global_name : String, position: Vector2) -> void:
|
||||
# print("recspawnfor " + global_name)
|
||||
var entity : Entity = networked_player_scene.instance()
|
||||
|
||||
@ -79,7 +79,7 @@ remote func creceive_despawn_for(path : NodePath) -> void:
|
||||
if ent:
|
||||
ent.queue_free()
|
||||
|
||||
func spawn_networked_player_from_data(data : String, position : Vector3, network_owner : int) -> Entity:
|
||||
func spawn_networked_player_from_data(data : String, position : Vector2, network_owner : int) -> Entity:
|
||||
var entity : Entity = networked_player_scene.instance()
|
||||
|
||||
_next_entity_guid += 1
|
||||
@ -102,7 +102,7 @@ func spawn_networked_player_from_data(data : String, position : Vector3, network
|
||||
|
||||
return entity
|
||||
|
||||
puppet func spawn_owned_player(data : String, position : Vector3) -> void:
|
||||
puppet func spawn_owned_player(data : String, position : Vector2) -> void:
|
||||
var entity : Entity = player_scene.instance()
|
||||
|
||||
var spawn_parent = _spawn_parent.current_scene
|
||||
@ -118,7 +118,7 @@ puppet func spawn_owned_player(data : String, position : Vector3) -> void:
|
||||
Logger.info("Player spawned ")
|
||||
|
||||
|
||||
func load_player(file_name : String, position : Vector3, network_owner : int) -> Entity:
|
||||
func load_player(file_name : String, position : Vector2, network_owner : int) -> Entity:
|
||||
# var createinfo : EntityCreateInfo = EntityCreateInfo.new()
|
||||
#
|
||||
# var cls : EntityData = Entities.get_player_character_data(class_id)
|
||||
@ -142,7 +142,7 @@ func load_player(file_name : String, position : Vector3, network_owner : int) ->
|
||||
|
||||
entity.from_dict(load_file(file_name))
|
||||
|
||||
entity.translation = position
|
||||
entity.position = position
|
||||
# entity.initialize(createinfo)
|
||||
entity.set_network_master(network_owner)
|
||||
|
||||
@ -187,7 +187,7 @@ func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Enti
|
||||
|
||||
return entity
|
||||
|
||||
func spawn_networked_player(class_id : int, position : Vector3, name : String, node_name : String, sid : int) -> Entity:
|
||||
func spawn_networked_player(class_id : int, position : Vector2, name : String, node_name : String, sid : int) -> Entity:
|
||||
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
|
||||
|
||||
var cls : EntityData = Entities.get_entity_data(class_id)
|
||||
@ -218,7 +218,7 @@ func spawn_networked_player(class_id : int, position : Vector3, name : String,
|
||||
|
||||
return entity
|
||||
|
||||
func spawn_player(class_id : int, position : Vector3, name : String, node_name : String, network_owner : int) -> Entity:
|
||||
func spawn_player(class_id : int, position : Vector2, name : String, node_name : String, network_owner : int) -> Entity:
|
||||
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
|
||||
|
||||
var cls : EntityData = Entities.get_player_character_data(class_id)
|
||||
@ -248,7 +248,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name
|
||||
|
||||
return entity
|
||||
|
||||
func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
|
||||
func spawn_mob(class_id : int, level : int, position : Vector2) -> Entity:
|
||||
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
|
||||
|
||||
var cls : EntityData = Entities.get_entity_data(class_id)
|
||||
@ -275,7 +275,7 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
|
||||
|
||||
return entity
|
||||
|
||||
func spawn(createinfo : EntityCreateInfo, networked : bool, position : Vector3, node_name : String = "") -> Entity:
|
||||
func spawn(createinfo : EntityCreateInfo, networked : bool, position : Vector2, node_name : String = "") -> Entity:
|
||||
var entity_node : Entity = null
|
||||
|
||||
if not networked:
|
||||
|
@ -162,10 +162,10 @@ remote func crequest_select_class(info : Dictionary) -> void:
|
||||
if sid == 0:
|
||||
sid = 1
|
||||
|
||||
rpc("cspawn_player", info, sid, Vector3(10, 10, 10))
|
||||
rpc("cspawn_player", info, sid, Vector2(10, 10))
|
||||
|
||||
|
||||
remotesync func cspawn_player(info : Dictionary, sid : int, pos : Vector3):
|
||||
remotesync func cspawn_player(info : Dictionary, sid : int, pos : Vector2):
|
||||
Logger.verbose("NetworkManager cspawn_player")
|
||||
|
||||
if sid == get_tree().get_network_unique_id():
|
||||
@ -193,7 +193,7 @@ func upload_character(data : String) -> void:
|
||||
rpc_id(1, "sreceive_upload_character", data)
|
||||
|
||||
master func sreceive_upload_character(data: String) -> void:
|
||||
Entities.spawn_networked_player_from_data(data, Vector3(0, 10, 0), multiplayer.get_rpc_sender_id())
|
||||
Entities.spawn_networked_player_from_data(data, Vector2(0, 0), multiplayer.get_rpc_sender_id())
|
||||
|
||||
func set_terrarin_player():
|
||||
Logger.verbose("NetworkManager cspawn_player")
|
||||
|
61
game/characters/Character.tscn
Normal file
61
game/characters/Character.tscn
Normal file
@ -0,0 +1,61 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://player/CharacterSkeleton2D.gd" type="Script" id=1]
|
||||
[ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlas2D.gd" type="Script" id=4]
|
||||
[ext_resource path="res://scripts/item_visuals/CharacterAtlasEntry2D.gd" type="Script" id=5]
|
||||
[ext_resource path="res://characters/char_t1_outline_split.png" type="Texture" id=6]
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=3]
|
||||
script = ExtResource( 5 )
|
||||
front_rect = Rect2( 101, 15, 9, 12 )
|
||||
back_rect = Rect2( 74, 18, 9, 12 )
|
||||
right_rect = Rect2( 8, 13, 9, 12 )
|
||||
left_rect = Rect2( 8, 13, 9, 12 )
|
||||
|
||||
[sub_resource type="CharacterAtlasEntry" id=2]
|
||||
script = ExtResource( 5 )
|
||||
front_rect = Rect2( 102, 2, 7, 8 )
|
||||
back_rect = Rect2( 75, 5, 7, 8 )
|
||||
right_rect = Rect2( 9, 0, 7, 8 )
|
||||
left_rect = Rect2( 9, 0, 7, 8 )
|
||||
|
||||
[sub_resource type="CharacterAtlas" id=1]
|
||||
script = ExtResource( 4 )
|
||||
comments = "HUMANOID_BONE_HIP = 0,
|
||||
HUMANOID_BONE_TORSO = 1,
|
||||
HUMANOID_BONE_LEG_R = 2,
|
||||
HUMANOID_BONE_FOOT_R = 3,
|
||||
HUMANOID_BONE_TOE_R = 4,
|
||||
HUMANOID_BONE_LEG_L = 5,
|
||||
HUMANOID_BONE_FOOT_L = 6,
|
||||
HUMANOID_BONE_TOE_L = 7,
|
||||
HUMANOID_BONE_ARM_R = 8,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_R = 0,
|
||||
HUMANOID_BONE_HAND_R = 9,
|
||||
HUMANOID_BONE_FINGERS_R = 10,
|
||||
HUMANOID_BONE_ARM_L = 11,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_L = 0,
|
||||
HUMANOID_BONE_HAND_L = 12,
|
||||
HUMANOID_BONE_FINGERS_L = 13,
|
||||
HUMANOID_BONE_HEAD = 14,
|
||||
HUMANOID_BONE_HEAD_TOP = 15,
|
||||
HUMANOID_BONES_MAX = 16,"
|
||||
texture = ExtResource( 6 )
|
||||
slots = [ null, SubResource( 3 ), null, null, null, null, null, null, null, null, null, null, null, null, SubResource( 2 ), null ]
|
||||
|
||||
[node name="Character" type="CharacterSkeleton"]
|
||||
script = ExtResource( 1 )
|
||||
front_node_path = NodePath("CharacterFrontModel")
|
||||
front_animation_player_path = NodePath("../Character/CharacterFrontModel/AnimationPlayer")
|
||||
front_animation_tree_path = NodePath("../Character/CharacterFrontModel/AnimationTree")
|
||||
side_node_path = NodePath("CharacterSideModel")
|
||||
side_animation_player_path = NodePath("../Character/CharacterSideModel/AnimationPlayer")
|
||||
side_animation_tree_path = NodePath("../Character/CharacterSideModel/AnimationTree")
|
||||
character_atlas = SubResource( 1 )
|
||||
|
||||
[node name="CharacterFrontModel" parent="." instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
|
||||
[node name="CharacterSideModel" parent="." instance=ExtResource( 2 )]
|
2386
game/characters/CharacterFrontModel.tscn
Normal file
2386
game/characters/CharacterFrontModel.tscn
Normal file
File diff suppressed because it is too large
Load Diff
2145
game/characters/CharacterSideModel.tscn
Normal file
2145
game/characters/CharacterSideModel.tscn
Normal file
File diff suppressed because it is too large
Load Diff
109
game/characters/CharacterTest1Scene.tscn
Normal file
109
game/characters/CharacterTest1Scene.tscn
Normal file
@ -0,0 +1,109 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://characters/char_t1_outline_split.png" type="Texture" id=1]
|
||||
|
||||
|
||||
[node name="CharacterTest1" type="Node2D"]
|
||||
|
||||
[node name="model" type="Sprite" parent="."]
|
||||
visible = false
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -15.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 49, 21, 13, 37 )
|
||||
|
||||
[node name="Shadow" type="Sprite" parent="."]
|
||||
position = Vector2( -0.5, 0 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 27, 57, 14, 6 )
|
||||
|
||||
[node name="RightUpperHand" type="Sprite" parent="."]
|
||||
position = Vector2( -3.5, -25.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 1, 11, 4, 9 )
|
||||
|
||||
[node name="RightLowerHand" type="Sprite" parent="."]
|
||||
position = Vector2( -3.47278, -19.9516 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 1, 23, 4, 8 )
|
||||
|
||||
[node name="Torso" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -16 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 8, 13, 9, 12 )
|
||||
|
||||
[node name="LeftShoulderGuard" type="Sprite" parent="."]
|
||||
position = Vector2( -2.5, -25 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( -1, -1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0.39, 5.79, 6.91, 4.67 )
|
||||
|
||||
[node name="Head" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -26 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 9, 0, 7, 8 )
|
||||
|
||||
[node name="LeftUpperArm" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -24 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 2.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 20, 11, 3, 9 )
|
||||
|
||||
[node name="RightShoulderGuard" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -25.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, -0.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 17.23, 5.56, 6.41, 4.89 )
|
||||
|
||||
[node name="RightUpperLeg" type="Sprite" parent="."]
|
||||
position = Vector2( -2, -13 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 5, 36, 5, 8 )
|
||||
|
||||
[node name="RightLowerLeg" type="Sprite" parent="."]
|
||||
position = Vector2( -3, -8 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 3, 48, 7, 10 )
|
||||
|
||||
[node name="LeftUpperLeg" type="Sprite" parent="."]
|
||||
position = Vector2( 2, -12.5 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 14, 36, 5, 9 )
|
||||
|
||||
[node name="LeftLowerLeg" type="Sprite" parent="."]
|
||||
position = Vector2( 2, -8 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 4 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 14, 48, 5, 10 )
|
||||
|
||||
[node name="Hip" type="Sprite" parent="."]
|
||||
position = Vector2( 0, -14 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 8, 32, 7, 2 )
|
||||
|
||||
[node name="LeftLowerArm" type="Sprite" parent="."]
|
||||
position = Vector2( 4, -18 )
|
||||
texture = ExtResource( 1 )
|
||||
offset = Vector2( 0, 2 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 20, 24, 3, 6 )
|
BIN
game/characters/char_t1_outline_split - Copy.png
Normal file
BIN
game/characters/char_t1_outline_split - Copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
34
game/characters/char_t1_outline_split - Copy.png.import
Normal file
34
game/characters/char_t1_outline_split - Copy.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/char_t1_outline_split - Copy.png-88d6d74e7874948f07096fd2e5e6ae3a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://characters/char_t1_outline_split - Copy.png"
|
||||
dest_files=[ "res://.import/char_t1_outline_split - Copy.png-88d6d74e7874948f07096fd2e5e6ae3a.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=false
|
||||
svg/scale=1.0
|
BIN
game/characters/char_t1_outline_split.png
Normal file
BIN
game/characters/char_t1_outline_split.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
34
game/characters/char_t1_outline_split.png.import
Normal file
34
game/characters/char_t1_outline_split.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/char_t1_outline_split.png-9c3f609f043903cf305339bc84929b57.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://characters/char_t1_outline_split.png"
|
||||
dest_files=[ "res://.import/char_t1_outline_split.png-9c3f609f043903cf305339bc84929b57.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=false
|
||||
svg/scale=1.0
|
@ -147,7 +147,7 @@ stat_id = 35
|
||||
|
||||
[sub_resource type="StatDataEntry" id=36]
|
||||
stat_id = 1
|
||||
base = 4.2
|
||||
base = 60.0
|
||||
modifier_apply_type = 1
|
||||
|
||||
[sub_resource type="StatDataEntry" id=37]
|
||||
|
@ -108,7 +108,7 @@ stat_id = 35
|
||||
|
||||
[sub_resource type="StatDataEntry" id=31]
|
||||
stat_id = 1
|
||||
base = 4.2
|
||||
base = 60.0
|
||||
|
||||
[sub_resource type="StatDataEntry" id=32]
|
||||
stat_id = 17
|
||||
|
121
game/player/CharacterSkeleton2D.gd
Normal file
121
game/player/CharacterSkeleton2D.gd
Normal file
@ -0,0 +1,121 @@
|
||||
extends CharacterSkeleton
|
||||
class_name CharacterSkeleton2D
|
||||
|
||||
export (NodePath) var front_node_path : NodePath = ""
|
||||
export (NodePath) var front_animation_player_path : NodePath = ""
|
||||
export (NodePath) var front_animation_tree_path : NodePath = ""
|
||||
|
||||
export (NodePath) var side_node_path : NodePath = ""
|
||||
export (NodePath) var side_animation_player_path : NodePath = ""
|
||||
export (NodePath) var side_animation_tree_path : NodePath = ""
|
||||
|
||||
export(CharacterAtlas) var character_atlas : CharacterAtlas setget set_character_atlas
|
||||
|
||||
var _atlas : CharacterAtlas2D
|
||||
|
||||
enum CharacterFacing {
|
||||
FACING_FRONT = 0,
|
||||
FACING_BACK = 1,
|
||||
FACING_RIGHT = 2,
|
||||
FACING_LEFT = 3,
|
||||
}
|
||||
|
||||
var _facing : int = 0
|
||||
|
||||
var _front_node : CharacterBones = null
|
||||
var _front_animation_player : AnimationPlayer = null
|
||||
var _front_animation_tree : AnimationTree = null
|
||||
|
||||
var _side_node : CharacterBones = null
|
||||
var _side_animation_player : AnimationPlayer = null
|
||||
var _side_animation_tree : AnimationTree = null
|
||||
|
||||
var _active_node : CharacterBones = null
|
||||
var _active_animation_player : AnimationPlayer = null
|
||||
var _active_animation_tree : AnimationTree = null
|
||||
|
||||
var _is_front_side : bool = false
|
||||
|
||||
var effects : Array
|
||||
|
||||
func _ready() -> void:
|
||||
_front_node = get_node(front_node_path) as CharacterBones
|
||||
_front_animation_player = get_node(front_animation_player_path) as AnimationPlayer
|
||||
_front_animation_tree = get_node(front_animation_tree_path) as AnimationTree
|
||||
|
||||
_side_node = get_node(side_node_path) as CharacterBones
|
||||
_side_animation_player = get_node(side_animation_player_path) as AnimationPlayer
|
||||
_side_animation_tree = get_node(side_animation_tree_path) as AnimationTree
|
||||
|
||||
set_character_atlas(character_atlas)
|
||||
|
||||
_front_node.hide()
|
||||
_side_node.show()
|
||||
_active_node = _side_node
|
||||
_active_animation_player = _side_animation_player
|
||||
_active_animation_tree = _side_animation_tree
|
||||
_is_front_side = false
|
||||
|
||||
func update_facing(input_direction : Vector2) -> void:
|
||||
var front : bool = abs(input_direction.dot(Vector2(0, 1))) > 0.9
|
||||
|
||||
if front:
|
||||
if not _is_front_side:
|
||||
_is_front_side = true
|
||||
|
||||
_side_node.hide()
|
||||
_front_node.show()
|
||||
|
||||
_active_node = _front_node
|
||||
_active_animation_tree = _front_animation_tree
|
||||
|
||||
if input_direction.y > 0:
|
||||
set_facing(CharacterFacing.FACING_FRONT)
|
||||
else:
|
||||
set_facing(CharacterFacing.FACING_BACK)
|
||||
|
||||
else:
|
||||
if _is_front_side:
|
||||
_is_front_side = false
|
||||
|
||||
_side_node.show()
|
||||
_front_node.hide()
|
||||
|
||||
_active_node = _side_node
|
||||
_active_animation_tree = _side_animation_tree
|
||||
|
||||
if input_direction.x > 0.01 and _facing != CharacterFacing.FACING_RIGHT:
|
||||
set_facing(CharacterFacing.FACING_RIGHT)
|
||||
_active_node.transform.x.x = -1
|
||||
elif input_direction.x < -0.01 and _facing != CharacterFacing.FACING_LEFT:
|
||||
set_facing(CharacterFacing.FACING_LEFT)
|
||||
_active_node.transform.x.x = 1
|
||||
|
||||
func add_effect(bone_id : int, effect : PackedScene) -> void:
|
||||
pass
|
||||
|
||||
func remove_effect(bone_id : int, effect : PackedScene) -> void:
|
||||
pass
|
||||
|
||||
func get_animation_player() -> AnimationPlayer:
|
||||
return _active_animation_player
|
||||
|
||||
func get_animation_tree() -> AnimationTree:
|
||||
return _active_animation_tree
|
||||
|
||||
func set_character_atlas(atlas : CharacterAtlas) -> void:
|
||||
character_atlas = atlas
|
||||
|
||||
_atlas = atlas as CharacterAtlas2D
|
||||
|
||||
if _front_node != null:
|
||||
_front_node.set_atlas(_atlas)
|
||||
|
||||
if _front_node != null:
|
||||
_side_node.set_atlas(_atlas)
|
||||
|
||||
func set_facing(facing : int) -> void:
|
||||
_facing = facing
|
||||
|
||||
_active_node.set_facing(facing)
|
||||
|
53
game/player/HumanoidCharacterBones2D.gd
Normal file
53
game/player/HumanoidCharacterBones2D.gd
Normal file
@ -0,0 +1,53 @@
|
||||
extends CharacterBones
|
||||
class_name HumanoidCharacterBones2D
|
||||
|
||||
enum HumanoidBones {
|
||||
HUMANOID_BONE_HIP = 0,
|
||||
HUMANOID_BONE_TORSO = 1,
|
||||
HUMANOID_BONE_LEG_R = 2,
|
||||
HUMANOID_BONE_FOOT_R = 3,
|
||||
HUMANOID_BONE_TOE_R = 4,
|
||||
HUMANOID_BONE_LEG_L = 5,
|
||||
HUMANOID_BONE_FOOT_L = 6,
|
||||
HUMANOID_BONE_TOE_L = 7,
|
||||
HUMANOID_BONE_ARM_R = 8,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_R = 0,
|
||||
HUMANOID_BONE_HAND_R = 9,
|
||||
HUMANOID_BONE_FINGERS_R = 10,
|
||||
HUMANOID_BONE_ARM_L = 11,
|
||||
#HUMANOID_BONE_SHOULDER_GUARD_L = 0,
|
||||
HUMANOID_BONE_HAND_L = 12,
|
||||
HUMANOID_BONE_FINGERS_L = 13,
|
||||
HUMANOID_BONE_HEAD = 14,
|
||||
HUMANOID_BONE_HEAD_TOP = 15,
|
||||
|
||||
HUMANOID_BONES_MAX = 16,
|
||||
}
|
||||
|
||||
export (String, MULTILINE) var help : String
|
||||
export (Array, NodePath) var bones : Array
|
||||
|
||||
var _atlas : CharacterAtlas2D
|
||||
|
||||
func set_facing(facing : int) -> void:
|
||||
if _atlas == null:
|
||||
return
|
||||
|
||||
for i in range(len(_atlas.slots)):
|
||||
var entry : CharacterAtlasEntry2D = _atlas.slots[i] as CharacterAtlasEntry2D
|
||||
|
||||
if entry == null:
|
||||
continue
|
||||
|
||||
var r : Rect2 = entry.get_index(facing) as Rect2
|
||||
|
||||
var bone : Sprite = get_node(bones[i]) as Sprite
|
||||
|
||||
if bone == null:
|
||||
continue
|
||||
|
||||
bone.region_rect = r
|
||||
|
||||
|
||||
func set_atlas(atlas : CharacterAtlas2D) -> void:
|
||||
_atlas = atlas
|
@ -30,38 +30,32 @@ var max_visible_distance_squared : float = max_visible_distance * max_visible_di
|
||||
const ray_length = 1000
|
||||
const ACCEL : float = 100.0
|
||||
const DEACCEL : float = 100.0
|
||||
const GRAVITY : float = -24.8
|
||||
const JUMP_SPEED : float = 3.8
|
||||
const MAX_SLOPE_ANGLE : float = 40.0
|
||||
|
||||
#var process_gravity : bool = true
|
||||
|
||||
var _on : bool = true
|
||||
|
||||
var y_rot : float = 0.0
|
||||
|
||||
var vel : Vector3 = Vector3()
|
||||
var dir : Vector3 = Vector3()
|
||||
var vel : Vector2 = Vector2()
|
||||
var dir : Vector2 = Vector2()
|
||||
var target_movement_direction : Vector2 = Vector2()
|
||||
|
||||
var animation_tree : AnimationTree
|
||||
var anim_node_state_machine : AnimationNodeStateMachinePlayback = null
|
||||
var animation_run : bool = false
|
||||
|
||||
var moving : bool = false
|
||||
var sleep : bool = false
|
||||
|
||||
var dead : bool = false
|
||||
var death_timer : float = 0
|
||||
|
||||
var path : = PoolVector2Array()
|
||||
var follow_path = false
|
||||
|
||||
var frame : int = 0
|
||||
|
||||
func _ready() -> void:
|
||||
animation_tree = get_character_skeleton().get_animation_tree()
|
||||
|
||||
if animation_tree != null:
|
||||
anim_node_state_machine = animation_tree["parameters/playback"]
|
||||
|
||||
animation_tree["parameters/run-loop/blend_position"] = Vector2(0, -1)
|
||||
|
||||
ai_state = EntityEnums.AI_STATE_PATROL
|
||||
|
||||
frame = randi() % 10
|
||||
|
||||
set_process(true)
|
||||
set_physics_process(true)
|
||||
@ -75,36 +69,27 @@ func _process(delta : float) -> void:
|
||||
queue_free()
|
||||
|
||||
return
|
||||
|
||||
frame += 1
|
||||
|
||||
var camera : Camera = get_tree().get_root().get_camera() as Camera
|
||||
|
||||
if camera == null:
|
||||
if frame < 10:
|
||||
return
|
||||
|
||||
frame = 0
|
||||
|
||||
var cam_pos : Vector2 = camera.global_transform.xform(Vector3())
|
||||
var dstv : Vector2 = cam_pos - position
|
||||
dstv.y = 0
|
||||
var dst : float = dstv.length_squared()
|
||||
# print(get_tree().root.get_visible_rect())
|
||||
var vpos : Vector2 = -get_tree().root.canvas_transform.get_origin() - position
|
||||
var l : float = vpos.length_squared()
|
||||
var rs : float = get_tree().root.size.x * get_tree().root.size.x
|
||||
|
||||
if dst > max_visible_distance_squared:
|
||||
if visible:
|
||||
hide()
|
||||
return
|
||||
else:
|
||||
if l < rs:
|
||||
if not visible:
|
||||
show()
|
||||
|
||||
#TODO check later if this gives a performance boost
|
||||
# var cam_facing : Vector3 = -camera.global_transform.basis.z
|
||||
# var d : float = cam_facing.dot(dstv)
|
||||
#
|
||||
# if d > 0:
|
||||
# if visible:
|
||||
# hide()
|
||||
# return
|
||||
# else:
|
||||
# if not visible:
|
||||
# show()
|
||||
set_physics_process(true)
|
||||
else:
|
||||
if visible:
|
||||
hide()
|
||||
set_physics_process(false)
|
||||
|
||||
|
||||
func _physics_process(delta : float) -> void:
|
||||
@ -119,6 +104,44 @@ func _physics_process(delta : float) -> void:
|
||||
|
||||
process_movement(delta)
|
||||
|
||||
func move_along_path(distance : float) -> void:
|
||||
var start_point : = position
|
||||
|
||||
for i in range(path.size()):
|
||||
var distance_to_next : = start_point.distance_to(path[0])
|
||||
|
||||
if distance <= distance_to_next and distance >= 0.0:
|
||||
position = start_point.linear_interpolate(path[0], distance / distance_to_next)
|
||||
break
|
||||
elif distance <= 0.0:
|
||||
position = path[0]
|
||||
follow_path = false
|
||||
break
|
||||
|
||||
#if line2d and use_line_path:
|
||||
# line2d.points = path
|
||||
|
||||
distance -= distance_to_next
|
||||
start_point = path[0]
|
||||
path.remove(0)
|
||||
|
||||
if path.size() == 0:
|
||||
follow_path = false
|
||||
|
||||
|
||||
func set_path(value : PoolVector2Array) -> void:
|
||||
path = value
|
||||
|
||||
#if line2d and use_line_path:
|
||||
# line2d.points = value
|
||||
|
||||
|
||||
if value.size() == 0:
|
||||
return
|
||||
|
||||
follow_path = true
|
||||
|
||||
|
||||
func process_movement(delta : float) -> void:
|
||||
# if starget != null:
|
||||
# look_at(starget.translation, Vector3(0, 1, 0))
|
||||
@ -128,51 +151,22 @@ func process_movement(delta : float) -> void:
|
||||
if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0:
|
||||
moving = false
|
||||
return
|
||||
|
||||
|
||||
if target_movement_direction.length_squared() > 0.1:
|
||||
if anim_node_state_machine != null and not animation_run:
|
||||
anim_node_state_machine.travel("run-loop")
|
||||
animation_run = true
|
||||
|
||||
target_movement_direction = target_movement_direction.normalized()
|
||||
|
||||
get_character_skeleton().update_facing(dir)
|
||||
|
||||
moving = true
|
||||
else:
|
||||
if anim_node_state_machine != null and animation_run:
|
||||
anim_node_state_machine.travel("idle-loop")
|
||||
animation_run = false
|
||||
|
||||
moving = false
|
||||
|
||||
if target_movement_direction.x > 0.1 or target_movement_direction.y > 0.1 or target_movement_direction.x < -0.1 or target_movement_direction.y < -0.1:
|
||||
y_rot = Vector2(0, 1).angle_to(target_movement_direction)
|
||||
|
||||
var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot))
|
||||
var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -target_movement_direction.x
|
||||
forward *= target_movement_direction.y #only potentially make it zero after getting the right vector
|
||||
|
||||
dir = forward
|
||||
dir += right
|
||||
|
||||
if dir.length_squared() > 0.1:
|
||||
dir = dir.normalized()
|
||||
|
||||
moving = true
|
||||
else:
|
||||
dir = Vector3()
|
||||
moving = false
|
||||
|
||||
if not moving and sleep:
|
||||
return
|
||||
|
||||
if moving and sleep:
|
||||
sleep = false
|
||||
get_character_skeleton().get_animation_tree().set("parameters/walking/blend_amount", target_movement_direction.length())
|
||||
|
||||
vel.y += delta * GRAVITY
|
||||
|
||||
var hvel : Vector3 = vel
|
||||
var hvel : Vector2 = vel
|
||||
hvel.y = 0
|
||||
|
||||
var target : Vector3 = dir
|
||||
var target : Vector2 = dir
|
||||
target *= get_speed().ccurrent
|
||||
|
||||
var accel
|
||||
@ -181,18 +175,15 @@ func process_movement(delta : float) -> void:
|
||||
else:
|
||||
accel = DEACCEL
|
||||
|
||||
hvel = hvel.linear_interpolate(target, accel * delta) as Vector3
|
||||
vel.x = hvel.x
|
||||
vel.z = hvel.z
|
||||
hvel = hvel.linear_interpolate(target, accel*delta)
|
||||
|
||||
var facing : Vector3 = vel
|
||||
facing.y = 0
|
||||
if hvel.length_squared() < 0.1:
|
||||
return
|
||||
|
||||
vel = hvel
|
||||
vel = move_and_slide(vel)
|
||||
|
||||
# vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE))
|
||||
sset_position(position, rotation)
|
||||
|
||||
if vel.length_squared() < 0.12:
|
||||
sleep = true
|
||||
|
||||
|
||||
func sstart_attack(entity : Entity) -> void:
|
||||
@ -240,8 +231,6 @@ func _son_death():
|
||||
sentity_interaction_type = EntityEnums.ENITIY_INTERACTION_TYPE_LOOT
|
||||
ai_state = EntityEnums.AI_STATE_OFF
|
||||
|
||||
anim_node_state_machine.travel("dead")
|
||||
|
||||
# set_process(false)
|
||||
set_physics_process(false)
|
||||
|
||||
|
@ -1,34 +1,23 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://characters/Character.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://player/Mob.gd" type="Script" id=2]
|
||||
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 0.266582
|
||||
height = 0.927641
|
||||
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 20.0
|
||||
|
||||
[node name="Mob" type="Entity" groups=[
|
||||
"mobs",
|
||||
]]
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
character_skeleton_path = NodePath("Rotation_Helper/Model/character")
|
||||
character_skeleton_path = NodePath("Character")
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Body_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Feet_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Rotation_Helper" type="Spatial" parent="."]
|
||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||
|
||||
[node name="Model" type="Spatial" parent="Rotation_Helper"]
|
||||
|
||||
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Character" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
@ -68,41 +68,29 @@ func _process(delta):
|
||||
interpolating = false
|
||||
|
||||
|
||||
var position : Vector3 = entity.translation
|
||||
|
||||
var camera : Camera = get_tree().get_root().get_camera() as Camera
|
||||
|
||||
if camera == null:
|
||||
return
|
||||
|
||||
var cam_pos : Vector3 = camera.global_transform.xform(Vector3())
|
||||
var dstv : Vector3 = cam_pos - position
|
||||
dstv.y = 0
|
||||
var dst : float = dstv.length_squared()
|
||||
var position : Vector2 = entity.position
|
||||
|
||||
if dst > max_distance_squared:
|
||||
if visible:
|
||||
hide()
|
||||
return
|
||||
|
||||
var cam_facing : Vector3 = -camera.global_transform.basis.z
|
||||
var d : float = cam_facing.dot(dstv)
|
||||
|
||||
if d > 0:
|
||||
if visible:
|
||||
hide()
|
||||
return
|
||||
else:
|
||||
if not visible:
|
||||
show()
|
||||
|
||||
# if dst > max_distance_squared:
|
||||
# if visible:
|
||||
# hide()
|
||||
# return
|
||||
#
|
||||
#
|
||||
# if d > 0:
|
||||
# if visible:
|
||||
# hide()
|
||||
# return
|
||||
# else:
|
||||
# if not visible:
|
||||
# show()
|
||||
#
|
||||
|
||||
position.y += 1.9
|
||||
var screen_position : Vector2 = camera.unproject_position(position)
|
||||
# var screen_position : Vector2 = camera.unproject_position(position)
|
||||
|
||||
var new_pos : Vector2 = Vector2(screen_position.x - (rect_size.x / 2.0) * rect_scale.x, screen_position.y - (rect_size.y) * rect_scale.y)
|
||||
# var new_pos : Vector2 = Vector2(screen_position.x - (rect_size.x / 2.0) * rect_scale.x, screen_position.y - (rect_size.y) * rect_scale.y)
|
||||
|
||||
set_position(new_pos)
|
||||
set_position(position)
|
||||
|
||||
|
||||
func set_max_distance(var value : float) -> void:
|
||||
|
@ -1,33 +1,21 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://player/NetworkedPlayer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://characters/Character.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://ui/nameplates/NamePlate.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 0.266582
|
||||
height = 0.927641
|
||||
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 20.0
|
||||
|
||||
[node name="NetworkedPlayer" type="Entity"]
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
character_skeleton_path = NodePath("Rotation_Helper/Model/character")
|
||||
character_skeleton_path = NodePath("Character")
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Body_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.8, 0 )
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Feet_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.194237, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Rotation_Helper" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 )
|
||||
|
||||
[node name="Model" type="Spatial" parent="Rotation_Helper"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 )
|
||||
[node name="Character" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
|
||||
|
@ -24,24 +24,21 @@ class_name PlayerGD
|
||||
# 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 world_path : String = ".."
|
||||
export(NodePath) var model_path : NodePath = "Rotation_Helper/Model"
|
||||
|
||||
const ray_length = 1000
|
||||
const ACCEL : float = 100.0
|
||||
const DEACCEL : float = 100.0
|
||||
const GRAVITY : float = -24.8
|
||||
const JUMP_SPEED : float = 3.8
|
||||
const MAX_SLOPE_ANGLE : float = 40.0
|
||||
|
||||
const MOUSE_TARGET_MAX_OFFSET : int = 10
|
||||
|
||||
var _on : bool = true
|
||||
|
||||
var y_rot : float = 0.0
|
||||
|
||||
var vel : Vector3 = Vector3()
|
||||
var dir : Vector3 = Vector3()
|
||||
var vel : Vector2 = Vector2()
|
||||
var dir : Vector2 = Vector2()
|
||||
|
||||
var input_dir : Vector2 = Vector2()
|
||||
var mouse_dir : Vector2 = Vector2()
|
||||
@ -50,7 +47,6 @@ var mouse_left_down : bool = false
|
||||
var mouse_right_down : bool = false
|
||||
var touchpad_dir : Vector2 = Vector2()
|
||||
var mouse_down_delta : Vector2 = Vector2()
|
||||
var queued_camera_rotaions : Vector2 = Vector2()
|
||||
|
||||
var key_left : bool = false
|
||||
var key_right : bool = false
|
||||
@ -62,11 +58,8 @@ var last_cursor_pos : Vector2 = Vector2()
|
||||
var mouse_down_pos : Vector2 = Vector2()
|
||||
var total_down_mouse_delta : Vector2 = Vector2()
|
||||
|
||||
var camera : Camera
|
||||
var camera_pivot : Spatial
|
||||
var camera : Camera2D
|
||||
|
||||
var animation_tree : AnimationTree
|
||||
var anim_node_state_machine : AnimationNodeStateMachinePlayback = null
|
||||
var animation_run : bool = false
|
||||
|
||||
var moving : bool = false
|
||||
@ -76,27 +69,13 @@ var last_mouse_over : Entity = null
|
||||
|
||||
var world : Navigation2D = null
|
||||
|
||||
var model_rotation_node : Spatial
|
||||
|
||||
func _ready() -> void:
|
||||
camera = $CameraPivot/Camera as Camera
|
||||
camera_pivot = $CameraPivot as Spatial
|
||||
camera = $Camera as Camera2D
|
||||
|
||||
model_rotation_node = get_node(model_path)
|
||||
|
||||
animation_tree = get_character_skeleton().get_animation_tree()
|
||||
|
||||
if animation_tree != null:
|
||||
anim_node_state_machine = animation_tree["parameters/playback"]
|
||||
|
||||
world = get_node(world_path) as Navigation2D
|
||||
|
||||
# set_process(true)
|
||||
|
||||
func _physics_process(delta : float) -> void:
|
||||
if not _on:
|
||||
return
|
||||
|
||||
if world.initial_generation:
|
||||
return
|
||||
|
||||
@ -125,24 +104,14 @@ func process_input(delta: float) -> void:
|
||||
|
||||
var input_length : float = input_dir.length_squared()
|
||||
|
||||
dir = input_dir.normalized()
|
||||
|
||||
if input_length > 0.1:
|
||||
if anim_node_state_machine != null and not animation_run:
|
||||
anim_node_state_machine.travel("run-loop")
|
||||
animation_run = true
|
||||
|
||||
input_dir = input_dir.normalized()
|
||||
|
||||
animation_tree["parameters/run-loop/blend_position"] = input_dir
|
||||
|
||||
if (input_dir.y < 0.1):
|
||||
model_rotation_node.transform.basis = Basis(Vector3(0, acos(input_dir.x) - PI / 2.0, 0))
|
||||
else:
|
||||
model_rotation_node.transform.basis = Basis()
|
||||
else:
|
||||
if anim_node_state_machine != null and animation_run:
|
||||
anim_node_state_machine.travel("idle-loop")
|
||||
animation_run = false
|
||||
#handle_graphic_facing(abs(dir.dot(Vector2(0, 1))) > 0.9)
|
||||
get_character_skeleton().update_facing(dir)
|
||||
|
||||
get_character_skeleton().get_animation_tree().set("parameters/walking/blend_amount", input_dir.length())
|
||||
|
||||
|
||||
func process_movement(delta : float) -> void:
|
||||
var state : int = getc_state()
|
||||
@ -150,30 +119,17 @@ func process_movement(delta : float) -> void:
|
||||
if state & EntityEnums.ENTITY_STATE_TYPE_FLAG_ROOT != 0 or state & EntityEnums.ENTITY_STATE_TYPE_FLAG_STUN != 0:
|
||||
moving = false
|
||||
return
|
||||
|
||||
if input_dir.x > 0.1 or input_dir.y > 0.1 or input_dir.x < -0.1 or input_dir.y < -0.1:
|
||||
var forward : Vector3 = Vector3(0, 0, 1).rotated(Vector3(0, 1, 0), deg2rad(y_rot))
|
||||
var right : Vector3 = forward.cross(Vector3(0, 1, 0)) * -input_dir.x
|
||||
forward *= input_dir.y #only potentially make it zero after getting the right vector
|
||||
|
||||
dir = forward
|
||||
dir += right
|
||||
|
||||
if dir.length_squared() > 0.1:
|
||||
dir = dir.normalized()
|
||||
|
||||
if (input_dir.length_squared() > 0.1):
|
||||
moving = true
|
||||
moved()
|
||||
else:
|
||||
dir = Vector3()
|
||||
moving = false
|
||||
|
||||
|
||||
vel.y += delta * GRAVITY
|
||||
var hvel = vel
|
||||
|
||||
var hvel : Vector3 = vel
|
||||
hvel.y = 0
|
||||
|
||||
var target : Vector3 = dir
|
||||
var target = dir
|
||||
target *= get_speed().ccurrent
|
||||
|
||||
var accel
|
||||
@ -182,17 +138,15 @@ func process_movement(delta : float) -> void:
|
||||
else:
|
||||
accel = DEACCEL
|
||||
|
||||
hvel = hvel.linear_interpolate(target, accel * delta) as Vector3
|
||||
vel.x = hvel.x
|
||||
vel.z = hvel.z
|
||||
# vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE))
|
||||
hvel = hvel.linear_interpolate(target, accel*delta)
|
||||
vel = hvel
|
||||
vel = move_and_slide(vel)
|
||||
|
||||
if multiplayer.has_network_peer():
|
||||
if not multiplayer.is_network_server():
|
||||
rpc_id(1, "sset_position", position, rotation)
|
||||
rpc_id(1, "sset_position", position)
|
||||
else:
|
||||
sset_position(position, rotation)
|
||||
|
||||
sset_position(position)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not cursor_grabbed:
|
||||
@ -235,125 +189,94 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
mouse_left_down = event.pressed
|
||||
|
||||
if mouse_left_down:
|
||||
mouse_down_delta = Vector2()
|
||||
mouse_down_pos = event.position
|
||||
|
||||
if event.button_index == BUTTON_RIGHT and event.device != -1:
|
||||
mouse_right_down = event.pressed
|
||||
|
||||
|
||||
if mouse_left_down and mouse_right_down:
|
||||
mouse_move_dir.y = -1
|
||||
else:
|
||||
mouse_move_dir.y = 0
|
||||
|
||||
if event.is_pressed() and event.device != -1:
|
||||
if event.button_index == BUTTON_WHEEL_UP:
|
||||
camera_pivot.camera_distance_set_delta(-0.2)
|
||||
if event.button_index == BUTTON_WHEEL_DOWN:
|
||||
camera_pivot.camera_distance_set_delta(0.2)
|
||||
mouse_dir = (event.position - get_viewport_rect().size / 2).normalized()
|
||||
else:
|
||||
mouse_dir = Vector2()
|
||||
|
||||
# if event.is_pressed() and event.device != -1:
|
||||
# if event.button_index == BUTTON_WHEEL_UP:
|
||||
# camera_pivot.camera_distance_set_delta(-0.2)
|
||||
# if event.button_index == BUTTON_WHEEL_DOWN:
|
||||
# camera_pivot.camera_distance_set_delta(0.2)
|
||||
|
||||
if not event.pressed and event.button_index == BUTTON_LEFT and event.device != -1:
|
||||
if mouse_down_delta.length() < MOUSE_TARGET_MAX_OFFSET:
|
||||
target(event.position)
|
||||
|
||||
if event.pressed and event.button_index == BUTTON_RIGHT and event.device != -1:
|
||||
target(event.position)
|
||||
|
||||
if event is InputEventScreenTouch and event.pressed:
|
||||
target(event.position)
|
||||
|
||||
update_cursor_mode()
|
||||
|
||||
func update_cursor_mode():
|
||||
if mouse_left_down or mouse_right_down:
|
||||
if not cursor_grabbed:
|
||||
set_process_input(true)
|
||||
total_down_mouse_delta = Vector2()
|
||||
|
||||
cursor_grabbed = true
|
||||
last_cursor_pos = get_viewport().get_mouse_position()
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
else:
|
||||
if cursor_grabbed:
|
||||
set_process_input(false)
|
||||
cursor_grabbed = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
get_viewport().warp_mouse(last_cursor_pos)
|
||||
|
||||
if total_down_mouse_delta.length_squared() < 8:
|
||||
target(last_cursor_pos)
|
||||
|
||||
|
||||
|
||||
if event is InputEventMouseMotion and mouse_left_down and event.device != -1:
|
||||
mouse_dir = (event.position - get_viewport_rect().size / 2).normalized()
|
||||
|
||||
|
||||
func target(position : Vector2):
|
||||
var from = camera.project_ray_origin(position)
|
||||
var to = from + camera.project_ray_normal(position) * ray_length
|
||||
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
var result = space_state.intersect_ray(from, to, [], 2)
|
||||
|
||||
if result:
|
||||
print(result)
|
||||
if result.collider and result.collider is Entity:
|
||||
var ent : Entity = result.collider as Entity
|
||||
|
||||
crequest_target_change(ent.get_path())
|
||||
return
|
||||
#var results = space_state.intersect_point(map.make_canvas_position_local(position), 32, [], 2)
|
||||
var results = space_state.intersect_point(position, 32, [], 2)
|
||||
|
||||
if results:
|
||||
for result in results:
|
||||
if result.collider and result.collider is Entity:
|
||||
crequest_target_change((result.collider as Node).get_path())
|
||||
return
|
||||
|
||||
crequest_target_change(NodePath())
|
||||
else:
|
||||
crequest_target_change(NodePath())
|
||||
|
||||
func cmouseover(event):
|
||||
var from = camera.project_ray_origin(event.position)
|
||||
var to = from + camera.project_ray_normal(event.position) * ray_length
|
||||
|
||||
func cmouseover(event):
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
var result = space_state.intersect_ray(from, to, [], 2)
|
||||
|
||||
if result:
|
||||
if result.collider and result.collider is Entity:
|
||||
var mo : Entity = result.collider as Entity
|
||||
#var results = space_state.intersect_point(map.make_canvas_position_local(position), 32, [], 2)
|
||||
var results = space_state.intersect_point(position, 32, [], 2)
|
||||
|
||||
if results:
|
||||
for result in results:
|
||||
if result.collider and result.collider is Entity:
|
||||
var mo : Entity = result.collider as Entity
|
||||
|
||||
if last_mouse_over != null and last_mouse_over != mo:
|
||||
if is_instance_valid(last_mouse_over):
|
||||
last_mouse_over.onc_mouse_exit()
|
||||
if last_mouse_over != null and last_mouse_over != mo:
|
||||
if is_instance_valid(last_mouse_over):
|
||||
last_mouse_over.onc_mouse_exit()
|
||||
|
||||
last_mouse_over = null
|
||||
last_mouse_over = null
|
||||
|
||||
if last_mouse_over == null:
|
||||
mo.onc_mouse_enter()
|
||||
last_mouse_over = mo
|
||||
if last_mouse_over == null:
|
||||
mo.onc_mouse_enter()
|
||||
last_mouse_over = mo
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
if last_mouse_over != null:
|
||||
last_mouse_over.onc_mouse_exit()
|
||||
last_mouse_over = null
|
||||
|
||||
func analog_force_change(vector, touchpad):
|
||||
func analog_force_change(vector: Vector2, touchpad) -> void:
|
||||
if touchpad.padname == "TouchPad":
|
||||
touchpad_dir = vector
|
||||
touchpad_dir.y *= -1
|
||||
elif touchpad.padname == "TargetPad":
|
||||
#try to target
|
||||
return
|
||||
|
||||
func queue_camera_rotation(rot : Vector2) -> void:
|
||||
queued_camera_rotaions += rot
|
||||
|
||||
remote func sset_position(pposition : Vector2, protation : float) -> void:
|
||||
remote func sset_position(pposition : Vector2) -> void:
|
||||
if get_network_master() != 1:
|
||||
print(str(get_network_master()) + "psset")
|
||||
|
||||
if multiplayer.network_peer and multiplayer.is_network_server():
|
||||
vrpc("cset_position", pposition, protation)
|
||||
cset_position(pposition, protation)
|
||||
vrpc("cset_position", pposition)
|
||||
|
||||
remote func cset_position(pposition : Vector2, protation : float) -> void:
|
||||
cset_position(pposition)
|
||||
|
||||
remote func cset_position(pposition : Vector2) -> void:
|
||||
if get_network_master() != 1:
|
||||
print(str(get_network_master()) + " pcset")
|
||||
|
||||
position = pposition
|
||||
rotation = protation
|
||||
|
||||
func _moved() -> void:
|
||||
if sis_casting():
|
||||
@ -372,35 +295,35 @@ func _con_target_changed(entity: Entity, old_target: Entity) -> void:
|
||||
if canc_interact():
|
||||
crequest_interact()
|
||||
|
||||
func _con_cast_started(info):
|
||||
if anim_node_state_machine != null and not casting_anim:
|
||||
anim_node_state_machine.travel("casting-loop")
|
||||
casting_anim = true
|
||||
animation_run = false
|
||||
#func _con_cast_started(info):
|
||||
# if anim_node_state_machine != null and not casting_anim:
|
||||
# anim_node_state_machine.travel("casting-loop")
|
||||
# casting_anim = true
|
||||
# animation_run = false
|
||||
|
||||
func _con_cast_failed(info):
|
||||
if anim_node_state_machine != null and casting_anim:
|
||||
anim_node_state_machine.travel("idle-loop")
|
||||
casting_anim = false
|
||||
|
||||
if animation_run:
|
||||
anim_node_state_machine.travel("run-loop")
|
||||
#func _con_cast_failed(info):
|
||||
# if anim_node_state_machine != null and casting_anim:
|
||||
# anim_node_state_machine.travel("idle-loop")
|
||||
# casting_anim = false
|
||||
#
|
||||
# if animation_run:
|
||||
# anim_node_state_machine.travel("run-loop")
|
||||
|
||||
func _con_cast_finished(info):
|
||||
if anim_node_state_machine != null:
|
||||
anim_node_state_machine.travel("cast-end")
|
||||
casting_anim = false
|
||||
|
||||
if animation_run:
|
||||
anim_node_state_machine.travel("run-loop")
|
||||
#func _con_cast_finished(info):
|
||||
# if anim_node_state_machine != null:
|
||||
# anim_node_state_machine.travel("cast-end")
|
||||
# casting_anim = false
|
||||
#
|
||||
# if animation_run:
|
||||
# anim_node_state_machine.travel("run-loop")
|
||||
|
||||
func _con_spell_cast_success(info):
|
||||
if anim_node_state_machine != null:
|
||||
anim_node_state_machine.travel("cast-end")
|
||||
casting_anim = false
|
||||
|
||||
if animation_run:
|
||||
anim_node_state_machine.travel("run-loop")
|
||||
#func _con_spell_cast_success(info):
|
||||
# if anim_node_state_machine != null:
|
||||
# anim_node_state_machine.travel("cast-end")
|
||||
# casting_anim = false
|
||||
#
|
||||
# if animation_run:
|
||||
# anim_node_state_machine.travel("run-loop")
|
||||
|
||||
func _son_xp_gained(value : int) -> void:
|
||||
if not Entities.get_xp_data().can_level_up(gets_level()):
|
||||
|
@ -1,35 +1,27 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://characters/Character.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://player/Player.gd" type="Script" id=2]
|
||||
[ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 0.266582
|
||||
height = 0.927641
|
||||
|
||||
[sub_resource type="BoxShape" id=2]
|
||||
extents = Vector3( 0.216228, 0.0681041, 0.183397 )
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 8.0
|
||||
|
||||
[node name="Player" type="Entity" groups=[
|
||||
"players",
|
||||
]]
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
character_skeleton_path = NodePath("Rotation_Helper/Model/character")
|
||||
character_skeleton_path = NodePath("Character")
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Body_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 )
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Feet_CollisionShape" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Rotation_Helper" type="Spatial" parent="."]
|
||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||
|
||||
[node name="Model" type="Spatial" parent="Rotation_Helper"]
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
current = true
|
||||
|
||||
[node name="GUILayer" parent="." instance=ExtResource( 3 )]
|
||||
|
||||
[node name="Character" parent="." instance=ExtResource( 1 )]
|
||||
[connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"]
|
||||
|
@ -33,7 +33,7 @@ func _ready():
|
||||
_shape.radius = 50
|
||||
|
||||
_query = Physics2DShapeQueryParameters.new()
|
||||
_query.collision_mask = 2
|
||||
_query.collision_layer = 2
|
||||
_query.exclude = [ self ]
|
||||
_query.shape_rid = _shape.get_rid()
|
||||
|
||||
@ -100,5 +100,9 @@ func update_visibility() -> void:
|
||||
adds_sees(ent)
|
||||
|
||||
|
||||
|
||||
remote func set_position_remote(pos : Vector2) -> void:
|
||||
if get_tree().is_network_server():
|
||||
rpc("set_position_remote", pos)
|
||||
print(position)
|
||||
position = pos
|
||||
|
||||
|
@ -14,11 +14,26 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/auras/aura_script.gd"
|
||||
}, {
|
||||
"base": "CharacterAtlas",
|
||||
"class": "CharacterAtlas2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/item_visuals/CharacterAtlas2D.gd"
|
||||
}, {
|
||||
"base": "CharacterAtlasEntry",
|
||||
"class": "CharacterAtlasEntry2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/item_visuals/CharacterAtlasEntry2D.gd"
|
||||
}, {
|
||||
"base": "Spatial",
|
||||
"class": "CharacterSkeketonAttachPoint",
|
||||
"language": "GDScript",
|
||||
"path": "res://player/CharacterSkeletonAttachPoint.gd"
|
||||
}, {
|
||||
"base": "CharacterSkeleton",
|
||||
"class": "CharacterSkeleton2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://player/CharacterSkeleton2D.gd"
|
||||
}, {
|
||||
"base": "Entity",
|
||||
"class": "DisplayPlayerGD",
|
||||
"language": "GDScript",
|
||||
@ -34,11 +49,26 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/entities/EntityDataGD.gd"
|
||||
}, {
|
||||
"base": "CharacterBones",
|
||||
"class": "HumanoidCharacterBones2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://player/HumanoidCharacterBones2D.gd"
|
||||
}, {
|
||||
"base": "ItemTemplate",
|
||||
"class": "ItemTemplateGD",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/items/ItemTemplateGD.gd"
|
||||
}, {
|
||||
"base": "ItemVisual",
|
||||
"class": "ItemVisual2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/item_visuals/ItemVisual2D.gd"
|
||||
}, {
|
||||
"base": "ItemVisualEntry",
|
||||
"class": "ItemVisualEntry2D",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/item_visuals/ItemVisualEntry2D.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Main",
|
||||
"language": "GDScript",
|
||||
@ -96,11 +126,17 @@ _global_script_classes=[ {
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"AuraGD": "",
|
||||
"CharacterAtlas2D": "",
|
||||
"CharacterAtlasEntry2D": "",
|
||||
"CharacterSkeketonAttachPoint": "",
|
||||
"CharacterSkeleton2D": "",
|
||||
"DisplayPlayerGD": "",
|
||||
"EntityAIGD": "",
|
||||
"EntityDataGD": "",
|
||||
"HumanoidCharacterBones2D": "",
|
||||
"ItemTemplateGD": "",
|
||||
"ItemVisual2D": "",
|
||||
"ItemVisualEntry2D": "",
|
||||
"Main": "",
|
||||
"MainDungeonGenerator": "",
|
||||
"MainPlanetGenerator": "",
|
||||
|
@ -1,8 +1,55 @@
|
||||
extends Navigation2D
|
||||
|
||||
export(bool) var editor_generate : bool = false setget set_editor_generate, get_editor_generate
|
||||
export(bool) var show_loading_screen : bool = true
|
||||
export(bool) var generate_on_ready : bool = false
|
||||
|
||||
var initial_generation : bool = false
|
||||
|
||||
var _editor_generate : bool
|
||||
|
||||
var _player_file_name : String
|
||||
var _player : Entity
|
||||
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func load_character(current_character_file_name):
|
||||
pass
|
||||
func load_character(file_name: String) -> void:
|
||||
_player_file_name = file_name
|
||||
_player = Entities.load_player(file_name, Vector2(5, 5), 1) as Entity
|
||||
#TODO hack, do this properly
|
||||
# _player.set_physics_process(false)
|
||||
|
||||
Server.sset_seed(_player.sseed)
|
||||
|
||||
|
||||
func save() -> void:
|
||||
if _player == null or _player_file_name == "":
|
||||
return
|
||||
|
||||
Entities.save_player(_player, _player_file_name)
|
||||
|
||||
func _generation_finished():
|
||||
|
||||
if show_loading_screen and not Engine.editor_hint:
|
||||
get_node("..").hide_loading_screen()
|
||||
|
||||
# if _player:
|
||||
# _player.set_physics_process(true)
|
||||
|
||||
func get_editor_generate() -> bool:
|
||||
return _editor_generate
|
||||
|
||||
func set_editor_generate(value : bool) -> void:
|
||||
if value:
|
||||
#library.refresh_rects()
|
||||
|
||||
#level_generator.setup(self, current_seed, false, library)
|
||||
#spawn()
|
||||
pass
|
||||
else:
|
||||
#spawned = false
|
||||
#clear()
|
||||
pass
|
||||
|
||||
_editor_generate = value
|
||||
|
File diff suppressed because one or more lines are too long
7
game/scripts/item_visuals/CharacterAtlas2D.gd
Normal file
7
game/scripts/item_visuals/CharacterAtlas2D.gd
Normal file
@ -0,0 +1,7 @@
|
||||
extends CharacterAtlas
|
||||
class_name CharacterAtlas2D
|
||||
|
||||
export(String, MULTILINE) var comments : String
|
||||
|
||||
export(Texture) var texture : Texture
|
||||
export(Array, CharacterAtlasEntry) var slots : Array
|
19
game/scripts/item_visuals/CharacterAtlasEntry2D.gd
Normal file
19
game/scripts/item_visuals/CharacterAtlasEntry2D.gd
Normal file
@ -0,0 +1,19 @@
|
||||
extends CharacterAtlasEntry
|
||||
class_name CharacterAtlasEntry2D
|
||||
|
||||
export(Rect2) var front_rect : Rect2
|
||||
export(Rect2) var back_rect : Rect2
|
||||
export(Rect2) var right_rect : Rect2
|
||||
export(Rect2) var left_rect : Rect2
|
||||
|
||||
func get_index(facing : int) -> Rect2:
|
||||
if facing == CharacterSkeleton2D.CharacterFacing.FACING_FRONT:
|
||||
return front_rect
|
||||
if facing == CharacterSkeleton2D.CharacterFacing.FACING_BACK:
|
||||
return back_rect
|
||||
if facing == CharacterSkeleton2D.CharacterFacing.FACING_RIGHT:
|
||||
return right_rect
|
||||
if facing == CharacterSkeleton2D.CharacterFacing.FACING_LEFT:
|
||||
return left_rect
|
||||
|
||||
return front_rect
|
4
game/scripts/item_visuals/ItemVisual2D.gd
Normal file
4
game/scripts/item_visuals/ItemVisual2D.gd
Normal file
@ -0,0 +1,4 @@
|
||||
extends ItemVisual
|
||||
class_name ItemVisual2D
|
||||
|
||||
export(Array, ItemVisualEntry) var entries : Array
|
8
game/scripts/item_visuals/ItemVisualEntry2D.gd
Normal file
8
game/scripts/item_visuals/ItemVisualEntry2D.gd
Normal file
@ -0,0 +1,8 @@
|
||||
tool
|
||||
extends ItemVisualEntry
|
||||
class_name ItemVisualEntry2D
|
||||
|
||||
export (Texture) var front_texture : Texture
|
||||
export (Texture) var back_texture : Texture
|
||||
export (Texture) var left_texture : Texture
|
||||
export (Texture) var right_texture : Texture
|
94
game/test_iso_size/SizeTestTileSetScene.tscn
Normal file
94
game/test_iso_size/SizeTestTileSetScene.tscn
Normal file
@ -0,0 +1,94 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://test_iso_size/tiles.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=1]
|
||||
vertices = PoolVector2Array( -23, 0, 0, -11, 23, 0, 0, 11 )
|
||||
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
|
||||
outlines = [ PoolVector2Array( -23, 0, 0, -11, 23, 0, 0, 11 ) ]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=2]
|
||||
vertices = PoolVector2Array( 1, -1, -43, -23, -1, -44, 43, -22, 35.4934, -18.1594 )
|
||||
polygons = [ PoolIntArray( 0, 1, 2, 3, 4 ) ]
|
||||
outlines = [ PoolVector2Array( 1, -1, -43, -23, -1, -44, 43, -22, 35.4934, -18.1594 ) ]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="BigGrass" type="Sprite" parent="."]
|
||||
position = Vector2( 93, 40 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -22.5, -24 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 35, 234, 45, 35 )
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="BigGrass"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="BigGrass/StaticBody2D"]
|
||||
polygon = PoolVector2Array( 0, 11, -23, 0, 0, -11, 23, 0 )
|
||||
|
||||
[node name="BigGrassWalkable" type="Sprite" parent="."]
|
||||
position = Vector2( 28, 49 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -22.5, -11 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 36, 25, 45, 35 )
|
||||
|
||||
[node name="NavigationPolygonInstance2" type="NavigationPolygonInstance" parent="BigGrassWalkable"]
|
||||
navpoly = SubResource( 1 )
|
||||
|
||||
[node name="Small grass" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -22.5, -11 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 20, 191, 45, 22 )
|
||||
|
||||
[node name="NavigationPolygonInstance" type="NavigationPolygonInstance" parent="Small grass"]
|
||||
navpoly = SubResource( 1 )
|
||||
|
||||
[node name="isometric_0004" type="Sprite" parent="."]
|
||||
position = Vector2( -79.7553, 87.2112 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -44.5, -22.5 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 76, 103, 89, 58 )
|
||||
|
||||
[node name="isometric_0001" type="Sprite" parent="."]
|
||||
position = Vector2( 258, 49 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -43, -44 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 132, 14, 86, 65 )
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="isometric_0001"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="isometric_0001/StaticBody2D"]
|
||||
polygon = PoolVector2Array( -43, 0, 0, 21, 43, 0, 0, -22 )
|
||||
|
||||
[node name="NavigationPolygonInstance" type="NavigationPolygonInstance" parent="isometric_0001"]
|
||||
navpoly = SubResource( 2 )
|
||||
|
||||
[node name="isometric_0003" type="Sprite" parent="."]
|
||||
position = Vector2( 157, 151 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -43, -44 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 132, 14, 86, 65 )
|
||||
|
||||
[node name="isometric_0002" type="Sprite" parent="."]
|
||||
position = Vector2( 129.235, -28.4679 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
offset = Vector2( -10, -65 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 33, 98, 23, 76 )
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="isometric_0002"]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="isometric_0002/StaticBody2D"]
|
||||
polygon = PoolVector2Array( -10, 0, 12, 11, 16, 8, -6, -2 )
|
BIN
game/test_iso_size/char_t1_outline_split.aseprite
Normal file
BIN
game/test_iso_size/char_t1_outline_split.aseprite
Normal file
Binary file not shown.
BIN
game/test_iso_size/lighttext.aseprite
Normal file
BIN
game/test_iso_size/lighttext.aseprite
Normal file
Binary file not shown.
BIN
game/test_iso_size/lighttext.png
Normal file
BIN
game/test_iso_size/lighttext.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 B |
34
game/test_iso_size/lighttext.png.import
Normal file
34
game/test_iso_size/lighttext.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/lighttext.png-00ed5f4e76e6a4bb9f52c4bb11f9c08d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test_iso_size/lighttext.png"
|
||||
dest_files=[ "res://.import/lighttext.png-00ed5f4e76e6a4bb9f52c4bb11f9c08d.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
game/test_iso_size/test.aseprite
Normal file
BIN
game/test_iso_size/test.aseprite
Normal file
Binary file not shown.
BIN
game/test_iso_size/test_char_02.aseprite
Normal file
BIN
game/test_iso_size/test_char_02.aseprite
Normal file
Binary file not shown.
115
game/test_iso_size/test_size_tileset.tres
Normal file
115
game/test_iso_size/test_size_tileset.tres
Normal file
@ -0,0 +1,115 @@
|
||||
[gd_resource type="TileSet" load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://test_iso_size/tiles.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||
points = PoolVector2Array( 0, 11, -23, 0, 0, -11, 23, 0 )
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=2]
|
||||
vertices = PoolVector2Array( -23, 0, 0, -11, 23, 0, 0, 11 )
|
||||
polygons = [ PoolIntArray( 0, 1, 2, 3 ) ]
|
||||
outlines = [ PoolVector2Array( -23, 0, 0, -11, 23, 0, 0, 11 ) ]
|
||||
|
||||
[sub_resource type="NavigationPolygon" id=3]
|
||||
vertices = PoolVector2Array( 1, -1, -43, -23, -1, -44, 43, -22, 35.4934, -18.1594 )
|
||||
polygons = [ PoolIntArray( 0, 1, 2, 3, 4 ) ]
|
||||
outlines = [ PoolVector2Array( 1, -1, -43, -23, -1, -44, 43, -22, 35.4934, -18.1594 ) ]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=4]
|
||||
points = PoolVector2Array( 0, -22, 43, 0, 0, 21, -43, 0 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=5]
|
||||
points = PoolVector2Array( -6, -2, 16, 8, 12, 11, -10, 0 )
|
||||
|
||||
[resource]
|
||||
0/name = "BigGrass"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( -22.5, -24 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 35, 234, 45, 35 )
|
||||
0/tile_mode = 0
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 1 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
0/z_index = 0
|
||||
1/name = "BigGrassWalkable"
|
||||
1/texture = ExtResource( 1 )
|
||||
1/tex_offset = Vector2( -22.5, -11 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 36, 25, 45, 35 )
|
||||
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 = "Small grass"
|
||||
2/texture = ExtResource( 1 )
|
||||
2/tex_offset = Vector2( -22.5, -11 )
|
||||
2/modulate = Color( 1, 1, 1, 1 )
|
||||
2/region = Rect2( 20, 191, 45, 22 )
|
||||
2/tile_mode = 0
|
||||
2/occluder_offset = Vector2( 0, 0 )
|
||||
2/navigation_offset = Vector2( 0, 0 )
|
||||
2/navigation = SubResource( 2 )
|
||||
2/shapes = [ ]
|
||||
2/z_index = 0
|
||||
3/name = "isometric_0004"
|
||||
3/texture = ExtResource( 1 )
|
||||
3/tex_offset = Vector2( -44.5, -22.5 )
|
||||
3/modulate = Color( 1, 1, 1, 1 )
|
||||
3/region = Rect2( 76, 103, 89, 58 )
|
||||
3/tile_mode = 0
|
||||
3/occluder_offset = Vector2( 0, 0 )
|
||||
3/navigation_offset = Vector2( 0, 0 )
|
||||
3/shapes = [ ]
|
||||
3/z_index = 0
|
||||
4/name = "isometric_0001"
|
||||
4/texture = ExtResource( 1 )
|
||||
4/tex_offset = Vector2( -43, -44 )
|
||||
4/modulate = Color( 1, 1, 1, 1 )
|
||||
4/region = Rect2( 132, 14, 86, 65 )
|
||||
4/tile_mode = 0
|
||||
4/occluder_offset = Vector2( 0, 0 )
|
||||
4/navigation_offset = Vector2( 0, 0 )
|
||||
4/navigation = SubResource( 3 )
|
||||
4/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 4 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
4/z_index = 0
|
||||
5/name = "isometric_0003"
|
||||
5/texture = ExtResource( 1 )
|
||||
5/tex_offset = Vector2( -43, -44 )
|
||||
5/modulate = Color( 1, 1, 1, 1 )
|
||||
5/region = Rect2( 132, 14, 86, 65 )
|
||||
5/tile_mode = 0
|
||||
5/occluder_offset = Vector2( 0, 0 )
|
||||
5/navigation_offset = Vector2( 0, 0 )
|
||||
5/shapes = [ ]
|
||||
5/z_index = 0
|
||||
6/name = "isometric_0002"
|
||||
6/texture = ExtResource( 1 )
|
||||
6/tex_offset = Vector2( -10, -65 )
|
||||
6/modulate = Color( 1, 1, 1, 1 )
|
||||
6/region = Rect2( 33, 98, 23, 76 )
|
||||
6/tile_mode = 0
|
||||
6/occluder_offset = Vector2( 0, 0 )
|
||||
6/navigation_offset = Vector2( 0, 0 )
|
||||
6/shapes = [ {
|
||||
"autotile_coord": Vector2( 0, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 5 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
} ]
|
||||
6/z_index = 0
|
BIN
game/test_iso_size/tiles.png
Normal file
BIN
game/test_iso_size/tiles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
34
game/test_iso_size/tiles.png.import
Normal file
34
game/test_iso_size/tiles.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/tiles.png-3a48cccc1db1aeab4bf551247aa31792.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://test_iso_size/tiles.png"
|
||||
dest_files=[ "res://.import/tiles.png-3a48cccc1db1aeab4bf551247aa31792.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=false
|
||||
svg/scale=1.0
|
BIN
game/test_iso_size/tiles.xcf
Normal file
BIN
game/test_iso_size/tiles.xcf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user