started player handling on map
This commit is contained in:
parent
72ea3b861a
commit
10eaf40c64
@ -55,20 +55,6 @@ texture_region_size = Vector2i(32, 32)
|
|||||||
5:1/0/texture_origin = Vector2i(0, -8)
|
5:1/0/texture_origin = Vector2i(0, -8)
|
||||||
6:1/0 = 0
|
6:1/0 = 0
|
||||||
6:1/0/texture_origin = Vector2i(0, -8)
|
6:1/0/texture_origin = Vector2i(0, -8)
|
||||||
0:2/0 = 0
|
|
||||||
1:2/0 = 0
|
|
||||||
2:2/0 = 0
|
|
||||||
3:2/0 = 0
|
|
||||||
4:2/0 = 0
|
|
||||||
5:2/0 = 0
|
|
||||||
6:2/0 = 0
|
|
||||||
0:3/0 = 0
|
|
||||||
1:3/0 = 0
|
|
||||||
2:3/0 = 0
|
|
||||||
3:3/0 = 0
|
|
||||||
4:3/0 = 0
|
|
||||||
5:3/0 = 0
|
|
||||||
6:3/0 = 0
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_s16iq"]
|
[sub_resource type="TileSet" id="TileSet_s16iq"]
|
||||||
tile_shape = 1
|
tile_shape = 1
|
||||||
@ -104,68 +90,57 @@ size_flags_horizontal = 4
|
|||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
text = "Reset"
|
text = "Reset"
|
||||||
|
|
||||||
[node name="Z_CW" type="Button" parent="CanvasLayer"]
|
[node name="RotationVBoxContainer" type="VBoxContainer" parent="CanvasLayer"]
|
||||||
anchors_preset = 6
|
offset_right = 40.0
|
||||||
anchor_left = 1.0
|
offset_bottom = 40.0
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 1.0
|
[node name="Z_CW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
anchor_bottom = 0.5
|
layout_mode = 2
|
||||||
offset_left = -34.0
|
|
||||||
offset_top = -15.5
|
|
||||||
offset_bottom = 15.5
|
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 2
|
|
||||||
text = "Rotate CW Z-Axis"
|
text = "Rotate CW Z-Axis"
|
||||||
|
|
||||||
[node name="Z_CCW" type="Button" parent="CanvasLayer"]
|
[node name="Z_CCW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
anchors_preset = 4
|
layout_mode = 2
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_bottom = 0.5
|
|
||||||
offset_top = -15.5
|
|
||||||
offset_right = 44.0
|
|
||||||
offset_bottom = 15.5
|
|
||||||
grow_vertical = 2
|
|
||||||
text = "Rotate CCW Z-Axis"
|
text = "Rotate CCW Z-Axis"
|
||||||
|
|
||||||
[node name="X_CW" type="Button" parent="CanvasLayer"]
|
[node name="X_CW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
anchors_preset = 3
|
layout_mode = 2
|
||||||
anchor_left = 1.0
|
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_left = -140.0
|
|
||||||
offset_top = -31.0
|
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 0
|
|
||||||
text = "Rotate CW X-Axis"
|
text = "Rotate CW X-Axis"
|
||||||
|
|
||||||
[node name="X_CCW" type="Button" parent="CanvasLayer"]
|
[node name="X_CCW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
offset_right = 150.0
|
layout_mode = 2
|
||||||
offset_bottom = 31.0
|
|
||||||
text = "Rotate CCW X-Axis"
|
text = "Rotate CCW X-Axis"
|
||||||
|
|
||||||
[node name="Y_CW" type="Button" parent="CanvasLayer"]
|
[node name="Y_CW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
anchors_preset = 2
|
layout_mode = 2
|
||||||
anchor_top = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_top = -31.0
|
|
||||||
offset_right = 139.0
|
|
||||||
grow_vertical = 0
|
|
||||||
text = "Rotate CW Y-Axis"
|
text = "Rotate CW Y-Axis"
|
||||||
|
|
||||||
[node name="Y_CCW" type="Button" parent="CanvasLayer"]
|
[node name="Y_CCW" type="Button" parent="CanvasLayer/RotationVBoxContainer"]
|
||||||
anchors_preset = 1
|
layout_mode = 2
|
||||||
anchor_left = 1.0
|
|
||||||
anchor_right = 1.0
|
|
||||||
offset_left = -150.0
|
|
||||||
offset_bottom = 31.0
|
|
||||||
grow_horizontal = 0
|
|
||||||
text = "Rotate CCW Y-Axis"
|
text = "Rotate CCW Y-Axis"
|
||||||
|
|
||||||
|
[node name="DebugPlayerStuff" type="VBoxContainer" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -37.5
|
||||||
|
offset_right = 37.5
|
||||||
|
offset_bottom = 70.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
|
[node name="PlayerZLayerChangeUp" type="Button" parent="CanvasLayer/DebugPlayerStuff"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Z-layer +"
|
||||||
|
|
||||||
|
[node name="PlayerZLayerChangeDown" type="Button" parent="CanvasLayer/DebugPlayerStuff"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Z-layer -"
|
||||||
|
|
||||||
[connection signal="pressed" from="CanvasLayer/ResetButton" to="." method="_on_reset_button_pressed"]
|
[connection signal="pressed" from="CanvasLayer/ResetButton" to="." method="_on_reset_button_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/Z_CW" to="." method="_on_cw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/Z_CW" to="." method="_on_cw_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/Z_CCW" to="." method="_on_ccw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/Z_CCW" to="." method="_on_ccw_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/X_CW" to="." method="_on_x_cw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/X_CW" to="." method="_on_x_cw_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/X_CCW" to="." method="_on_x_ccw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/X_CCW" to="." method="_on_x_ccw_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/Y_CW" to="." method="_on_y_cw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/Y_CW" to="." method="_on_y_cw_pressed"]
|
||||||
[connection signal="pressed" from="CanvasLayer/Y_CCW" to="." method="_on_y_ccw_pressed"]
|
[connection signal="pressed" from="CanvasLayer/RotationVBoxContainer/Y_CCW" to="." method="_on_y_ccw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/DebugPlayerStuff/PlayerZLayerChangeUp" to="." method="_on_player_z_layer_change_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/DebugPlayerStuff/PlayerZLayerChangeDown" to="." method="_on_player_z_layer_change_down_pressed"]
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var map = $IsometricMapLayerHolder
|
||||||
|
var player = $Player
|
||||||
|
map.set_player(player)
|
||||||
|
map.init_player()
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
pass
|
pass
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -3,21 +3,21 @@ extends Control
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_start_button_pressed():
|
func _on_start_button_pressed():
|
||||||
get_tree().change_scene_to_file("res://scenes/debug_level.tscn")
|
get_tree().change_scene_to_file("res://scenes/debug_level.tscn")
|
||||||
|
|
||||||
|
|
||||||
func _on_option_button_pressed():
|
func _on_option_button_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
|
||||||
func _on_quit_button_pressed():
|
func _on_quit_button_pressed():
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|||||||
@ -3,11 +3,31 @@ extends CharacterBody2D
|
|||||||
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||||
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
|
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||||
|
|
||||||
|
var player_data = {
|
||||||
|
"stats": {
|
||||||
|
"health": 100,
|
||||||
|
"speed": 3,
|
||||||
|
"attack": 10,
|
||||||
|
"defense": 5
|
||||||
|
},
|
||||||
|
"inventory": [],
|
||||||
|
"name": "Hero"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func set_unit_position(x, y, z):
|
||||||
|
var z_layer = z
|
||||||
|
var x_position = x
|
||||||
|
var y_position = y
|
||||||
|
# Update the visual z-index directly
|
||||||
|
animated_sprite.z_index = z_layer
|
||||||
|
animated_sprite.position = Vector2i(x_position, y_position)
|
||||||
|
print("Palyer Z-Layer: ", z_layer)
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float):
|
func _process(_delta: float):
|
||||||
play_idle_animation()
|
play_idle_animation()
|
||||||
animated_sprite.z_index = 5
|
|
||||||
|
|
||||||
|
|
||||||
func play_idle_animation():
|
func play_idle_animation():
|
||||||
animated_sprite.play("down")
|
animated_sprite.play("down")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user