Stuff
parent
2a22d3865c
commit
63aa1c0cb5
|
@ -6,6 +6,7 @@ const ACCELERATION: int = 2400
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
|
await get_tree().physics_frame
|
||||||
var movement: Vector2 = Vector2()
|
var movement: Vector2 = Vector2()
|
||||||
|
|
||||||
nav.target_position = get_global_mouse_position()
|
nav.target_position = get_global_mouse_position()
|
||||||
|
|
|
@ -15,6 +15,10 @@ run/main_scene="res://scenes/mario-party/MarioParty.tscn"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/stretch/mode="viewport"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
draw_toggle_polygon={
|
draw_toggle_polygon={
|
||||||
|
|
|
@ -5,6 +5,7 @@ extends Node2D
|
||||||
var navigation_nodes: Dictionary = {}
|
var navigation_nodes: Dictionary = {}
|
||||||
# type is Dictionary[CNavigationPolygon, Array[NavigationNode]]
|
# type is Dictionary[CNavigationPolygon, Array[NavigationNode]]
|
||||||
var polygon_nodes: Dictionary = {}
|
var polygon_nodes: Dictionary = {}
|
||||||
|
|
||||||
var latest_navigation_result: PathfindingResult = null
|
var latest_navigation_result: PathfindingResult = null
|
||||||
var draw_polygons: bool = true
|
var draw_polygons: bool = true
|
||||||
var draw_nodes: bool = false
|
var draw_nodes: bool = false
|
||||||
|
@ -116,8 +117,6 @@ func erase_and_create_nodes_from_polygons(new_polys: Array[PackedVector2Array])
|
||||||
poly = navpoly.set_polygon(poly)
|
poly = navpoly.set_polygon(poly)
|
||||||
polygon_nodes[navpoly] = []
|
polygon_nodes[navpoly] = []
|
||||||
|
|
||||||
polygon_nodes[navpoly] = []
|
|
||||||
|
|
||||||
# create one in the center of each polygon that is kept no matter what
|
# create one in the center of each polygon that is kept no matter what
|
||||||
# var poly_center: Vector2 = navpoly.center()
|
# var poly_center: Vector2 = navpoly.center()
|
||||||
# var center_node: NavigationNode = add_node(poly_center.x, poly_center.y, -1)
|
# var center_node: NavigationNode = add_node(poly_center.x, poly_center.y, -1)
|
||||||
|
@ -270,7 +269,6 @@ func dijkstra(start_node: NavigationNode, end_node: NavigationNode) -> Array[Nav
|
||||||
open_set.append(start_node)
|
open_set.append(start_node)
|
||||||
|
|
||||||
while open_set.size() > 0:
|
while open_set.size() > 0:
|
||||||
# Find the node with the smallest tentative distance
|
|
||||||
var current_node: NavigationNode = open_set[0]
|
var current_node: NavigationNode = open_set[0]
|
||||||
var current_distance: float = distances[current_node]
|
var current_distance: float = distances[current_node]
|
||||||
for node in open_set:
|
for node in open_set:
|
||||||
|
@ -278,7 +276,7 @@ func dijkstra(start_node: NavigationNode, end_node: NavigationNode) -> Array[Nav
|
||||||
current_node = node
|
current_node = node
|
||||||
current_distance = distances[node]
|
current_distance = distances[node]
|
||||||
|
|
||||||
# If the end node is reached, reconstruct the path
|
# if the end node is reached, reconstruct path
|
||||||
if current_node == end_node:
|
if current_node == end_node:
|
||||||
var path: Array[NavigationNode] = []
|
var path: Array[NavigationNode] = []
|
||||||
var node: NavigationNode = end_node
|
var node: NavigationNode = end_node
|
||||||
|
@ -290,7 +288,7 @@ func dijkstra(start_node: NavigationNode, end_node: NavigationNode) -> Array[Nav
|
||||||
open_set.erase(current_node)
|
open_set.erase(current_node)
|
||||||
closed_set.append(current_node)
|
closed_set.append(current_node)
|
||||||
|
|
||||||
# Examine neighbors of the current node
|
# neighbors of the current node
|
||||||
var neighbors = get_connections(current_node)
|
var neighbors = get_connections(current_node)
|
||||||
for neighbor in neighbors:
|
for neighbor in neighbors:
|
||||||
if array_contains_node(closed_set, neighbor):
|
if array_contains_node(closed_set, neighbor):
|
||||||
|
@ -304,5 +302,5 @@ func dijkstra(start_node: NavigationNode, end_node: NavigationNode) -> Array[Nav
|
||||||
if not array_contains_node(open_set, neighbor):
|
if not array_contains_node(open_set, neighbor):
|
||||||
open_set.append(neighbor)
|
open_set.append(neighbor)
|
||||||
|
|
||||||
# No path found; return an empty array
|
# no path found
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -14,10 +14,10 @@ script = ExtResource("1_tis1c")
|
||||||
navigation_polygon = [NodePath("NavPolygon2D_1"), NodePath("SmallPolygon2D"), NodePath("NavPolygon2D_2")]
|
navigation_polygon = [NodePath("NavPolygon2D_1"), NodePath("SmallPolygon2D"), NodePath("NavPolygon2D_2")]
|
||||||
|
|
||||||
[node name="NavPolygon2D_2" type="Polygon2D" parent="."]
|
[node name="NavPolygon2D_2" type="Polygon2D" parent="."]
|
||||||
polygon = PackedVector2Array(474, 298, 379, 295, 381, 261, 479, 98, 422, 71, 336, 203, 334, 47, 255, 43, 49, 42, 48, 119, 55, 247, 109, 244, 112, 126, 253, 119, 249, 176, 153, 177, 153, 240, 253, 236, 289, 322, 69, 300, 74, 390, 475, 400, 484, 463, 104, 458, 108, 630, 222, 633, 222, 542, 476, 569, 748, 642, 984, 642, 979, 580, 911, 563, 910, 495, 831, 495, 847, 563, 701, 493, 656, 402, 926, 414, 995, 516, 1110, 517, 985, 319, 774, 292, 765, 244, 884, 266, 896, 206, 764, 167, 675, 226, 703, 295, 652, 295, 554, 179, 805, 106, 935, 128, 998, 249, 1105, 257, 934, 19, 616, 61, 476, 167)
|
visible = false
|
||||||
|
polygon = PackedVector2Array(474, 298, 379, 295, 381, 261, 479, 98, 422, 71, 336, 203, 334, 47, 255, 43, 49, 42, 48, 119, 55, 247, 109, 244, 134, 127, 253, 119, 249, 176, 153, 177, 153, 240, 253, 236, 289, 322, 69, 300, 74, 390, 475, 400, 619, 511, 222, 449, 108, 630, 222, 633, 297, 544, 476, 569, 748, 642, 984, 642, 979, 580, 911, 563, 910, 495, 831, 495, 847, 563, 701, 493, 656, 402, 926, 414, 995, 516, 1110, 517, 985, 319, 774, 292, 765, 244, 884, 266, 896, 206, 764, 167, 675, 226, 703, 295, 652, 295, 600, 200, 805, 106, 935, 128, 998, 249, 1105, 257, 934, 19, 616, 61, 476, 167)
|
||||||
|
|
||||||
[node name="NavPolygon2D_1" type="Polygon2D" parent="."]
|
[node name="NavPolygon2D_1" type="Polygon2D" parent="."]
|
||||||
visible = false
|
|
||||||
polygon = PackedVector2Array(164, 56, 379, 23, 603, 53, 684, 152, 759, 255, 572, 293, 598, 166, 422, 106, 344, 158, 509, 312, 438, 454, 489, 504, 610, 342, 734, 323, 834, 199, 786, 85, 958, 43, 1117, 48, 1109, 194, 1137, 565, 916, 550, 887, 386, 965, 359, 962, 473, 1000, 494, 1002, 204, 928, 184, 916, 304, 837, 382, 835, 541, 752, 563, 732, 421, 627, 450, 592, 618, 335, 540, 295, 412, 361, 311, 190, 169, 194, 329, 278, 510, 132, 589, 133, 459, 77, 311, 48, 130)
|
polygon = PackedVector2Array(164, 56, 379, 23, 603, 53, 684, 152, 759, 255, 572, 293, 598, 166, 422, 106, 344, 158, 509, 312, 438, 454, 489, 504, 610, 342, 734, 323, 834, 199, 786, 85, 958, 43, 1117, 48, 1109, 194, 1137, 565, 916, 550, 887, 386, 965, 359, 962, 473, 1000, 494, 1002, 204, 928, 184, 916, 304, 837, 382, 835, 541, 752, 563, 732, 421, 627, 450, 592, 618, 335, 540, 295, 412, 361, 311, 190, 169, 194, 329, 278, 510, 132, 589, 133, 459, 77, 311, 48, 130)
|
||||||
|
|
||||||
[node name="SmallPolygon2D" type="Polygon2D" parent="."]
|
[node name="SmallPolygon2D" type="Polygon2D" parent="."]
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -65,6 +65,10 @@ func roll_dice() -> void:
|
||||||
indicator_scene.global_position = local_to_world(node.get_position())
|
indicator_scene.global_position = local_to_world(node.get_position())
|
||||||
add_child(indicator_scene)
|
add_child(indicator_scene)
|
||||||
|
|
||||||
|
# await get_tree().create_timer(1.0).timeout
|
||||||
|
# var picked = movement_options[randi() % (len(movement_options))]
|
||||||
|
# _on_indicator_clicked(picked.position, "player_movement")
|
||||||
|
|
||||||
|
|
||||||
func _on_indicator_clicked(pos: Vector2, type: String) -> void:
|
func _on_indicator_clicked(pos: Vector2, type: String) -> void:
|
||||||
print("Indicator clicked: ", type, " ", pos)
|
print("Indicator clicked: ", type, " ", pos)
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
[gd_resource type="TileSet" load_steps=7 format=3 uid="uid://cm6wi7fjgfk56"]
|
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://cm6wi7fjgfk56"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bif0n5c12bwrh" path="res://addons/sprout_lands_tilemap/assets/Tilesets/Water.png" id="1_j6mfj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cmb6k735nhxmy" path="res://scenes/mario-party/img/data_layer.png" id="1_pdyr2"]
|
[ext_resource type="Texture2D" uid="uid://cmb6k735nhxmy" path="res://scenes/mario-party/img/data_layer.png" id="1_pdyr2"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bngfh7nslvij1" path="res://addons/sprout_lands_tilemap/assets/Tilesets/Grass.png" id="2_ev1xx"]
|
[ext_resource type="Texture2D" uid="uid://bngfh7nslvij1" path="res://addons/sprout_lands_tilemap/assets/Tilesets/Grass.png" id="2_ev1xx"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cvemyer4jq6we" path="res://addons/sprout_lands_tilemap/assets/Objects/Paths.png" id="3_eigvu"]
|
[ext_resource type="Texture2D" uid="uid://cvemyer4jq6we" path="res://addons/sprout_lands_tilemap/assets/Objects/Paths.png" id="3_eigvu"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wcjgp"]
|
||||||
|
texture = ExtResource("1_j6mfj")
|
||||||
|
0:0/0 = 0
|
||||||
|
1:0/0 = 0
|
||||||
|
2:0/0 = 0
|
||||||
|
3:0/0 = 0
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_tp5r2"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_tp5r2"]
|
||||||
texture = ExtResource("1_pdyr2")
|
texture = ExtResource("1_pdyr2")
|
||||||
0:0/0 = 0
|
0:0/0 = 0
|
||||||
|
@ -120,3 +128,4 @@ custom_data_layer_2/type = 4
|
||||||
sources/1 = SubResource("TileSetAtlasSource_tp5r2")
|
sources/1 = SubResource("TileSetAtlasSource_tp5r2")
|
||||||
sources/2 = SubResource("TileSetAtlasSource_m45pk")
|
sources/2 = SubResource("TileSetAtlasSource_m45pk")
|
||||||
sources/3 = SubResource("TileSetAtlasSource_xi3gi")
|
sources/3 = SubResource("TileSetAtlasSource_xi3gi")
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_wcjgp")
|
||||||
|
|
|
@ -2,7 +2,6 @@ extends Node2D
|
||||||
|
|
||||||
@onready var floor: NavigationRegion2D = $BaseNavigationRegion2D
|
@onready var floor: NavigationRegion2D = $BaseNavigationRegion2D
|
||||||
@onready var road: NavigationRegion2D = $CheapPathNavigationRegion2D
|
@onready var road: NavigationRegion2D = $CheapPathNavigationRegion2D
|
||||||
# @onready var road_poly: Polygon2D = $CheapPathNavigationRegion2D/CheapPath
|
|
||||||
@onready var road_poly: Polygon2D = $BaseNavigationRegion2D/CheapPath
|
@onready var road_poly: Polygon2D = $BaseNavigationRegion2D/CheapPath
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,3 @@
|
||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
After Width: | Height: | Size: 994 B |
|
@ -0,0 +1,37 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://beggt5ndi6j4p"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
|
@ -0,0 +1,15 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="state"
|
||||||
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
|
@ -0,0 +1,18 @@
|
||||||
|
class_name State
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var state_machine: StateMachine
|
||||||
|
var character: CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func state_enter() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func state_process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func state_exit() -> void:
|
||||||
|
pass
|
|
@ -0,0 +1,19 @@
|
||||||
|
class_name StateMachine
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var current_state: State:
|
||||||
|
set(value):
|
||||||
|
if current_state:
|
||||||
|
current_state.state_exit()
|
||||||
|
current_state = value
|
||||||
|
current_state.state_enter()
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
for child in self.get_children():
|
||||||
|
if true:
|
||||||
|
print(child)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://cgdvptekjbpgq"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://beggt5ndi6j4p" path="res://icon.svg" id="1_jgx5y"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/state/StateMachine.gd" id="2_d1xqo"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/state/state_idle.gd" id="3_r1btx"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_tr1gq"]
|
||||||
|
radius = 60.0
|
||||||
|
height = 122.0
|
||||||
|
|
||||||
|
[node name="StateMachineWorld" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
|
||||||
|
texture = ExtResource("1_jgx5y")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||||
|
shape = SubResource("CapsuleShape2D_tr1gq")
|
||||||
|
|
||||||
|
[node name="StateMachine" type="Node" parent="CharacterBody2D"]
|
||||||
|
script = ExtResource("2_d1xqo")
|
||||||
|
|
||||||
|
[node name="idle" type="Node" parent="CharacterBody2D/StateMachine"]
|
||||||
|
script = ExtResource("3_r1btx")
|
|
@ -0,0 +1,10 @@
|
||||||
|
extends State
|
||||||
|
|
||||||
|
func state_enter():
|
||||||
|
print("idle enter")
|
||||||
|
|
||||||
|
func state_process(delta: float) -> void:
|
||||||
|
print("idle process")
|
||||||
|
|
||||||
|
func state_exit() -> void:
|
||||||
|
print("idle exit")
|
Loading…
Reference in New Issue