Removed old files

master
Martin Felis 2021-07-18 16:28:30 +02:00
parent 0ed4540bf0
commit 0e34313ac6
65 changed files with 258 additions and 1008 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.import/* .import/*
.*.swp .*.swp
*.*~ *.*~
export/*

View File

@ -1,24 +0,0 @@
extends Sprite
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var world_offset = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _process(_delta):
region_rect.size = OS.get_window_safe_area().size
var time = OS.get_system_time_msecs()
var texture_size = texture.get_size()
var texture_offset = Vector2(
world_offset.x / texture_size.x,
world_offset.y / texture_size.y
)
print ("offset: ", texture_offset)
material.set_shader_param("uv_offset", texture_offset)
update()

File diff suppressed because one or more lines are too long

View File

@ -1,39 +0,0 @@
extends Node2D
var NavTarget
func _ready():
NavTarget = get_node("NavTarget")
func draw_nav_target_box():
var rect = Rect2 (NavTarget.GridCoords * Globals.GRID_SIZE, Vector2(Globals.GRID_SIZE, Globals.GRID_SIZE))
draw_rect (rect, "#99000044", true)
func _process(_delta):
update()
func _draw():
var offset = -Vector2(Globals.WIDTH, Globals.HEIGHT) * 0.5
draw_nav_target_box()
draw_set_transform(offset, 0, Vector2.ONE)
# outer bounds
draw_line(Vector2(0,0), Vector2(Globals.WIDTH, 0), Globals.GRID_COLOR)
draw_line(Vector2(0,Globals.HEIGHT), Vector2(Globals.WIDTH, Globals.HEIGHT), Globals.GRID_COLOR)
draw_line(Vector2(0,0), Vector2(0, Globals.HEIGHT), Globals.GRID_COLOR)
draw_line(Vector2(Globals.WIDTH,0), Vector2(Globals.WIDTH, Globals.HEIGHT), Globals.GRID_COLOR)
# inner lines
var columns = floor (Globals.WIDTH / Globals.GRID_SIZE)
var rows = floor (Globals.HEIGHT / Globals.GRID_SIZE)
for x in range (columns):
draw_line (Vector2(x * Globals.GRID_SIZE, 0), Vector2(x * Globals.GRID_SIZE, Globals.HEIGHT), Globals.GRID_COLOR)
for y in range (rows):
draw_line (Vector2(0, y * Globals.GRID_SIZE), Vector2(Globals.WIDTH, y * Globals.GRID_SIZE), Globals.GRID_COLOR)
draw_line(Vector2(0, Globals.HEIGHT * 0.5), Vector2(Globals.WIDTH, Globals.HEIGHT * 0.5), "#aa0000", 3)
draw_line(Vector2(Globals.WIDTH * 0.5, 0), Vector2(Globals.WIDTH * 0.5, Globals.HEIGHT), "#00aa00", 3)

View File

@ -1,15 +0,0 @@
extends Node2D
var HasTreasure = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
get_node("treasuredigsite").visible = HasTreasure
get_node("digsite").visible = not HasTreasure
update()

View File

@ -1,18 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/digsite.svg" type="Texture" id=1]
[ext_resource path="res://assets/treasuredigsite.svg" type="Texture" id=2]
[ext_resource path="res://DigSite.gd" type="Script" id=3]
[node name="DigSite" type="Node2D"]
z_index = 3
script = ExtResource( 3 )
[node name="treasuredigsite" type="Sprite" parent="."]
visible = false
position = Vector2( -1.7818, -19.5998 )
texture = ExtResource( 2 )
[node name="digsite" type="Sprite" parent="."]
visible = false
texture = ExtResource( 1 )

View File

@ -1,24 +0,0 @@
extends Camera2D
var Widgets
# Called when the node enters the scene tree for the first time.
func _ready():
Widgets = get_node("Widgets")
pass # Replace with function body.
func _process(_delta):
var win_size = OS.get_window_safe_area().size
Widgets.margin_left = -win_size.x * 0.5
Widgets.margin_top = -win_size.y * 0.5
pass
func screenToWorld(pos):
var screen_size = OS.get_window_safe_area().size
print ("pos", pos)
print ("Screen size: ", screen_size)
var camera_coords = pos - screen_size * 0.5
print ("Camera coords: ", camera_coords)
var world_coords = camera_coords + self.transform.origin
print ("world coords: ", world_coords)
return world_coords

View File

@ -1,71 +0,0 @@
extends Node2D
var Player
var Level
var GameCamera
var DebugLayer
var BackgroundWater
var NavTarget
var DebugLabel
var DigSite
var DiggedSites = {}
var ChestLocations = {}
# Called when the node enters the scene tree for the first time.
func _ready():
Player = get_node("Player")
Level = get_node("Level")
GameCamera = get_node("GameCamera")
DebugLayer = get_node("DebugLayer")
NavTarget = get_node("DebugLayer/NavTarget")
BackgroundWater = get_node("GameCamera/BackgroundWater")
DebugLabel = GameCamera.get_node("Widgets/HBoxContainer/DebugLabel")
DigSite = preload("res://DigSite.tscn")
Globals.DebugLabel = DebugLabel
ChestLocations[Vector2(3,3)] = true
Player.connect("DigSiteReached", self, "handle_dig_site_reached")
Player.connect("DigStop", self, "handle_dig_stop")
func handle_dig_site_reached(dig_grid_coords):
if not DiggedSites.has(dig_grid_coords):
print ("Starting digging at ", dig_grid_coords)
Player.CurrentDigGridCoords = dig_grid_coords
Player.start_dig()
func handle_dig_stop():
print ("Stopping digging")
var dig_grid_coords = Player.CurrentDigGridCoords
if dig_grid_coords == null:
print ("Error: handling stop dig but have no dig coords!")
return
var has_treasure = ChestLocations.has(dig_grid_coords)
DiggedSites[dig_grid_coords] = true
var new_digsite = DigSite.instance()
new_digsite.HasTreasure = has_treasure
new_digsite.transform.origin = Globals.GridCenterToWorldCoord(dig_grid_coords)
Level.add_child(new_digsite)
Player.CurrentDigGridCoords = null
func _process(delta):
Globals.ClearDebugLabel()
var screen_size = OS.get_window_safe_area().size
GameCamera.transform.origin = Player.transform.origin - screen_size * 0
BackgroundWater.world_offset = GameCamera.transform.origin
func _input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
var event_world_pos = GameCamera.screenToWorld(event.position)
NavTarget.transform.origin = event_world_pos
Player.NavTarget = Globals.WorldToGridCenter(event_world_pos)
DebugLabel.text = str(event_world_pos)
if event.button_index == BUTTON_WHEEL_UP and event.pressed:
print("Wheel up")

View File

@ -1,83 +0,0 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://assets/island.svg" type="Texture" id=1]
[ext_resource path="res://Player.gd" type="Script" id=2]
[ext_resource path="res://BackgroundWater.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/pirate.svg" type="Texture" id=4]
[ext_resource path="res://GameScene.gd" type="Script" id=5]
[ext_resource path="res://assets/pirate_with_shovel.svg" type="Texture" id=6]
[ext_resource path="res://DebugLayer.gd" type="Script" id=7]
[ext_resource path="res://GameCamera.gd" type="Script" id=8]
[ext_resource path="res://NavTarget.gd" type="Script" id=9]
[ext_resource path="res://DigSite.tscn" type="PackedScene" id=10]
[node name="GameScene" type="Node2D"]
script = ExtResource( 5 )
[node name="DebugLayer" type="Node2D" parent="."]
visible = false
z_index = 2
script = ExtResource( 7 )
[node name="NavTarget" type="Node2D" parent="DebugLayer"]
z_index = 5
script = ExtResource( 9 )
[node name="Level" type="Node2D" parent="."]
z_index = -1
[node name="Water" type="Sprite" parent="Level"]
scale = Vector2( 1098, 303 )
[node name="island" type="Sprite" parent="Level"]
z_index = 1
texture = ExtResource( 1 )
[node name="DigSite" parent="Level" instance=ExtResource( 10 )]
[node name="Player" type="Node2D" parent="."]
script = ExtResource( 2 )
[node name="PirateSprite" type="Sprite" parent="Player"]
texture = ExtResource( 4 )
[node name="PirateWithShovelSprite" type="Sprite" parent="Player"]
texture = ExtResource( 6 )
[node name="ShovelTargetOffset" type="Node2D" parent="Player"]
position = Vector2( 88, 74 )
[node name="GameCamera" type="Camera2D" parent="."]
current = true
script = ExtResource( 8 )
[node name="Widgets" type="Control" parent="GameCamera"]
margin_left = 8.0
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="GameCamera/Widgets"]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DebugLabel" type="Label" parent="GameCamera/Widgets/HBoxContainer"]
self_modulate = Color( 0, 0, 0, 1 )
margin_top = 4.0
margin_right = 109.0
margin_bottom = 35.0
text = "Blabuiaeuiaeuiae
"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Node2D" type="Node2D" parent="GameCamera/Widgets"]
z_index = -10
[node name="BackgroundWater" parent="GameCamera" instance=ExtResource( 3 )]

View File

@ -17,16 +17,16 @@ var debug_nav = false
# 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():
HexGrid = preload("../thirdparty/gdhexgrid/HexGrid.gd").new() HexGrid = preload("res://addons/gdhexgrid/HexGrid.gd").new()
HexGrid.hex_scale = Vector2(hex_size, hex_size) HexGrid.hex_scale = Vector2(hex_size, hex_size)
OceanNavGrid = preload("../thirdparty/gdhexgrid/HexGrid.gd").new() OceanNavGrid = preload("res://addons/gdhexgrid/HexGrid.gd").new()
OceanNavGrid.hex_scale = Vector2(hex_size, hex_size) OceanNavGrid.hex_scale = Vector2(hex_size, hex_size)
IslandNavGrid = preload("../thirdparty/gdhexgrid/HexGrid.gd").new() IslandNavGrid = preload("res://addons/gdhexgrid/HexGrid.gd").new()
IslandNavGrid.hex_scale = Vector2(hex_size, hex_size) IslandNavGrid.hex_scale = Vector2(hex_size, hex_size)
HexCell = preload("../thirdparty/gdhexgrid/HexCell.gd").new() HexCell = preload("res://addons/gdhexgrid/HexCell.gd").new()
HexTileDrawer.hex_scale = Vector2(hex_size, hex_size) HexTileDrawer.hex_scale = Vector2(hex_size, hex_size)

View File

@ -1,26 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/island.svg" type="Texture" id=1]
[ext_resource path="res://Player.gd" type="Script" id=2]
[ext_resource path="res://assets/water.svg" type="Texture" id=3]
[ext_resource path="res://assets/pirate.svg" type="Texture" id=4]
[node name="Node2D" type="Node2D"]
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 1098, 303 )
texture = ExtResource( 3 )
[node name="island" type="Sprite" parent="."]
position = Vector2( 485, 278 )
texture = ExtResource( 1 )
[node name="Player" type="Node2D" parent="."]
script = ExtResource( 2 )
[node name="pirate" type="Sprite" parent="Player"]
position = Vector2( 228, 207 )
texture = ExtResource( 4 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true

View File

@ -1,45 +0,0 @@
extends Node2D
var circles = []
# Called when the node enters the scene tree for the first time.
func _ready():
generate()
func add_circle (pos, radius, color):
circles.append ([pos, radius, color])
func render_recursive (pos, radius, count):
add_circle (pos, radius, "#888888")
for i in range (count):
var angle = rand_range(0, 2 * PI)
var dist_scale = rand_range (0.9, 1.8)
var coord = Vector2 (cos(angle), sin(angle)) * radius * dist_scale
render_recursive (pos + coord, radius * 0.6, count - 1)
func generate():
var start = OS.get_window_safe_area().size * 0.5
var radius = 100
circles.clear()
render_recursive (start, radius, get_node("HBoxContainer/IterationsSpinBox").value)
var angle = rand_range(0, 2 * PI)
var coord = Vector2 (cos(angle), sin(angle)) * radius * 3
render_recursive (start + coord, 70, get_node("HBoxContainer/IterationsSpinBox").value)
render_recursive (start + coord * 2, 60, get_node("HBoxContainer/IterationsSpinBox").value)
update()
get_node("blur").texture = get_viewport().get_texture()
# get_node("pixelate").texture = get_viewport().get_texture()
func _draw():
for c in circles:
draw_circle (c[0], c[1], c[2])
func _on_Button_pressed():
generate()

View File

@ -1,118 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://IslandGenerator.gd" type="Script" id=1]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
/*
uniform float lod: hint_range(0.0, 5) = 0.0;
void fragment3(){
vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV, lod);
COLOR = color;
}
*/
/*
六角形モザイク by あるる(きのもと 結衣)
Hex Noise by Yui Kinomoto @arlez80
MIT License
*/
//shader_type canvas_item;
uniform vec2 size = vec2( 64.0, 48.0 );
void fragment( )
{
vec2 norm_size = size * SCREEN_PIXEL_SIZE;
bool half = mod( SCREEN_UV.y / 2.0, norm_size.y ) / norm_size.y < 0.5;
vec2 uv = SCREEN_UV + vec2( norm_size.x * 0.5 * float( half ), 0.0 );
vec2 center_uv = floor( uv / norm_size ) * norm_size;
vec2 norm_uv = mod( uv, norm_size ) / norm_size;
center_uv += mix(
vec2( 0.0, 0.0 )
, mix(
mix(
vec2( norm_size.x, -norm_size.y )
, vec2( 0.0, -norm_size.y )
, float( norm_uv.x < 0.5 )
)
, mix(
vec2( 0.0, -norm_size.y )
, vec2( -norm_size.x, -norm_size.y )
, float( norm_uv.x < 0.5 )
)
, float( half )
)
, float( norm_uv.y < 0.3333333 ) * float( norm_uv.y / 0.3333333 < ( abs( norm_uv.x - 0.5 ) * 2.0 ) )
);
COLOR = textureLod( SCREEN_TEXTURE, center_uv, 0.0 );
}
"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/size = Vector2( 64, 48 )
[sub_resource type="Shader" id=3]
code = "shader_type canvas_item;
uniform int amount = 80;
void fragment()
{
vec2 grid_uv = round(UV * float(amount)) / float(amount);
vec4 text = texture(TEXTURE, grid_uv);
COLOR = text;
}"
[sub_resource type="ShaderMaterial" id=4]
shader = SubResource( 3 )
shader_param/amount = 80
[sub_resource type="ImageTexture" id=5]
flags = 0
flags = 0
size = Vector2( 256, 256 )
[node name="IslandGenerator" type="Node2D"]
scale = Vector2( 1.00254, 1 )
script = ExtResource( 1 )
[node name="blur" type="Sprite" parent="."]
material = SubResource( 2 )
scale = Vector2( 0.976278, 1 )
centered = false
[node name="pixelate" type="Sprite" parent="."]
visible = false
material = SubResource( 4 )
scale = Vector2( 1.30352, 0.863349 )
texture = SubResource( 5 )
centered = false
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 149.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" type="Button" parent="HBoxContainer"]
margin_right = 71.0
margin_bottom = 40.0
text = "Generate"
[node name="IterationsSpinBox" type="SpinBox" parent="HBoxContainer"]
margin_left = 75.0
margin_right = 149.0
margin_bottom = 40.0
value = 4.0
[connection signal="pressed" from="HBoxContainer/Button" to="." method="_on_Button_pressed"]

