mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Remove the Grid.gd and Pawn.gd files
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
extends TileMap
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(NodePath) var dialogue_ui
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
set_cellv(world_to_map(child.position), child.type)
|
||||
|
||||
|
||||
func get_cell_pawn(cell, type = ACTOR):
|
||||
for node in get_children():
|
||||
if node.type != type:
|
||||
continue
|
||||
if world_to_map(node.position) == cell:
|
||||
return(node)
|
||||
|
||||
|
||||
func request_move(pawn, direction):
|
||||
var cell_start = world_to_map(pawn.position)
|
||||
var cell_target = cell_start + direction
|
||||
|
||||
var cell_tile_id = get_cellv(cell_target)
|
||||
match cell_tile_id:
|
||||
-1:
|
||||
set_cellv(cell_target, ACTOR)
|
||||
set_cellv(cell_start, -1)
|
||||
return map_to_world(cell_target) + cell_size / 2
|
||||
OBJECT, ACTOR:
|
||||
var target_pawn = get_cell_pawn(cell_target, cell_tile_id)
|
||||
print("Cell %s contains %s" % [cell_target, target_pawn.name])
|
||||
|
||||
if not target_pawn.has_node("DialoguePlayer"):
|
||||
return
|
||||
get_node(dialogue_ui).show_dialogue(pawn, target_pawn.get_node("DialoguePlayer"))
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
extends TileMap
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(NodePath) var dialog_ui
|
||||
|
||||
func _ready():
|
||||
for child in get_children():
|
||||
set_cellv(world_to_map(child.position), child.type)
|
||||
|
||||
func get_cell_pawn(cell, type = ACTOR):
|
||||
for node in get_children():
|
||||
if node.type != type:
|
||||
continue
|
||||
if world_to_map(node.position) == cell:
|
||||
return(node)
|
||||
|
||||
func request_move(pawn, direction):
|
||||
var cell_start = world_to_map(pawn.position)
|
||||
var cell_target = cell_start + direction
|
||||
|
||||
var cell_tile_id = get_cellv(cell_target)
|
||||
match cell_tile_id:
|
||||
-1:
|
||||
set_cellv(cell_target, ACTOR)
|
||||
set_cellv(cell_start, -1)
|
||||
return map_to_world(cell_target) + cell_size / 2
|
||||
OBJECT, ACTOR:
|
||||
var target_pawn = get_cell_pawn(cell_target, cell_tile_id)
|
||||
print("Cell %s contains %s" % [cell_target, target_pawn.name])
|
||||
|
||||
if not target_pawn.has_node("DialogPlayer"):
|
||||
return
|
||||
get_node(dialog_ui).show_dialog(pawn, target_pawn.get_node("DialogPlayer"))
|
||||
@@ -1,11 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(CELL_TYPES) var type = ACTOR
|
||||
|
||||
var active = true setget set_active
|
||||
|
||||
func set_active(value):
|
||||
active = value
|
||||
set_process(value)
|
||||
set_process_input(value)
|
||||
@@ -1,12 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
enum CELL_TYPES { ACTOR, OBSTACLE, OBJECT }
|
||||
export(CELL_TYPES) var type = ACTOR
|
||||
|
||||
export (PackedScene) var combat_actor
|
||||
var active = true setget set_active
|
||||
|
||||
func set_active(value):
|
||||
active = value
|
||||
set_process(value)
|
||||
set_process_input(value)
|
||||
Reference in New Issue
Block a user