commit a67377318385cb5e9fe9a302d269eeec3402436b Author: rain caliber <66094781+s-downpour@users.noreply.github.com> Date: Mon Feb 3 00:08:50 2025 -0600 first commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/assets/ball.png b/assets/ball.png new file mode 100644 index 0000000..1791beb Binary files /dev/null and b/assets/ball.png differ diff --git a/assets/ball.png.import b/assets/ball.png.import new file mode 100644 index 0000000..1797cc9 --- /dev/null +++ b/assets/ball.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://mucscwsbmfoq" +path="res://.godot/imported/ball.png-ca93c4f2e7b7f8325cbd933673092ff4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ball.png" +dest_files=["res://.godot/imported/ball.png-ca93c4f2e7b7f8325cbd933673092ff4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +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/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/bumper.png b/assets/bumper.png new file mode 100644 index 0000000..186089c Binary files /dev/null and b/assets/bumper.png differ diff --git a/assets/bumper.png.import b/assets/bumper.png.import new file mode 100644 index 0000000..6df8830 --- /dev/null +++ b/assets/bumper.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bjkqwg7x8boun" +path="res://.godot/imported/bumper.png-47785785aa6eb7e7a0af4baae66981c0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/bumper.png" +dest_files=["res://.godot/imported/bumper.png-47785785aa6eb7e7a0af4baae66981c0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +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/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/flipper.png b/assets/flipper.png new file mode 100644 index 0000000..c530985 Binary files /dev/null and b/assets/flipper.png differ diff --git a/assets/flipper.png.import b/assets/flipper.png.import new file mode 100644 index 0000000..5141f3b --- /dev/null +++ b/assets/flipper.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1r22t327pigo" +path="res://.godot/imported/flipper.png-2cdce6cc85fc06ace0566b75e4769636.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/flipper.png" +dest_files=["res://.godot/imported/flipper.png-2cdce6cc85fc06ace0566b75e4769636.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +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/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..0193e3c --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8mo17gcly66y" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +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/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..2295a6e --- /dev/null +++ b/main.tscn @@ -0,0 +1,18 @@ +[gd_scene format=3 uid="uid://bgc35bo4ej4l1"] + +[node name="main" type="Node2D"] + +[node name="SubViewport" type="SubViewport" parent="."] +size = Vector2i(1080, 1920) + +[node name="SafeArea" type="Control" parent="SubViewport"] +layout_mode = 3 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_right = 900.0 +offset_bottom = 1600.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/pinball/ball.gd b/pinball/ball.gd new file mode 100644 index 0000000..21e6bbe --- /dev/null +++ b/pinball/ball.gd @@ -0,0 +1,9 @@ +extends RigidBody2D + +func _ready() -> void: + mass = 1.0 + gravity_scale = 1.0 + physics_material_override.bounce = 0.8 + linear_damp = 0.1 + contact_monitor = true + max_contacts_reported = 4 \ No newline at end of file diff --git a/pinball/ball.gd.uid b/pinball/ball.gd.uid new file mode 100644 index 0000000..e1d5c6d --- /dev/null +++ b/pinball/ball.gd.uid @@ -0,0 +1 @@ +uid://by01oc4lqlma4 diff --git a/pinball/ball.tscn b/pinball/ball.tscn new file mode 100644 index 0000000..5b92d1f --- /dev/null +++ b/pinball/ball.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=5 format=3 uid="uid://bri6gyx0bp87t"] + +[ext_resource type="Texture2D" uid="uid://mucscwsbmfoq" path="res://assets/ball.png" id="1_qbdsi"] +[ext_resource type="Script" uid="uid://by01oc4lqlma4" path="res://pinball/ball.gd" id="1_qu1p4"] + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_s64ax"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_o681m"] +radius = 4.0 + +[node name="Ball" type="RigidBody2D"] +physics_material_override = SubResource("PhysicsMaterial_s64ax") +script = ExtResource("1_qu1p4") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_o681m") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_qbdsi") diff --git a/pinball/bumper.tscn b/pinball/bumper.tscn new file mode 100644 index 0000000..ffe81e5 --- /dev/null +++ b/pinball/bumper.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://b4mlc72u3danp"] + +[ext_resource type="Texture2D" uid="uid://bjkqwg7x8boun" path="res://assets/bumper.png" id="1_gph4f"] + +[node name="Bumper" type="Node2D"] + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_gph4f") diff --git a/pinball/flipper.gd b/pinball/flipper.gd new file mode 100644 index 0000000..9d18c84 --- /dev/null +++ b/pinball/flipper.gd @@ -0,0 +1,35 @@ +extends RigidBody2D + +@export var flip_strength: float = 50.0 +@export var rest_strength: float = 20.0 +@export var right_flipper: bool = false + +var rest_angle: float = 0.0 +var flipped_angle: float = -60.0 #deg + +func _ready() -> void: + gravity_scale = 0.0 + freeze = false + + if right_flipper: + flipped_angle *= -1 + rest_angle *= -1 + + rotation_degrees = rest_angle + +func _input(event: InputEvent) -> void: + if right_flipper and event.is_action_pressed("right_flipper"): + flip() + elif !right_flipper and event.is_action_pressed("left_flipper"): + flip() + + if right_flipper and event.is_action_released("right_flipper"): + rest() + elif !right_flipper and event.is_action_released("left_flipper"): + rest() + +func flip() -> void: + angular_velocity = flip_strength + +func rest() -> void: + angular_velocity = -rest_strength \ No newline at end of file diff --git a/pinball/flipper.gd.uid b/pinball/flipper.gd.uid new file mode 100644 index 0000000..3e530ae --- /dev/null +++ b/pinball/flipper.gd.uid @@ -0,0 +1 @@ +uid://fnuonblf0vk2 diff --git a/pinball/flipper.tscn b/pinball/flipper.tscn new file mode 100644 index 0000000..a33eeef --- /dev/null +++ b/pinball/flipper.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=3 format=3 uid="uid://idjf5lor2py2"] + +[ext_resource type="Texture2D" uid="uid://b1r22t327pigo" path="res://assets/flipper.png" id="1_duuhy"] + +[sub_resource type="ConcavePolygonShape2D" id="ConcavePolygonShape2D_duuhy"] + +[node name="Flipper" type="RigidBody2D"] + +[node name="Flipper" type="Sprite2D" parent="."] +position = Vector2(-26, -3) +texture = ExtResource("1_duuhy") +offset = Vector2(26, 3) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("ConcavePolygonShape2D_duuhy") diff --git a/pinball/table.tscn b/pinball/table.tscn new file mode 100644 index 0000000..bd54f4e --- /dev/null +++ b/pinball/table.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://2bnojgnoj8df"] + +[node name="Table" type="Node2D"] diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..4e894bd --- /dev/null +++ b/project.godot @@ -0,0 +1,47 @@ +; 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="pinballatro" +config/features=PackedStringArray("4.4", "Forward Plus") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=270 +window/size/viewport_height=480 +window/size/window_width_override=540 +window/size/window_height_override=960 +window/stretch/mode="viewport" +window/stretch/aspect="keep_width" +window/stretch/scale_mode="integer" +window/handheld/orientation=1 + +[input] + +left_flipper={ +"deadzone": 0.2, +"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,"location":0,"echo":false,"script":null) +] +} +right_flipper={ +"deadzone": 0.2, +"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":79,"key_label":0,"unicode":111,"location":0,"echo":false,"script":null) +] +} + +[rendering] + +textures/canvas_textures/default_texture_filter=0 +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +textures/decals/filter=0 +textures/light_projectors/filter=0