View File

@ -1,10 +0,0 @@
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -1,16 +0,0 @@
extends Node2D
var GridCoords = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _process(_delta):
GridCoords = Globals.WorldToGridCoord(self.transform.origin)
Globals.DebugLabelAdd(str("GridCoords: ", GridCoords))
Globals.DebugLabelAdd(str("Nav Origin: ", self.transform.origin))
func _draw():
draw_circle (Vector2.ZERO, 5, "#ff0000")

View File

@ -1,83 +0,0 @@
extends Node2D
enum PlayerState {
IDLE,
WALKING,
SHOVEL
}
signal DigSiteReached
signal DigStop
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var speed = 200
var isInteracting = false
var ShovelSprite
var shovel_offset = Vector2.ZERO
var NavTarget = Vector2.ZERO
var State = PlayerState.IDLE
var ShovelTimer = 0
var CurrentDigGridCoords = null
# Called when the node enters the scene tree for the first time.
func _ready():
ShovelSprite = get_node("PirateWithShovelSprite")
var ShovelTargetOffset = get_node("ShovelTargetOffset")
shovel_offset = ShovelTargetOffset.transform.origin - self.transform.origin
func start_dig():
self.State = PlayerState.SHOVEL
self.ShovelTimer = Globals.SHOVEL_DURATION
func update_state(delta):
if State == PlayerState.SHOVEL:
ShovelTimer = ShovelTimer - delta
if ShovelTimer < 0:
emit_signal ("DigStop")
ShovelTimer = 0
State = PlayerState.IDLE
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
update_state(delta)
Globals.DebugLabelAdd(str("Player.NavTarget: ", NavTarget))
var direction = Vector2.ZERO
if Input.is_action_pressed("walk_left"):
direction.x = direction.x - 1
if Input.is_action_pressed("walk_right"):
direction.x = direction.x + 1
if Input.is_action_pressed("walk_up"):
direction.y = direction.y - 1
if Input.is_action_pressed("walk_down"):
direction.y = direction.y + 1
direction = direction.normalized()
var movement_target = NavTarget - shovel_offset
var vec_to_target = movement_target - self.transform.origin
var dist_to_target = vec_to_target.length()
Globals.DebugLabelAdd(str("Direction: ", direction))
if dist_to_target > speed * delta:
direction = (vec_to_target).normalized()
var velocity = direction * speed
self.transform.origin = self.transform.origin + velocity * delta
self.State = PlayerState.WALKING
else:
direction = Vector2.ZERO
self.transform.origin = movement_target
if self.State == PlayerState.WALKING:
emit_signal ("DigSiteReached", Globals.WorldToGridCoord(NavTarget))
ShovelSprite.visible = State == PlayerState.SHOVEL

