colorgame

This commit is contained in:
Spencer Killen 2023-08-20 02:05:40 -06:00
parent e6fbcbc1aa
commit 61b11defb9
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
9 changed files with 130 additions and 8 deletions

BIN
blends/ring.blend Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://3d51hjh2st8a"] [gd_scene load_steps=31 format=3 uid="uid://3d51hjh2st8a"]
[ext_resource type="PackedScene" uid="uid://d2d4uv7o5gx5p" path="res://Level/World/screen_shader.tscn" id="1_huyen"] [ext_resource type="PackedScene" uid="uid://d2d4uv7o5gx5p" path="res://Level/World/screen_shader.tscn" id="1_huyen"]
[ext_resource type="PackedScene" uid="uid://b35w4hlh4n1jt" path="res://Level/World/world_environment.tscn" id="2_lerrn"] [ext_resource type="PackedScene" uid="uid://b35w4hlh4n1jt" path="res://Level/World/world_environment.tscn" id="2_lerrn"]
@ -23,6 +23,7 @@
[ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="24_ddfvk"] [ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="24_ddfvk"]
[ext_resource type="PackedScene" uid="uid://b3aus2kigf8xt" path="res://Models/beach_decor/cooler.tscn" id="24_sl7ne"] [ext_resource type="PackedScene" uid="uid://b3aus2kigf8xt" path="res://Models/beach_decor/cooler.tscn" id="24_sl7ne"]
[ext_resource type="PackedScene" uid="uid://cft26nug7kyqb" path="res://ambient_light_1.tscn" id="25_novxt"] [ext_resource type="PackedScene" uid="uid://cft26nug7kyqb" path="res://ambient_light_1.tscn" id="25_novxt"]
[ext_resource type="PackedScene" uid="uid://ukful430mmkn" path="res://color_cube.tscn" id="25_rm0cr"]
[ext_resource type="PackedScene" uid="uid://bw3k2c75qavce" path="res://Models/beach_decor/bucket.tscn" id="27_f3p1i"] [ext_resource type="PackedScene" uid="uid://bw3k2c75qavce" path="res://Models/beach_decor/bucket.tscn" id="27_f3p1i"]
[ext_resource type="PackedScene" uid="uid://g4gmc0pwlak1" path="res://Models/buildings/fence.tscn" id="28_prydb"] [ext_resource type="PackedScene" uid="uid://g4gmc0pwlak1" path="res://Models/buildings/fence.tscn" id="28_prydb"]
@ -87,10 +88,10 @@ transform = Transform3D(0.0285645, 0, 0, 0, 0.0285645, 0, 0, 0, 0.0285645, 1.585
transform = Transform3D(0.0285645, 0, 0, 0, 0.0285645, 0, 0, 0, 0.0285645, 2.54841, 1.33006, -0.654728) transform = Transform3D(0.0285645, 0, 0, 0, 0.0285645, 0, 0, 0, 0.0285645, 2.54841, 1.33006, -0.654728)
[node name="PalmCurved4" parent="Decorations/nature" instance=ExtResource("3_bth2b")] [node name="PalmCurved4" parent="Decorations/nature" instance=ExtResource("3_bth2b")]
transform = Transform3D(-0.0165298, 0, -0.0022076, 0, 0.0166766, 0, 0.0022076, 0, -0.0165298, -2.92791, 1.29787, -2.21588) transform = Transform3D(-0.0165298, 0, -0.0022076, 0, 0.0166766, 0, 0.0022076, 0, -0.0165298, -2.92791, 1.21961, -2.21588)
[node name="PalmDefault4" parent="Decorations/nature" instance=ExtResource("4_2cnue")] [node name="PalmDefault4" parent="Decorations/nature" instance=ExtResource("4_2cnue")]
transform = Transform3D(-0.0283131, 0, -0.00378129, 0, 0.0285645, 0, 0.00378129, 0, -0.0283131, -2.84367, 1.2416, -1.98999) transform = Transform3D(-0.0283131, 0, -0.00378129, 0, 0.0285645, 0, 0.00378129, 0, -0.0283131, -2.84367, 1.20295, -1.98999)
[node name="PalmDefault3" parent="Decorations/nature" instance=ExtResource("4_2cnue")] [node name="PalmDefault3" parent="Decorations/nature" instance=ExtResource("4_2cnue")]
transform = Transform3D(0.0357832, 0, 0, 0, 0.0357832, 0, 0, 0, 0.0357832, 1.57703, 1.36549, -3.01082) transform = Transform3D(0.0357832, 0, 0, 0, 0.0357832, 0, 0, 0, 0.0357832, 1.57703, 1.36549, -3.01082)
@ -282,6 +283,36 @@ transform = Transform3D(-6.55671e-08, 0, -1.5, 0, 1.5, 0, 1.5, 0, -6.55671e-08,
[node name="fence4" parent="Decorations/slimepen" instance=ExtResource("28_prydb")] [node name="fence4" parent="Decorations/slimepen" instance=ExtResource("28_prydb")]
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 1.40507, -2.10425) transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 1.40507, -2.10425)
[node name="slimepen2" type="Node3D" parent="Decorations"]
transform = Transform3D(0.0237168, 0, -0.999719, 0, 1, 0, 0.999719, 0, 0.0237168, -2.15781, 0.0660278, -1.25464)
[node name="fence" parent="Decorations/slimepen2" instance=ExtResource("28_prydb")]
transform = Transform3D(0.75, 0, 0, 0, 1.8, 0, 0, 0, 1.8, -0.193081, 1.39007, -1.43506)
[node name="fence2" parent="Decorations/slimepen2" instance=ExtResource("28_prydb")]
transform = Transform3D(-6.55671e-08, 0, 1.5, 0, 1.5, 0, -1.5, 0, -6.55671e-08, 0, 1.40507, -1.34639)
[node name="fence3" parent="Decorations/slimepen2" instance=ExtResource("28_prydb")]
transform = Transform3D(-6.55671e-08, 0, -1.5, 0, 1.5, 0, 1.5, 0, -6.55671e-08, 0, 1.40507, -1.34639)
[node name="fence4" parent="Decorations/slimepen2" instance=ExtResource("28_prydb")]
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 1.40507, -2.10425)
[node name="slimepen3" type="Node3D" parent="Decorations"]
transform = Transform3D(0.0237168, 0, -0.999719, 0.326977, 0.945, 0.00775704, 0.944735, -0.327069, 0.0224124, -2.943, -0.05, -3.795)
[node name="fence" parent="Decorations/slimepen3" instance=ExtResource("28_prydb")]
transform = Transform3D(0.75, 0, 0, 0, 1.8, 0, 0, 0, 1.8, -0.193081, 1.39007, -1.43506)
[node name="fence2" parent="Decorations/slimepen3" instance=ExtResource("28_prydb")]
transform = Transform3D(-6.55671e-08, 0, 1.5, 0, 1.5, 0, -1.5, 0, -6.55671e-08, 0, 1.40507, -1.34639)
[node name="fence3" parent="Decorations/slimepen3" instance=ExtResource("28_prydb")]
transform = Transform3D(-6.55671e-08, 0, -1.5, 0, 1.5, 0, 1.5, 0, -6.55671e-08, 0, 1.40507, -1.34639)
[node name="fence4" parent="Decorations/slimepen3" instance=ExtResource("28_prydb")]
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 1.40507, -2.10425)
[node name="Player" parent="." instance=ExtResource("22_cuxj6")] [node name="Player" parent="." instance=ExtResource("22_cuxj6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.192051, 2.60275, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.192051, 2.60275, 0)
@ -318,8 +349,23 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.124053, 2.37507, -4.54257)
[node name="villager6" parent="." instance=ExtResource("24_ddfvk")] [node name="villager6" parent="." instance=ExtResource("24_ddfvk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0673849, 3.01779, -4.0846) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0673849, 3.01779, -4.0846)
[node name="MeshInstance3D" parent="." instance=ExtResource("25_rm0cr")]
transform = Transform3D(0.00734817, 0, -0.0494571, 0, 0.05, 0, 0.0494571, 0, 0.00734817, -1.23595, 2.41994, -1.22155)
[node name="MeshInstance3D5" parent="." instance=ExtResource("25_rm0cr")]
transform = Transform3D(0.00734817, 0, -0.0494571, 0, 0.05, 0, 0.0494571, 0, 0.00734817, -2.01716, 2.35204, -3.86729)
[node name="MeshInstance3D4" parent="." instance=ExtResource("25_rm0cr")]
transform = Transform3D(0.0499974, 0, 0.000513115, 0, 0.05, 0, -0.000513115, 0, 0.0499974, 0.454694, 2.38629, -0.394798)
[node name="MeshInstance3D2" parent="." instance=ExtResource("25_rm0cr")]
transform = Transform3D(0.607958, 0, -0.793969, 0, 1, 0, 0.793969, 0, 0.607958, 9.95052, 2.51, 0.423212)
[node name="MeshInstance3D3" parent="." instance=ExtResource("25_rm0cr")]
transform = Transform3D(1, 0, 0, 0, 0.93516, 0.354226, 0, -0.354226, 0.93516, -1.96412, 2.47836, -3.94085)
[node name="villager7" parent="." instance=ExtResource("24_ddfvk")] [node name="villager7" parent="." instance=ExtResource("24_ddfvk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.33509, 2.39757, -3.94492) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.33509, 2.39757, -4.24071)
[node name="villager8" parent="." instance=ExtResource("24_ddfvk")] [node name="villager8" parent="." instance=ExtResource("24_ddfvk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.31916, 2.22662, -3.08429) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.31916, 2.22662, -3.08429)
@ -352,7 +398,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.89617, 2.21949, -3.20033)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.20015, 2.4323, -3.35734) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.20015, 2.4323, -3.35734)
[node name="villager18" parent="." instance=ExtResource("24_ddfvk")] [node name="villager18" parent="." instance=ExtResource("24_ddfvk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.22409, 2.20857, -4.4881) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.54584, 2.33609, -4.4881)
[node name="villager19" parent="." instance=ExtResource("24_ddfvk")] [node name="villager19" parent="." instance=ExtResource("24_ddfvk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.709331, 2.50856, -1.84133) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.709331, 2.50856, -1.84133)

BIN
godot/Models/ring.glb (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://frderao1bxgg"
path="res://.godot/imported/ring.glb-26ac43d74527a30dcde06236f951335f.scn"
[deps]
source_file="res://Models/ring.glb"
dest_files=["res://.godot/imported/ring.glb-26ac43d74527a30dcde06236f951335f.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

5
godot/Models/ring.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=3 uid="uid://bcq7y48pnfq18"]
[ext_resource type="PackedScene" uid="uid://frderao1bxgg" path="res://Models/ring.glb" id="1_6ph58"]
[node name="ring" instance=ExtResource("1_6ph58")]

View File

@ -2,7 +2,7 @@ extends Node3D
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback") @onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
@export var colors: Array[Color] @export var colors: Array[Color]
@onready var color_idx: int = randi() @onready var color_idx: int = randi() % colors.size()
var mat: Material var mat: Material
func _ready(): func _ready():
@ -16,6 +16,8 @@ func change_color(idx: int):
var color = colors[color_idx] var color = colors[color_idx]
get_tree().create_tween().tween_property(mat, "albedo_color", color, .3) get_tree().create_tween().tween_property(mat, "albedo_color", color, .3)
func get_color():
return colors[color_idx]
func walk(): func walk():
animation_state.travel("Walk") animation_state.travel("Walk")

View File

@ -6,12 +6,14 @@ var color_changes = true
func get_color_idx() -> int: func get_color_idx() -> int:
return $slime.color_idx return $slime.color_idx
func get_color():
return $slime.get_color()
func _on_area_3d_body_entered(body): func _on_area_3d_body_entered(body):
if "color_changes" not in body: if "color_changes" not in body:
return return
var other = body.get_color_idx() var other = body.get_color_idx()
var mine = get_color_idx() var mine = get_color_idx()
print(other, mine)
if other == mine: if other == mine:
return return
var delta = abs(other - mine) var delta = abs(other - mine)

11
godot/color_cube.gd Normal file
View File

@ -0,0 +1,11 @@
extends Node3D
var done = false
func _on_area_3d_body_entered(body):
if done or "color_changes" not in body:
return
done = true
var mat = $ring/Torus.get_active_material(0).duplicate()
mat.albedo_color = body.get_color()
$ring/Torus.set_surface_override_material(0, mat)

21
godot/color_cube.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://ukful430mmkn"]
[ext_resource type="PackedScene" uid="uid://bcq7y48pnfq18" path="res://Models/ring.tscn" id="1_4st4o"]
[ext_resource type="Script" path="res://color_cube.gd" id="1_72txy"]
[sub_resource type="SphereShape3D" id="SphereShape3D_e0lnu"]
radius = 13.5124
[node name="Node3D" type="Node3D"]
script = ExtResource("1_72txy")
[node name="ring" parent="." instance=ExtResource("1_4st4o")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.18403, 2.58068, -1.28894)
[node name="Area3D" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.18403, 2.58068, -1.28894)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("SphereShape3D_e0lnu")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]