Skip to content

Commit

Permalink
init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBocch committed Apr 2, 2024
0 parents commit 84584fa
Show file tree
Hide file tree
Showing 20 changed files with 473 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/
Binary file added Screenshot 2024-04-02 at 15.41.47.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions Screenshot 2024-04-02 at 15.41.47.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://1soi64ipwsqe"
path.s3tc="res://.godot/imported/Screenshot 2024-04-02 at 15.41.47.png-e7dccdff6e367c1fc6632c71bdd8c9f5.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://Screenshot 2024-04-02 at 15.41.47.png"
dest_files=["res://.godot/imported/Screenshot 2024-04-02 at 15.41.47.png-e7dccdff6e367c1fc6632c71bdd8c9f5.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
20 changes: 20 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
trying out godot

todo:
Organizing
- cant just have all the files in root folder
clean up a bit, i dont think its that hard
and dont have to change code much right?

Scoring system
- add area3d to detect when ball goes out of bounds and
on which side, to give points
- display how many points on each side
Menu
- splashscreens all that stuff
- play btn
- exit btn
Pause btn
- resume btn
- exit to menu btn

39 changes: 39 additions & 0 deletions ball.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
extends Area3D
var SPEED = 2.0
var accelerate_x
var accelerate_z
var bounces
# Called when the node enters the scene tree for the first time.
func _ready():
accelerate_x = SPEED
accelerate_z = SPEED *0.8
bounces = 0


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
self.position.x += SPEED * accelerate_x * delta
self.position.z += SPEED * accelerate_z * delta
if bounces % 2 == 0:
SPEED += 0.002

print(SPEED)

# hit right paddle
func _on_right_area_entered(area):
bounces += 1
accelerate_x *= -1

# hit left paddle
func _on_left_area_entered(area):
bounces += 1
accelerate_x *= -1

# ball hit top wall
func _on_top_area_entered(area):
accelerate_z *= -1


func _on_bot_area_entered(area):
accelerate_z *= -1

23 changes: 23 additions & 0 deletions ball.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[gd_scene load_steps=5 format=3 uid="uid://c1aqvar5pvxko"]

[ext_resource type="Texture2D" uid="uid://0a46l6ekvn1s" path="res://texture_08.png" id="1_3nd1n"]

[sub_resource type="BoxMesh" id="BoxMesh_yq14y"]
size = Vector3(0.25, 0.25, 0.25)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_quc86"]
albedo_texture = ExtResource("1_3nd1n")
uv1_triplanar = true
uv2_triplanar = true

[sub_resource type="BoxShape3D" id="BoxShape3D_3isie"]
size = Vector3(0.25, 0.25, 0.25)

[node name="ball" type="Area3D"]

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_yq14y")
surface_material_override/0 = SubResource("StandardMaterial3D_quc86")

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_3isie")
1 change: 1 addition & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions icon.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c42qekg8clv3g"
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
24 changes: 24 additions & 0 deletions leftpaddle.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extends Area3D

const SPEED = 5.0
var direction
# Called when the node enters the scene tree for the first time.
func _ready():
direction = Vector3(self.position.x, self.position.y, self.position.z)
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
#print("move paddle up {str}".format(counter))
# - z plane Vector3
# print(type_string(typeof(self.position)))
if Input.is_action_pressed("right_up"):
self.position.z += (-SPEED) * delta
elif Input.is_action_pressed("right_down"):
self.position.z += (SPEED) * delta

self.position.z = clamp(self.position.z, -1.45, 1.45)


# how do we check if something entered body?
19 changes: 19 additions & 0 deletions paddle.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://daqresh0q8s4n"]

[sub_resource type="BoxShape3D" id="BoxShape3D_fnsvp"]
size = Vector3(0.2, 0.315, 1.4)

[sub_resource type="BoxMesh" id="BoxMesh_cw870"]
size = Vector3(0.2, 0.315, 1.4)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_s3r0x"]
albedo_color = Color(1, 0.196078, 0.0588235, 1)

[node name="paddle" type="Area3D"]

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_fnsvp")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_cw870")
surface_material_override/0 = SubResource("StandardMaterial3D_s3r0x")
111 changes: 111 additions & 0 deletions play.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[gd_scene load_steps=17 format=3 uid="uid://4w524me1s4ot"]

[ext_resource type="PackedScene" uid="uid://daqresh0q8s4n" path="res://paddle.tscn" id="1_5dmrk"]
[ext_resource type="Texture2D" uid="uid://bbdh6vbxld618" path="res://texture_09.png" id="1_f4fjx"]
[ext_resource type="Texture2D" uid="uid://4xe8uim4kybb" path="res://texture_03.png" id="2_686m8"]
[ext_resource type="Script" path="res://leftpaddle.gd" id="2_pay5d"]
[ext_resource type="Script" path="res://rightpaddle.gd" id="3_bxpko"]
[ext_resource type="PackedScene" uid="uid://c1aqvar5pvxko" path="res://ball.tscn" id="4_nj6du"]
[ext_resource type="Script" path="res://ball.gd" id="5_il4f7"]