View File

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
debug.keystore Normal file

Binary file not shown.

View File

@ -1,27 +0,0 @@
# Script to attach to a node which represents a hex grid
extends Node2D
var HexGrid = preload("../thirdparty/gdhexgrid/HexGrid.gd").new()
onready var highlight = get_node("Highlight")
onready var area_coords = get_node("Highlight/AreaCoords")
onready var hex_coords = get_node("Highlight/HexCoords")
func _ready():
HexGrid.hex_scale = Vector2(50, 50)
func _unhandled_input(event):
if 'position' in event:
var relative_pos = self.transform.affine_inverse() * event.position
# Display the coords used
if area_coords != null:
area_coords.text = str(relative_pos)
if hex_coords != null:
hex_coords.text = str(HexGrid.get_hex_at(relative_pos).axial_coords)
# Snap the highlight to the nearest grid cell
if highlight != null:
highlight.position = HexGrid.get_hex_center(HexGrid.get_hex_at(relative_pos))

View File

@ -1,22 +0,0 @@
extends Camera2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func ScreenToWorld (pos_screen: Vector2):
var camera_offset = OS.get_window_safe_area().size * 0.5 * zoom - transform.origin
return (pos_screen * zoom - camera_offset)
func WorldToScreen (pos_world: Vector2):
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -1,108 +0,0 @@
extends Node2D
enum TileType {
None,
Sand,
Grass
}
var HexGrid = preload("res://thirdparty/gdhexgrid/HexGrid.gd").new()
var size = [40,60]
var tile_size = 64
var HexPoints = null
var HexColors = null
# Tiles order:
# 0,0 0,1 0,2 ...
# 1,0 1,1 1,2 ...
# 2,0 2,1 2,2
# ...
# .. size[0],size[1]
var tile_data = []
# Called when the node enters the scene tree for the first time.
func _ready():
clear()
pass # Replace with function body.
func clear():
create_hex_points (tile_size)
HexGrid.hex_scale = Vector2(tile_size, tile_size) * 2
for r in range (size[1]):
for c in range (size[0]):
tile_data.append(TileType.None)
func GetTile(r, c):
if r < 0 or r >= size[1] or c < 0 or c >= size[0]:
print ("Invalid tile coord: ", r, ", ", c)
return
return tile_data[c * size[1] + r]
func SetTile(r, c, tile_type):
if r < 0 or r >= size[1] or c < 0 or c >= size[0]:
print ("Invalid tile coord: ", r, ", ", c)
return
tile_data[c * size[1] + r] = tile_type
update()
func WorldToTileCoords (pos):
pos = pos
return HexGrid.get_hex_at(Vector2(pos.x, -pos.y)).axial_coords
func GetHexCenter(hex):
var center = HexGrid.get_hex_center(hex)
return Vector2 (center.x, -center.y)
func create_hex_points (size):
HexPoints = PoolVector2Array()
var NoneColors = PoolColorArray()
var SandColors = PoolColorArray()
var GrassColors = PoolColorArray()
for i in range (7):
var angle = (60 * i) * PI / 180
HexPoints.append(Vector2(cos(angle), sin(angle)) * size)
NoneColors.append("#555555")
SandColors.append("#ffa106")
GrassColors.append("#4b9635")
HexColors = {
TileType.None: NoneColors,
TileType.Sand: SandColors,
TileType.Grass: GrassColors
}
func draw_grid():
var pos_start = HexGrid.get_hex_center(Vector2(0,0))
var w = 2 * tile_size
var h = sqrt(3) * tile_size
var initial_transform = get_canvas_transform()
for ci in range (size[0]):
draw_set_transform_matrix(initial_transform)
for ri in range (size[1]):
var tile_type = GetTile(ri, ci)
if tile_type == null:
tile_type = TileType.None
var color_array = HexColors[tile_type]
var tile_center = GetHexCenter(Vector2(ri, ci))
draw_set_transform(tile_center, 0, Vector2.ONE)
draw_polygon(HexPoints, color_array)
draw_polyline(HexPoints, "#888888")
func _draw():
draw_grid()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -1,62 +0,0 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var GridLevel
var highlight_hex_coord = Vector2(0,0)
onready var camera = get_node("Camera2D")
onready var ui = get_node("Camera2D/UI")
onready var ScreenCoords = get_node("Camera2D/UI/ScreenCoords")
onready var HexCoords = get_node("Camera2D/UI/HexCoords")
onready var WorldCoords = get_node("Camera2D/UI/WorldCoords")
onready var TileType = get_node("Camera2D/UI/TileType")
# Called when the node enters the scene tree for the first time.
func _ready():
GridLevel = get_node("GridLevel")
TileType.add_item("None", 0)
TileType.add_item("Sand", 1)
TileType.add_item("Grass", 2)
update()
func _process(_delta):
var view_size = OS.get_window_safe_area().size
ui.rect_position = -view_size * 0.5
update()
func _unhandled_input(event):
if 'position' in event:
ScreenCoords.text = str(event.position)
var world_coords = camera.ScreenToWorld(event.position)
WorldCoords.text = str(world_coords)
var hex_coords = GridLevel.WorldToTileCoords(world_coords)
HexCoords.text = str(hex_coords)
highlight_hex_coord = GridLevel.GetHexCenter(hex_coords)
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
GridLevel.SetTile (hex_coords.x, hex_coords.y, TileType.selected)
if event.button_index == BUTTON_WHEEL_DOWN and event.pressed:
camera.zoom = camera.zoom * 1.0 / 0.8
if event.button_index == BUTTON_WHEEL_UP and event.pressed:
camera.zoom = camera.zoom * 0.8
if event is InputEventMouseButton and Input.is_mouse_button_pressed(BUTTON_MIDDLE):
camera.transform.origin = world_coords
update()
func _draw():
draw_set_transform(highlight_hex_coord, 0, Vector2.ONE)
draw_polyline(GridLevel.HexPoints, "#ff0000", 4)

