This commit is contained in:
Felipe M. 2023-10-04 13:41:59 +02:00
commit 2f2d8d33c9
Signed by: fmartingr
GPG Key ID: CCFBC5637D4000A8
25 changed files with 461 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
.DS_Store

27
elements/disk.gd Normal file
View File

@ -0,0 +1,27 @@
extends Node3D
var size: int = 1
var DiskShape = preload("res://elements/disk.tscn")
const radius_multiplier: float = 0.08
const base_size: float = 0.2
func _init(disk_size: int):
size = disk_size
var shape = DiskShape.instantiate()
shape.get_node("shape").set_radius(base_size + (radius_multiplier*disk_size))
add_child(shape)
func get_size() -> int:
return size
func can_put_on_top(disk_size: int) -> bool:
return disk_size < size
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

20
elements/disk.tscn Normal file
View File

@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://bs577fxvbvuva"]
[ext_resource type="Texture2D" uid="uid://dcgeev7872167" path="res://textures/Stone Texture 4.jpg" id="1_eekfu"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_y6ljk"]
albedo_texture = ExtResource("1_eekfu")
[node name="disk" type="Node3D"]
metadata/size = 7
[node name="shape" type="CSGCylinder3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.05, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
material_override = SubResource("StandardMaterial3D_y6ljk")
sides = 24
[node name="hole" type="CSGCylinder3D" parent="shape"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
operation = 2
radius = 0.1
sides = 24

34
elements/game board.gd Normal file
View File

@ -0,0 +1,34 @@
extends Node3D
var Disk = preload("res://elements/disk.gd")
var disks = Dictionary()
func v2_to_v3(vector:Vector2)->Vector3:
return Vector3.FORWARD.rotated(Vector3.UP, Vector2(vector.x, -vector.y).angle())
func _init_disks(number: int):
for n in range(1, number+1):
disks[n] = Disk.new(n)
for disk_size in disks:
var disk = disks[disk_size]
if disk != null:
disk.set_position(disk.get_position() + Vector3(0, 0.2, 0))
add_child(disk)
# Called when the node enters the scene tree for the first time.
func _ready():
_init_disks(1)
var was_pressing_button: bool = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
was_pressing_button = true
var mouse_pos = get_viewport().get_mouse_position()
var camera = get_node("../Camera")
var new_pos = camera.project_position(mouse_pos, camera.position.z)
disks[1].set_position(new_pos)

40
elements/game board.tscn Normal file
View File

@ -0,0 +1,40 @@
[gd_scene load_steps=7 format=3 uid="uid://dlhvv8pl2cpxr"]
[ext_resource type="Script" path="res://elements/game board.gd" id="1_4lf6t"]
[ext_resource type="Texture2D" uid="uid://coq374a4vgh7x" path="res://textures/wood1.jpg" id="1_8hp8a"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gpic3"]
albedo_texture = ExtResource("1_8hp8a")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_udkd6"]
albedo_texture = ExtResource("1_8hp8a")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ota7e"]
albedo_texture = ExtResource("1_8hp8a")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hpve8"]
albedo_texture = ExtResource("1_8hp8a")
[node name="game board" type="Node3D"]
script = ExtResource("1_4lf6t")
metadata/disks_number = 7
[node name="base" type="CSGBox3D" parent="."]
transform = Transform3D(5, 0, 0, 0, 0.1, 0, 0, 0, 1, 0, 0, 0)
material_override = SubResource("StandardMaterial3D_gpic3")
[node name="cylinders" type="Node" parent="."]
[node name="left" type="CSGCylinder3D" parent="cylinders"]
transform = Transform3D(0.1, 0, 0, 0, 1, 0, 0, 0, 0.1, -1.8, 1, 2.08165e-12)
material_override = SubResource("StandardMaterial3D_udkd6")
[node name="middle" type="CSGCylinder3D" parent="cylinders"]
transform = Transform3D(0.1, 0, 0, 0, 1, 0, 0, 0, 0.1, 2.08165e-12, 1, 2.08165e-12)
material_override = SubResource("StandardMaterial3D_ota7e")
[node name="right" type="CSGCylinder3D" parent="cylinders"]
transform = Transform3D(0.1, 0, 0, 0, 1, 0, 0, 0, 0.1, 1.8, 1, 2.08165e-12)
material_override = SubResource("StandardMaterial3D_hpve8")
[node name="disks" type="Node" parent="."]

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><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 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2xd23l8f0jnx"
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

20
project.godot Normal file
View File

@ -0,0 +1,20 @@
; 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="godot-hanoi"
run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.1", "Mobile")
config/icon="res://icon.svg"
[rendering]
renderer/rendering_method="mobile"

11
scenes/game.gd Normal file
View File

@ -0,0 +1,11 @@
extends Node
# 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

21
scenes/game.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=3 format=3 uid="uid://dp783hpcki0qp"]
[ext_resource type="Script" path="res://scenes/game.gd" id="1_bf6na"]
[ext_resource type="PackedScene" uid="uid://dlhvv8pl2cpxr" path="res://elements/game board.tscn" id="1_hvkf0"]
[node name="Game Scene" type="Node"]
script = ExtResource("1_bf6na")
[node name="Camera" type="Camera3D" parent="."]
transform = Transform3D(1, -5.2318e-16, 3.02058e-16, 3.02058e-16, 0.866025, 0.5, -5.2318e-16, -0.5, 0.866025, 2.08165e-12, 2.43062, 2.17001)
fov = 79.0305
[node name="game board" parent="." instance=ExtResource("1_hvkf0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
[node name="Sun" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.71128, 1.43292, -3.01803)
omni_range = 4.61418
[node name="Lamp" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.938962, 0.34402, 0, -0.34402, 0.938962, -0.140397, 2.30478, 4.06853)

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbjx5x4721tis"
path.s3tc="res://.godot/imported/Stone Texture 1.jpg-55410c3852d24662faa86bfa29665190.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/Stone Texture 1.jpg"
dest_files=["res://.godot/imported/Stone Texture 1.jpg-55410c3852d24662faa86bfa29665190.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bs2bgbao4pd4k"
path.s3tc="res://.godot/imported/Stone Texture 2.jpg-8e62ff83ae5f153b3086e87ea96dcdc9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/Stone Texture 2.jpg"
dest_files=["res://.godot/imported/Stone Texture 2.jpg-8e62ff83ae5f153b3086e87ea96dcdc9.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://mttywqo218qg"
path.s3tc="res://.godot/imported/Stone Texture 3.jpg-fd6bed01b8ecf1c07b3e3735d377935d.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/Stone Texture 3.jpg"
dest_files=["res://.godot/imported/Stone Texture 3.jpg-fd6bed01b8ecf1c07b3e3735d377935d.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dcgeev7872167"
path.s3tc="res://.godot/imported/Stone Texture 4.jpg-ba73b618076b21f1987fb4f68bd8f5e9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/Stone Texture 4.jpg"
dest_files=["res://.godot/imported/Stone Texture 4.jpg-ba73b618076b21f1987fb4f68bd8f5e9.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dv2jygjq2cgwb"
path.s3tc="res://.godot/imported/Stone Texture 5.jpg-9683af8840e7567d7f013c34e51af9b6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/Stone Texture 5.jpg"
dest_files=["res://.godot/imported/Stone Texture 5.jpg-9683af8840e7567d7f013c34e51af9b6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

BIN
textures/wood1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

35
textures/wood1.jpg.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://coq374a4vgh7x"
path.s3tc="res://.godot/imported/wood1.jpg-7474f75ae91f1b0154e8699395ca3e39.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/wood1.jpg"
dest_files=["res://.godot/imported/wood1.jpg-7474f75ae91f1b0154e8699395ca3e39.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0

BIN
textures/wood2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

35
textures/wood2.jpg.import Normal file
View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://coqtn2vr1nwl4"
path.s3tc="res://.godot/imported/wood2.jpg-41426b016c41a7fe80b7df1d7392cbb6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/wood2.jpg"
dest_files=["res://.godot/imported/wood2.jpg-41426b016c41a7fe80b7df1d7392cbb6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0