[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_puux4"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)

[sub_resource type="Sky" id="Sky_o4cfg"]
sky_material = SubResource("ProceduralSkyMaterial_puux4")

[sub_resource type="Environment" id="Environment_mdllj"]
background_mode = 2
sky = SubResource("Sky_o4cfg")
tonemap_mode = 2
glow_enabled = true

[sub_resource type="BoxMesh" id="BoxMesh_act85"]
size = Vector3(7.925, 4.5, 1)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wbenq"]
albedo_texture = ExtResource("1_f4fjx")
uv1_triplanar = true

[sub_resource type="BoxMesh" id="BoxMesh_7mmj7"]
size = Vector3(7.925, 1, 1)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4l8oo"]
albedo_texture = ExtResource("2_686m8")
uv1_triplanar = true
uv2_triplanar = true

[sub_resource type="BoxShape3D" id="BoxShape3D_rwqvs"]
size = Vector3(7.925, 1, 1)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_el26m"]
albedo_texture = ExtResource("2_686m8")
uv1_triplanar = true
uv2_triplanar = true

[node name="play" type="Node3D"]

[node name="env" type="Node3D" parent="."]

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="env"]
transform = Transform3D(-0.866025, -0.433013, 0.25, -0.0315956, 0.546394, 0.836932, -0.499001, 0.716906, -0.486872, 0, 4.28719, -7.04793)
shadow_enabled = true

[node name="WorldEnvironment" type="WorldEnvironment" parent="env"]
environment = SubResource("Environment_mdllj")

[node name="areana" type="Node3D" parent="."]
metadata/_edit_group_ = true

[node name="floor" type="MeshInstance3D" parent="areana"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 2.08165e-12, -0.5, 2.08165e-12)
mesh = SubResource("BoxMesh_act85")
skeleton = NodePath("../../Camera3D")
surface_material_override/0 = SubResource("StandardMaterial3D_wbenq")

[node name="walls" type="Node3D" parent="areana"]

[node name="top" type="Area3D" parent="areana/walls"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.221186, -2.77814)
metadata/_edit_group_ = true

[node name="MeshInstance3D" type="MeshInstance3D" parent="areana/walls/top"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 2.08165e-12, 2.08165e-12)
mesh = SubResource("BoxMesh_7mmj7")
surface_material_override/0 = SubResource("StandardMaterial3D_4l8oo")

[node name="CollisionShape3D" type="CollisionShape3D" parent="areana/walls/top"]
shape = SubResource("BoxShape3D_rwqvs")

[node name="bot" type="Area3D" parent="areana/walls"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.221186, 2.7361)
metadata/_edit_group_ = true

[node name="MeshInstance3D" type="MeshInstance3D" parent="areana/walls/bot"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08165e-12, 0, 0)
mesh = SubResource("BoxMesh_7mmj7")
surface_material_override/0 = SubResource("StandardMaterial3D_el26m")

[node name="CollisionShape3D" type="CollisionShape3D" parent="areana/walls/bot"]
shape = SubResource("BoxShape3D_rwqvs")

[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.520339, 0.85396, 0, -0.85396, 0.520339, 0, 4.0743, 2.49699)

[node name="left" parent="." instance=ExtResource("1_5dmrk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.54, 0.298, 2.08165e-12)
script = ExtResource("2_pay5d")

[node name="right" parent="." instance=ExtResource("1_5dmrk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.598, 0.298, 2.08165e-12)
script = ExtResource("3_bxpko")

[node name="ball" parent="." instance=ExtResource("4_nj6du")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0229974, 0.218147, 0)
script = ExtResource("5_il4f7")

[connection signal="area_entered" from="areana/walls/top" to="ball" method="_on_top_area_entered"]
[connection signal="area_entered" from="areana/walls/bot" to="ball" method="_on_bot_area_entered"]
[connection signal="area_entered" from="left" to="ball" method="_on_left_area_entered"]
[connection signal="area_entered" from="right" to="ball" method="_on_right_area_entered"]
32 changes: 32 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
; 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="3dpong"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg"

[dotnet]

project/assembly_name="3dpong"

[input]

right_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
right_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
22 changes: 22 additions & 0 deletions rightpaddle.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends Area3D

const SPEED = 5.0
var direction
# Called when the node enters the scene tree for the first time.
func _ready():
direction = Vector3(self.position.x, self.position.y, self.position.z)
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
#print("move paddle up {str}".format(counter))
# - z plane Vector3
# print(type_string(typeof(self.position)))
if Input.is_action_pressed("ui_up"):
self.position.z += (self.position.z - SPEED) * delta
elif Input.is_action_pressed("ui_down"):
self.position.z += (self.position.z + SPEED) * delta

self.position.z = clamp(self.position.z, -1.45, 1.45)
# how do we check if something entered body?
Binary file added texture_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 84584fa

Please sign in to comment.