View File

@ -1,127 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://editor/GridLevel.gd" type="Script" id=1]
[ext_resource path="res://editor/IslandEditor.gd" type="Script" id=2]
[ext_resource path="res://editor/Area2D.gd" type="Script" id=3]
[ext_resource path="res://editor/Camera2D.gd" type="Script" id=4]
[node name="Editor" type="Node2D"]
script = ExtResource( 2 )
[node name="GridLevel" type="Node2D" parent="."]
z_index = -2
script = ExtResource( 1 )
[node name="Camera2D" type="Camera2D" parent="."]
current = true
script = ExtResource( 4 )
[node name="Area2D" type="Node2D" parent="Camera2D"]
script = ExtResource( 3 )
[node name="Highlight" type="Node2D" parent="Camera2D/Area2D"]
[node name="Highlight" type="Label" parent="Camera2D/Area2D/Highlight"]
margin_top = 13.0
margin_bottom = 27.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AreaCoords" type="Label" parent="Camera2D/Area2D/Highlight"]
margin_left = 10.8379
margin_top = 34.1084
margin_right = 29.8379
margin_bottom = 48.1084
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HexCoords" type="Label" parent="Camera2D/Area2D/Highlight"]
margin_left = 8.0
margin_top = 13.0
margin_right = 27.0
margin_bottom = 27.0
rect_pivot_offset = Vector2( -534.527, -13 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="UI" type="HBoxContainer" parent="Camera2D"]
margin_right = 287.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="New" type="Button" parent="Camera2D/UI"]
margin_right = 44.0
margin_bottom = 40.0
text = "Clear"
[node name="SpinBox" type="SpinBox" parent="Camera2D/UI"]
margin_left = 48.0
margin_right = 122.0
margin_bottom = 40.0
min_value = 1.0
max_value = 32.0
value = 1.0
[node name="TileType" type="OptionButton" parent="Camera2D/UI"]
margin_left = 126.0
margin_right = 155.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScreenCoordsLabel" type="Label" parent="Camera2D/UI"]
margin_left = 159.0
margin_top = 13.0
margin_right = 202.0
margin_bottom = 27.0
text = "Screen"
[node name="ScreenCoords" type="Label" parent="Camera2D/UI"]
margin_left = 206.0
margin_top = 13.0
margin_right = 226.0
margin_bottom = 27.0
text = "0,0"
[node name="HexCoordsLabel" type="Label" parent="Camera2D/UI"]
margin_left = 230.0
margin_top = 13.0
margin_right = 255.0
margin_bottom = 27.0
text = "Hex"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HexCoords" type="Label" parent="Camera2D/UI"]
margin_left = 259.0
margin_top = 13.0
margin_right = 279.0
margin_bottom = 27.0
text = "0,0"
[node name="WorldCoordsLabel" type="Label" parent="Camera2D/UI"]
margin_left = 283.0
margin_top = 13.0
margin_right = 321.0
margin_bottom = 27.0
text = "World"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="WorldCoords" type="Label" parent="Camera2D/UI"]
margin_left = 325.0
margin_top = 13.0
margin_right = 345.0
margin_bottom = 27.0
text = "0,0"
__meta__ = {
"_edit_use_anchors_": false
}

