Skip to content

Commit

Permalink
fix some [many] errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Jul 26, 2024
1 parent 0cfc9f3 commit edb49b7
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 291 deletions.
11 changes: 9 additions & 2 deletions game/.godot/editor/project_metadata.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ run_reload_scripts=true

[recent_files]

scenes=["res://src/screens/splah/SplashScreen.tscn"]
scripts=["res://src/screens/splah/SplashScreen.gd"]
scenes=["res://src/actors/ball/base-ball/Ball.tscn", "res://src/ui/level-control/LevelControl.tscn", "res://src/screens/splah/SplashScreen.tscn"]
scripts=["res://src/ui/level-control/LevelControl.gd", "DisplayServer", "res://src/screens/help/Help.gd", "res://src/screens/shop/Shop.gd", "res://src/actors/bin/Bin.gd", "res://src/fade-effect/FadeEffect.gd", "SceneTree", "res://src/levels/base-level/LevelBase.gd", "@GlobalScope", "DirAccess"]

[linked_properties]

Control:scale=true
VBoxContainer:scale=true
RigidBody3D:scale=true
MeshInstance3D:scale=true

[dialog_bounds]

create_new_node=Rect2(508, 163, 900, 700)
9 changes: 3 additions & 6 deletions game/default_env.tres
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[gd_resource type="Environment" format=2]
[gd_resource type="Environment" format=3 uid="uid://wst7jg7rp2uo"]

[resource]
background_mode = 1
background_color = Color( 0.00392157, 0.00392157, 0.0823529, 1 )
ambient_light_color = Color( 0.87451, 0.87451, 0.87451, 1 )
background_color = Color(0.00392157, 0.00392157, 0.0823529, 1)
ambient_light_color = Color(0.87451, 0.87451, 0.87451, 1)
tonemap_white = 16.0
dof_blur_near_distance = 26.87
dof_blur_near_transition = 22.13
dof_blur_near_amount = 1.0
adjustment_enabled = true
adjustment_brightness = 1.24
adjustment_contrast = 0.76
Expand Down
120 changes: 60 additions & 60 deletions game/src/actors/ball/base-ball/Ball.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class_name Ball
signal reset
signal shoot

@onready var geometry_up:GeometryInstance3D = $ImmediateGeometryUp
@onready var geometry_down:GeometryInstance3D = $ImmediateGeometryDown
#@onready var geometry_up: GeometryInstance3D = $ImmediateGeometryUp
#@onready var geometry_down: GeometryInstance3D = $ImmediateGeometryDown

@onready var animation_player:AnimationPlayer = $AnimationPlayer

Expand All @@ -35,18 +35,18 @@ func _ready() -> void:
teletransport_to_inital()


func _process(delta:float) -> void:
if shoot_enabled:
if touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
if touch_start.y > touch_pos.y:
draw_indicator_up()
geometry_down.clear()
else:
draw_indicator_down()
geometry_up.clear()
else:
geometry_up.clear()
geometry_down.clear()
#func _process(delta:float) -> void:
#if shoot_enabled:
#if touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
#if touch_start.y > touch_pos.y:
#draw_indicator_up()
#geometry_down.clear()
#else:
#draw_indicator_down()
#geometry_up.clear()
#else:
#geometry_up.clear()
#geometry_down.clear()


func _input(event:InputEvent) -> void:
Expand All @@ -73,7 +73,7 @@ func _shoot() -> void:
if not shooting and touch_pos != Vector2.ZERO and touch_start != Vector2.ZERO and touch_pos.distance_to(touch_start) > 100:
emit_signal("shoot")
shooting = true
mode = RigidBody3D.MODE_RIGID
#mode = RigidBody3D.MODE_RIGID
var direction = (touch_start - touch_pos)
apply_central_impulse(Vector3(- direction.x, direction.y , 0) * SPEED)

Expand All @@ -94,50 +94,50 @@ func reset_position_no_signal() -> void:
teletransport_to_inital()


func draw_indicator_up() -> void:
if not shooting and touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
geometry_up.clear()
geometry_up.begin(Mesh.PRIMITIVE_TRIANGLES)

# Prepare attributes for add_vertex.
geometry_up.set_normal(Vector3(0, 0, 1))
geometry_up.set_uv(Vector2(0, 0))
# Call last for each vertex, adds the above attributes.
geometry_up.add_vertex(Vector3(-0.8, 0, 0))

geometry_up.set_normal(Vector3(0, -50, 1))
geometry_up.set_uv(Vector2(0, 1))
geometry_up.add_vertex(Vector3(0.8, 0, 0))

