Skip to content

Commit

Permalink
Submitting compo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimau committed Oct 2, 2022
1 parent ac3ff71 commit 5e6abac
Show file tree
Hide file tree
Showing 27 changed files with 285 additions and 135,240 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Godot 4+ specific ignores
.godot/
builds
7 changes: 4 additions & 3 deletions Bell.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extends Area3D

var lightOn : bool = false
var dealGood : bool = false
@export var colorGood : Color
@export var colorBad : Color
signal ring
Expand All @@ -16,8 +15,10 @@ func _process(_delta):
var bl : OmniLight3D = $BellLight
if bl == null:
return
$PressMe.visible = dealGood
if dealGood:

var dg = get_parent().dealGood
$PressMe.visible = dg
if dg:
bl.light_color = colorGood
else:
bl.light_color = colorBad
Expand Down
19 changes: 12 additions & 7 deletions CounterTop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ func _ready():
}
custReq = [{},{},{},{}]
inSlot = {0:null, 1:null, 2:null, 3:null}
newDeal()


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
Expand Down Expand Up @@ -71,8 +69,9 @@ func grabbed(piece : RigidBody3D):
if inSlot[k][0] != piece:
continue
inSlot[k] = null
if piece.get_meta("CounterTop") == -100:
body_enter_trigger(piece)
if piece.has_meta("CounterTop"):
if piece.get_meta("CounterTop") == -100:
body_enter_trigger(piece)
evalDeal()

func slotMe(piece : RigidBody3D):
Expand Down Expand Up @@ -104,8 +103,10 @@ func _on_bell_ring():
dealGood = false

func newDeal():
dealGood = false
var numSlots : int = randi_range(2,4)
for k in node_slots:
custReq[k] = {}
node_slots[k][0].visible = false
if numSlots <= 0:
continue
Expand Down Expand Up @@ -140,7 +141,6 @@ func newDeal():

func evalDeal():
dealGood = _subEvalDeal()
$Bell.dealGood = dealGood

func _subEvalDeal():
var gd = true
Expand All @@ -151,6 +151,7 @@ func _subEvalDeal():

if inSlot[k] == null:
node_slots[k][2] = false
print(str(k, " : empty"))
gd = false
continue

Expand All @@ -159,6 +160,7 @@ func _subEvalDeal():
var a = p[0].data[t]
var b = custReq[k][t]
if a != b:
print(str(k, " : ", t, " [", a, "!=", b))
node_slots[k][2] = false
gd = false
return gd
Expand All @@ -178,5 +180,8 @@ func body_exit_trigger(body : Node3D):
body.set_meta("CounterTop", -1)
pass

func _on_animation_player_animation_finished(_anim_name):
newDeal()
func _on_animation_player_animation_finished(anim_name):
if anim_name == "good_deal":
newDeal()
if anim_name == "bad_deal":
newDeal()
45 changes: 43 additions & 2 deletions Game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ var grabTarget : Vector3
var grabRot : Vector3
var timeSinceCustomer : float = intervalCustomer
var timeSinceJunk : float = -1
var gameRunning = false
var count_good : int = 0
var count_bad : int = 0

@export var floor_plane : Plane
@export var wall_plane : Plane

Expand All @@ -14,20 +18,39 @@ const junkMin : int = 1
const junkMax : int = 4
const intervalJunkMin : float = 4.0
const intervalJunkMax : float = 6.0
const intervalCustomer : float = 10.0
const intervalCustomer : float = 10.5

func _init():
Engine.set_meta("NumCols", 4)
Engine.set_meta("NumShapes", 4)
Engine.set_meta("LastTouched", null)

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

func startGame():
count_good = 0
count_bad = 0
gameRunning = true
$JunkSrc.clearJunk()
$CounterTop.newDeal()
$JunkSrc.dumpJunk(junkStart)
timeSinceJunk = randf_range(intervalJunkMin, intervalJunkMax)
pass # Replace with function body.
timeSinceCustomer = intervalCustomer

func end_game():
$CanvasLayer/CustTimer.visible = false
gameRunning = false
$CounterTop/AnimationPlayer.play("end_game")

var scoreMesh = load("res://score_mesh.tres")
scoreMesh.text = str("Score: ", count_good)

func _process(dt):
if not gameRunning:
return

timeSinceJunk -= dt
if timeSinceJunk < 0:
$JunkSrc.dumpJunk(randi_range(junkMin, junkMax))
Expand Down Expand Up @@ -98,6 +121,9 @@ func dragGrabbed(event : InputEventMouseMotion):
return

