Initial commit
commit
5165a2cd4f
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
|
@ -0,0 +1,2 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dtmrjfwcpic02"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_yhejd"]
|
||||
size = Vector3(0.1, 1, 0.5)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hfwv0"]
|
||||
albedo_color = Color(0.995333, 0.86, 1, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_phfbb"]
|
||||
material = SubResource( "StandardMaterial3D_hfwv0" )
|
||||
size = Vector3(0.1, 1, 0.5)
|
||||
|
||||
[node name="Domino" type="RigidDynamicBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource( "BoxShape3D_yhejd" )
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource( "BoxMesh_phfbb" )
|
|
@ -0,0 +1,58 @@
|
|||
extends Node3D
|
||||
|
||||
@export_node_path(Camera3D) var camera_path
|
||||
|
||||
var domino: PackedScene
|
||||
var ghost_domino: Node3D
|
||||
var camera: Camera3D
|
||||
|
||||
var tool_active: bool = true
|
||||
|
||||
func _ready():
|
||||
domino = preload("res://Domino.tscn")
|
||||
ghost_domino = preload("res://GhostDomino.tscn").instantiate()
|
||||
camera = get_node(camera_path)
|
||||
|
||||
func _is_active():
|
||||
return tool_active and !Input.is_action_pressed("cam_adjust")
|
||||
|
||||
func _physics_process(delta):
|
||||
if ghost_domino.get_parent():
|
||||
remove_child(ghost_domino)
|
||||
|
||||
if not _is_active():
|
||||
return
|
||||
|
||||
var space_state = get_world_3d().direct_space_state
|
||||
if space_state == null:
|
||||
return
|
||||
|
||||
var mouse_position = get_viewport().get_mouse_position()
|
||||
var mouse_3d_origin = camera.project_ray_origin(mouse_position)
|
||||
var mouse_3d_normal = camera.project_ray_normal(mouse_position)
|
||||
|
||||
var query = PhysicsRayQueryParameters3D.new()
|
||||
query.from = camera.position
|
||||
query.to = mouse_3d_origin + mouse_3d_normal * 64
|
||||
|
||||
var raytrace_results = space_state.intersect_ray(query)
|
||||
if raytrace_results.has("position"):
|
||||
ghost_domino.position = raytrace_results.position + Vector3.UP * 0.5
|
||||
if not ghost_domino.get_parent():
|
||||
add_child(ghost_domino)
|
||||
|
||||
func _input(event):
|
||||
if not _is_active():
|
||||
return
|
||||
|
||||
if event.is_action_pressed("use_tool") and ghost_domino.get_parent():
|
||||
var new_domino: RigidDynamicBody3D = domino.instantiate()
|
||||
new_domino.transform = ghost_domino.transform
|
||||
add_child(new_domino)
|
||||
|
||||
if event.is_action_pressed("domino_rotate_clockwise"):
|
||||
ghost_domino.rotate_y(-PI / 12)
|
||||
|
||||
if event.is_action_pressed("domino_rotate_anticlockwise"):
|
||||
ghost_domino.rotate_y(PI / 12)
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://7hnd63s62flm"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lep5x"]
|
||||
transparency = 1
|
||||
diffuse_mode = 3
|
||||
albedo_color = Color(1, 0.690196, 0.956863, 0.133333)
|
||||
emission_enabled = true
|
||||
emission = Color(0.486275, 0.0823529, 0.478431, 1)
|
||||
emission_energy = 3.0
|
||||
rim = 0.23
|
||||
backlight = Color(0.282353, 0.282353, 0.282353, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_n8mck"]
|
||||
material = SubResource( "StandardMaterial3D_lep5x" )
|
||||
size = Vector3(0.1, 1, 0.5)
|
||||
|
||||
[node name="GhostDomino" type="MeshInstance3D"]
|
||||
mesh = SubResource( "BoxMesh_n8mck" )
|
|
@ -0,0 +1,63 @@
|
|||
extends Node3D
|
||||
|
||||
var camera: Camera3D
|
||||
var focal_point: Node3D
|
||||
|
||||
var is_dragging_position = false
|
||||
var is_dragging_rotation = false
|
||||
|
||||
var camera_distance: float = 5
|
||||
|
||||
func _ready():
|
||||
camera = self.get_node("Camera")
|
||||
focal_point = self.get_node("FocalPoint")
|
||||
Input.set_use_accumulated_input(false)
|
||||
|
||||
func _process(delta):
|
||||
var adjusting = Input.is_action_pressed("cam_adjust")
|
||||
if Input.is_action_pressed("cam_pan_mod"):
|
||||
is_dragging_position = adjusting
|
||||
is_dragging_rotation = false
|
||||
else:
|
||||
is_dragging_position = false
|
||||
is_dragging_rotation = adjusting
|
||||
|
||||
if is_dragging_position or is_dragging_rotation:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
|
||||
else:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
camera.transform = focal_point.transform.translated(Vector3(0, 0, camera_distance))
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
self.mouse_move(event)
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
self.mouse_button(event)
|
||||
|
||||
func mouse_button(event: InputEventMouseButton):
|
||||
if Input.is_action_pressed("cam_adjust"):
|
||||
if event.pressed:
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
camera_distance += 1
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
camera_distance -= 1
|
||||
|
||||
if camera_distance < 1:
|
||||
camera_distance = 1
|
||||
|
||||
func mouse_move(event: InputEventMouseMotion):
|
||||
var mouse_delta: Vector2 = event.relative
|
||||
|
||||
if is_dragging_position:
|
||||
var relative_movement = camera.quaternion * Vector3(-mouse_delta.x, mouse_delta.y, 0) * 0.005
|
||||
focal_point.position += relative_movement
|
||||
|
||||
if is_dragging_rotation:
|
||||
focal_point.rotation.x += deg2rad(-mouse_delta.y * 0.022 * 6)
|
||||
focal_point.rotation.y += deg2rad(-mouse_delta.x * 0.022 * 6)
|
||||
if focal_point.rotation.x > PI / 2:
|
||||
focal_point.rotation.x = PI / 2
|
||||
if focal_point.rotation.x < -PI/ 2:
|
||||
focal_point.rotation.x = -PI / 2
|
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://flcpuu588jgj"
|
||||
path.s3tc="res://.godot/imported/dev_192_gr_064x.jpg-8082bd40a3b3bf03643fce6e503f9751.s3tc.ctex"
|
||||
path.etc2="res://.godot/imported/dev_192_gr_064x.jpg-8082bd40a3b3bf03643fce6e503f9751.etc2.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc", "etc2"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://dev_192_gr_064x.jpg"
|
||||
dest_files=["res://.godot/imported/dev_192_gr_064x.jpg-8082bd40a3b3bf03643fce6e503f9751.s3tc.ctex", "res://.godot/imported/dev_192_gr_064x.jpg-8082bd40a3b3bf03643fce6e503f9751.etc2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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/size_limit=0
|
||||
detect_3d/compress_to=0
|
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://2pr3v3m3huh"
|
||||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
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/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -0,0 +1,65 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://i2gm7xhh3074"]
|
||||
|
||||
[ext_resource type="Script" path="res://OrbitingCamera.gd" id="1_1qrpa"]
|
||||
[ext_resource type="Texture2D" uid="uid://flcpuu588jgj" path="res://dev_192_gr_064x.jpg" id="2_kx7d0"]
|
||||
[ext_resource type="Script" path="res://DominoPlacer.gd" id="3_c1o8g"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_4hp7m"]
|
||||
sky_top_color = Color(0.64, 0.79, 1, 1)
|
||||
sky_horizon_color = Color(0.6804, 0.77544, 0.81, 1)
|
||||
ground_bottom_color = Color(0.27, 0.2565, 0.27, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_wsgs3"]
|
||||
sky_material = SubResource( "ProceduralSkyMaterial_4hp7m" )
|
||||
|
||||
[sub_resource type="Environment" id="Environment_2wash"]
|
||||
background_mode = 2
|
||||
sky = SubResource( "Sky_wsgs3" )
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_glyqs"]
|
||||
|
||||
[sub_resource type="ORMMaterial3D" id="ORMMaterial3D_3wfud"]
|
||||
albedo_texture = ExtResource( "2_kx7d0" )
|
||||
uv1_scale = Vector3(400, 400, 1)
|
||||
texture_filter = 5
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_3xg8w"]
|
||||
material = SubResource( "ORMMaterial3D_3wfud" )
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_curec"]
|
||||
|
||||
[node name="Main" type="Node3D"]
|
||||
|
||||
[node name="OrbitingCamera" type="Node3D" parent="."]
|
||||
script = ExtResource( "1_1qrpa" )
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="OrbitingCamera"]
|
||||
|
||||
[node name="FocalPoint" type="Node3D" parent="OrbitingCamera"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.985488, -0.169745, 0, 0.169745, 0.985488, 0, 1, 0)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource( "Environment_2wash" )
|
||||
|
||||
[node name="Sun" type="DirectionalLight3D" parent="WorldEnvironment"]
|
||||
transform = Transform3D(0.341298, 0.867189, -0.362628, 0, 0.385793, 0.922585, 0.939955, -0.314877, 0.131671, 0, 9.76009, 0)
|
||||
light_color = Color(1, 0.901, 0.78, 1)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Floor" type="Node3D" parent="."]
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="Floor"]
|
||||
physics_material_override = SubResource( "PhysicsMaterial_glyqs" )
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/StaticBody3D"]
|
||||
transform = Transform3D(200, 0, 0, 0, 1, 0, 0, 0, 200, -0.00279409, 0, 0.000888824)
|
||||
mesh = SubResource( "PlaneMesh_3xg8w" )
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D"]
|
||||
transform = Transform3D(200, 0, 0, 0, 1, 0, 0, 0, 200, 0, -0.5, 0)
|
||||
shape = SubResource( "BoxShape3D_curec" )
|
||||
|
||||
[node name="DominoPlacer" type="Node3D" parent="."]
|
||||
script = ExtResource( "3_c1o8g" )
|
||||
camera_path = NodePath("../OrbitingCamera/Camera")
|
|
@ -0,0 +1,59 @@
|
|||
; 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="cute domino game :3"
|
||||
run/main_scene="res://main.tscn"
|
||||
boot_splash/show_image=false
|
||||
config/icon="res://icon.png"
|
||||
config/features=PackedStringArray("4.0", "Vulkan Clustered")
|
||||
|
||||
[editor]
|
||||
|
||||
node_naming/name_num_separator=2
|
||||
|
||||
[input]
|
||||
|
||||
cam_adjust={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
cam_pan_mod={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777237,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
use_tool={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
domino_rotate_clockwise={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
domino_rotate_anticlockwise={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
3d/run_on_separate_thread=true
|
||||
common/physics_ticks_per_second=120
|
||||
common/physics_jitter_fix=1.0
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/default_filters/anisotropic_filtering_level=4
|
Loading…
Reference in New Issue