geometry_up.set_normal(Vector3(0, 0, 1))
geometry_up.set_uv(Vector2(1, 1))
geometry_up.set_uv(Vector2(1, 1))
geometry_up.add_vertex(Vector3(-(touch_pos.x - touch_start.x)/60, (touch_pos.y - touch_start.y)/60, 0))

geometry_up.end()


func draw_indicator_down():
if not shooting and touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
geometry_down.clear()
geometry_down.begin(Mesh.PRIMITIVE_TRIANGLES)

# Prepare attributes for add_vertex.
geometry_down.set_normal(Vector3(0, 0, 1))
geometry_down.set_uv(Vector2(0, 0))
# Call last for each vertex, adds the above attributes.
geometry_down.add_vertex(Vector3(-0.8, 0, 0))

geometry_down.set_normal(Vector3(0, -50, 1))
geometry_down.set_uv(Vector2(0, 1))
geometry_down.add_vertex(Vector3(0.8, 0, 0))

geometry_down.set_normal(Vector3(0, 0, 1))
geometry_down.set_uv(Vector2(1, 1))
geometry_down.set_uv(Vector2(1, 1))
geometry_down.add_vertex(Vector3((touch_pos.x - touch_start.x)/60, -(touch_pos.y - touch_start.y)/60, 0))

geometry_down.end()
#func draw_indicator_up() -> void:
#if not shooting and touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
#geometry_up.clear()
#geometry_up.begin(Mesh.PRIMITIVE_TRIANGLES)
#
## Prepare attributes for add_vertex.
#geometry_up.set_normal(Vector3(0, 0, 1))
#geometry_up.set_uv(Vector2(0, 0))
## Call last for each vertex, adds the above attributes.
#geometry_up.add_vertex(Vector3(-0.8, 0, 0))
#
#geometry_up.set_normal(Vector3(0, -50, 1))
#geometry_up.set_uv(Vector2(0, 1))
#geometry_up.add_vertex(Vector3(0.8, 0, 0))
#
#geometry_up.set_normal(Vector3(0, 0, 1))
#geometry_up.set_uv(Vector2(1, 1))
#geometry_up.set_uv(Vector2(1, 1))
#geometry_up.add_vertex(Vector3(-(touch_pos.x - touch_start.x)/60, (touch_pos.y - touch_start.y)/60, 0))
#
#geometry_up.end()


#func draw_indicator_down():
#if not shooting and touch_start != Vector2.ZERO and touch_pos != Vector2.ZERO:
#geometry_down.clear()
#geometry_down.begin(Mesh.PRIMITIVE_TRIANGLES)
#
## Prepare attributes for add_vertex.
#geometry_down.set_normal(Vector3(0, 0, 1))
#geometry_down.set_uv(Vector2(0, 0))
## Call last for each vertex, adds the above attributes.
#geometry_down.add_vertex(Vector3(-0.8, 0, 0))
#
#geometry_down.set_normal(Vector3(0, -50, 1))
#geometry_down.set_uv(Vector2(0, 1))
#geometry_down.add_vertex(Vector3(0.8, 0, 0))
#
#geometry_down.set_normal(Vector3(0, 0, 1))
#geometry_down.set_uv(Vector2(1, 1))
#geometry_down.set_uv(Vector2(1, 1))
#geometry_down.add_vertex(Vector3((touch_pos.x - touch_start.x)/60, -(touch_pos.y - touch_start.y)/60, 0))
#
#geometry_down.end()


func teletransport(p_transform:Transform3D) -> void:
Expand All @@ -146,7 +146,7 @@ func teletransport(p_transform:Transform3D) -> void:


func teletransport_to_inital() -> void:
mode = RigidBody3D.FREEZE_MODE_STATIC
#mode = RigidBody3D.FREEZE_MODE_STATIC
transform.origin = initial_position.origin
angular_velocity = Vector3.ZERO
linear_velocity = Vector3.ZERO
Expand Down
81 changes: 48 additions & 33 deletions game/src/actors/ball/base-ball/Ball.tscn
Original file line number Diff line number Diff line change
@@ -1,77 +1,92 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=3 uid="uid://dloudittm0nnr"]

[ext_resource path="res://src/actors/ball/base-ball/Ball.gd" type="Script" id=1]
[ext_resource type="Script" path="res://src/actors/ball/base-ball/Ball.gd" id="1"]

[sub_resource type="StandardMaterial3D" id=3]
albedo_color = Color( 0.94902, 0.0901961, 0.0901961, 1 )
[sub_resource type="StandardMaterial3D" id="3"]
albedo_color = Color(0.94902, 0.0901961, 0.0901961, 1)