func _input(event):
if not gameRunning:
return

if event.is_action_pressed("grabJunk"):
grabbed = Engine.get_meta("LastTouched", null)
if grabbed != null:
Expand All @@ -120,3 +146,18 @@ func _input(event):

if event is InputEventMouseMotion:
dragGrabbed(event)


func _on_sign_new_game():
$CounterTop/AnimationPlayer.play("start_game")


func _on_animation_player_animation_finished(anim_name):
if anim_name == "start_game":
startGame()
if anim_name == "good_deal":
count_good += 1
if anim_name == "bad_deal":
count_bad += 1
if (count_bad) >= 3:
end_game()
4 changes: 4 additions & 0 deletions JunkSrc.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func _process(dt):
lastDump = intervalJunkSpawn
pass

func clearJunk():
for p in get_children():
p.queue_free()

func dumpJunk(numJunk : int):
junkQ += numJunk

Expand Down
14 changes: 11 additions & 3 deletions Shop.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[gd_scene load_steps=23 format=3 uid="uid://fx7l8thkrt2l"]
[gd_scene load_steps=24 format=3 uid="uid://fx7l8thkrt2l"]

[ext_resource type="PackedScene" uid="uid://7bngxakpbh8b" path="res://models/env/shop.glb" id="1_r0cv2"]
[ext_resource type="Material" uid="uid://dwjqjd82rd21r" path="res://mat_black.tres" id="2_obk4e"]
[ext_resource type="PhysicsMaterial" uid="uid://deh4kegjhuupp" path="res://phys_rough.tres" id="3_0iact"]
[ext_resource type="PhysicsMaterial" uid="uid://dsiibkmqcknua" path="res://phys_slip.tres" id="4_s4ia5"]

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vwr2n"]
albedo_color = Color(0.670588, 0.635294, 0.960784, 1)

[sub_resource type="BoxShape3D" id="BoxShape3D_owgya"]
size = Vector3(2.93756, 3.28052, 0.174858)

Expand Down Expand Up @@ -72,7 +75,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
rotation_edit_mode = 0
rotation_order = 2
top_level = false
visible = false
visible = true
visibility_parent = NodePath("")
layers = 1
material_override = ExtResource("2_obk4e")
Expand Down Expand Up @@ -101,7 +104,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.65843, -1.52902, 1.67325)
material_override = ExtResource("2_obk4e")
size = Vector3(1, 14.6921, 10.3929)

[node name="CsgBox3d3" type="CSGBox3D" parent="BlackBack" index="2"]
[node name="CsgBox3d4" type="CSGBox3D" parent="BlackBack" index="2"]
transform = Transform3D(-0.0935175, 0, 0.995618, 0, 1, 0, -0.995618, 0, -0.0935175, 2.68552, -1.52902, -8.75893)
material_override = SubResource("StandardMaterial3D_vwr2n")
size = Vector3(1, 14.6921, 20.8938)

[node name="CsgBox3d3" type="CSGBox3D" parent="BlackBack" index="3"]
transform = Transform3D(-0.0219196, -0.99976, 0, 0.99976, -0.0219196, 0, 0, 0, 1, 0.135052, -5.22865, 1.6809)
material_override = ExtResource("2_obk4e")
size = Vector3(1, 14.6921, 10.3929)
Expand Down
86 changes: 86 additions & 0 deletions export_presets.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[preset.0]

name="Windows Desktop"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="builds/win/junk_seller.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=1
script_encryption_key=""

[preset.0.options]

custom_template/debug=""
custom_template/release=""
debug/export_console_script=1
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
binary_format/architecture="x86_64"
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/file_version=""
application/product_version=""
application/company_name="Flammable Penguins"
application/product_name="Junk Seller"
application/file_description=""
application/copyright=""
application/trademarks=""

[preset.1]

name="Web"
platform="Web"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="builds/web/junk_seller.html"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=1
script_encryption_key=""

[preset.1.options]

custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)
1 change: 1 addition & 0 deletions mat_piece.tres
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://clx4pxn8qj170"]

[resource]
albedo_color = Color(0, 0, 0, 1)
metallic = 0.12
metallic_specular = 0.77
roughness = 0.69
Expand Down
8 changes: 0 additions & 8 deletions models/env/box.mtl

This file was deleted.

Loading

0 comments on commit 5e6abac

Please sign in to comment.