250
export_presets.cfg Normal file
View File

@ -0,0 +1,250 @@
[preset.0]
name="Pirate Treasure Hunt"
platform="HTML5"
runnable=true
custom_features=""
export_filter="resources"
export_files=PoolStringArray( )
include_filter="*,*.gd,islands/*,thirdparty/gdhexgrid/*"
exclude_filter=""
export_path="export/html/index.html"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/export_type=0
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/experimental_virtual_keyboard=false
[preset.1]
name="Pirate Treasure Hunt"
platform="Android"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/android/pirate_treasure_hunt.apk"
script_export_mode=1
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
custom_template/use_custom_build=false
custom_template/export_format=0
architectures/armeabi-v7a=true
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
keystore/debug=""
keystore/debug_user=""
keystore/debug_password=""
keystore/release=""
keystore/release_user=""
keystore/release_password=""
one_click_deploy/clear_previous_install=false
version/code=1
version/name="1.0"
package/unique_name="org.godotengine.$genname"
package/name=""
package/signed=true
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/32_bits_framebuffer=true
graphics/opengl_debug=false
xr_features/xr_mode=0
xr_features/degrees_of_freedom=0
xr_features/hand_tracking=0
xr_features/focus_awareness=false
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PoolStringArray( )
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false
[preset.2]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter="thirdparty/gdhexgrid/HexGrid.gd"
exclude_filter=""
export_path="export/linux/PirateTreasureRun.bin.x86_64"
script_export_mode=1
script_encryption_key=""
[preset.2.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true

View File

@ -26,12 +26,14 @@ config/icon="res://icon.png"
[autoload] [autoload]
Globals="*res://Globals.gd"
HexTileDrawer="*res://scenes/HexTileDrawer.gd" HexTileDrawer="*res://scenes/HexTileDrawer.gd"
Globals="*res://Globals.gd"
[global] [global]
view=false view=false
android=false
export=false
[input] [input]