[sub_resource type="Animation" id=6]
[sub_resource type="Animation" id="6"]
resource_name = "FadeIn"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.2 ),
"transitions": PackedFloat32Array( 0.277392, 2.14355 ),
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(0.277392, 2.14355),
"update": 0,
"values": [ Vector3( 0.01, 0.01, 0.01 ), Vector3( 1, 1, 1 ) ]
"values": [Vector3(0.01, 0.01, 0.01), Vector3(1, 1, 1)]
}

[sub_resource type="Animation" id=4]
[sub_resource type="Animation" id="4"]
resource_name = "FadeOut"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.2 ),
"transitions": PackedFloat32Array( 1.93187, 0.287174 ),
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1.93187, 0.287174),
"update": 0,
"values": [ Vector3( 1, 1, 1 ), Vector3( 0.01, 0.01, 0.01 ) ]
"values": [Vector3(1, 1, 1), Vector3(0.01, 0.01, 0.01)]
}

[sub_resource type="Animation" id=5]
[sub_resource type="Animation" id="5"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [ Vector3( 1, 1, 1 ) ]
"values": [Vector3(1, 1, 1)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_wf3l6"]
_data = {
"FadeIn": SubResource("6"),
"FadeOut": SubResource("4"),
"RESET": SubResource("5")
}

[node name="Ball" type="RigidBody3D" groups=["ball"]]
collision_layer = 2
collision_mask = 3
axis_lock_linear_z = true
axis_lock_angular_x = true
axis_lock_angular_y = true
mass = 6.28
continuous_cd = true
max_contacts_reported = 10
contact_monitor = true
axis_lock_linear_z = true
axis_lock_angular_x = true
axis_lock_angular_y = true
script = ExtResource( 1 )
script = ExtResource("1")

[node name="ImmediateGeometryUp" type="ImmediateMesh" parent="."]
transform = Transform3D( -1, 3.25841e-07, 0, -3.25841e-07, -1, 0, 0, 0, 1, 0, 0, 0 )
material_override = SubResource( 3 )
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
editor_description = ""
transform = Transform3D(-1, 3.25841e-07, 0, -3.25841e-07, -1, 0, 0, 0, 1, 0, 0, 0)
material_override = SubResource("3")
script = null

[node name="ImmediateGeometryDown" type="ImmediateMesh" parent="."]
material_override = SubResource( 3 )
[node name="ImmediateGeometryDown" type="MeshInstance3D" parent="."]
material_override = SubResource("3")

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/FadeIn = SubResource( 6 )
anims/FadeOut = SubResource( 4 )
anims/RESET = SubResource( 5 )
libraries = {
"": SubResource("AnimationLibrary_wf3l6")
}
12 changes: 7 additions & 5 deletions game/src/actors/bin/Bin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ func _on_BallDetector_body_entered(body) -> void:
func _on_Timer_timeout() -> void:
emit_signal("win")


func fade_in() -> void:
# to match arrow animation
if Global.current_level > 1:
animation_player.play("FadeIn")
await animation_player.animation_finished
animation_player.play("Size")

func hide() -> void:


func hide_bin() -> void:
visible = false
collision_layer = 0
collision_mask = 0
$BallDetector.monitoring = false

func show() -> void:


func show_bin() -> void:
visible = true
collision_layer = 1
collision_mask = 1
Expand Down
9 changes: 5 additions & 4 deletions game/src/fade-effect/FadeEffect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# SPDX-License-Identifier: AGPL-3.0-or-later

extends Tween
extends Node

const DURATON:float = 0.3

Expand Down Expand Up @@ -32,14 +32,15 @@ func _ready() -> void:

func fade_in() -> void:
if node:
var tween: Tween = get_tree().create_tween()
node.modulate = Color(1, 1, 1, 0)
interpolate_property(node, "modulate",
tween.interpolate_property(node, "modulate",
Color(1, 1, 1, 0), Color(1, 1, 1, 1), DURATON,
Tween.TRANS_LINEAR, Tween.EASE_IN)
start()
if node2:
var tween: Tween = get_tree().create_tween()
node2.modulate = Color(1, 1, 1, 0)
interpolate_property(node2, "modulate",
tween.interpolate_property(node2, "modulate",
Color(1, 1, 1, 0), Color(1, 1, 1, 1), DURATON,
Tween.TRANS_LINEAR, Tween.EASE_IN)
start()
Loading

0 comments on commit edb49b7

Please sign in to comment.