commit b5082f86b14e5dfbfeec4d1e05b63430808732c6 Author: zman27 Date: Wed Jan 26 22:36:30 2022 -0500 first commit diff --git a/Art/Clearie 01.png b/Art/Clearie 01.png new file mode 100644 index 0000000..592ceef Binary files /dev/null and b/Art/Clearie 01.png differ diff --git a/Art/Clearie 01.png.import b/Art/Clearie 01.png.import new file mode 100644 index 0000000..ab76d9f --- /dev/null +++ b/Art/Clearie 01.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Clearie 01.png-77f4217047e464eb907c9a1ef1148811.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Clearie 01.png" +dest_files=[ "res://.import/Clearie 01.png-77f4217047e464eb907c9a1ef1148811.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/Corkscrew 04.png b/Art/Corkscrew 04.png new file mode 100644 index 0000000..ef431f7 Binary files /dev/null and b/Art/Corkscrew 04.png differ diff --git a/Art/Corkscrew 04.png.import b/Art/Corkscrew 04.png.import new file mode 100644 index 0000000..d4509b8 --- /dev/null +++ b/Art/Corkscrew 04.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Corkscrew 04.png-6ee92a02fd4ab60092465f6c8fde4d17.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Corkscrew 04.png" +dest_files=[ "res://.import/Corkscrew 04.png-6ee92a02fd4ab60092465f6c8fde4d17.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/DemoTowers.png b/Art/DemoTowers.png new file mode 100644 index 0000000..fbcb995 Binary files /dev/null and b/Art/DemoTowers.png differ diff --git a/Art/DemoTowers.png.import b/Art/DemoTowers.png.import new file mode 100644 index 0000000..f1fa47b --- /dev/null +++ b/Art/DemoTowers.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/DemoTowers.png-81193a16bf178c79f8915646f68d90f1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/DemoTowers.png" +dest_files=[ "res://.import/DemoTowers.png-81193a16bf178c79f8915646f68d90f1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/Extra02.png b/Art/Extra02.png new file mode 100644 index 0000000..e67a728 Binary files /dev/null and b/Art/Extra02.png differ diff --git a/Art/Extra02.png.import b/Art/Extra02.png.import new file mode 100644 index 0000000..2da7be4 --- /dev/null +++ b/Art/Extra02.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Extra02.png-bda0e2d6f41521ca65335466a5a597d7.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Extra02.png" +dest_files=[ "res://.import/Extra02.png-bda0e2d6f41521ca65335466a5a597d7.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/Extras-07.png b/Art/Extras-07.png new file mode 100644 index 0000000..5dc4d36 Binary files /dev/null and b/Art/Extras-07.png differ diff --git a/Art/Extras-07.png.import b/Art/Extras-07.png.import new file mode 100644 index 0000000..96b7bf0 --- /dev/null +++ b/Art/Extras-07.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Extras-07.png-0f3762f841ed573a33bcc045f6e3b711.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Extras-07.png" +dest_files=[ "res://.import/Extras-07.png-0f3762f841ed573a33bcc045f6e3b711.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/LevelBackground.png b/Art/LevelBackground.png new file mode 100644 index 0000000..08c7d63 Binary files /dev/null and b/Art/LevelBackground.png differ diff --git a/Art/LevelBackground.png.import b/Art/LevelBackground.png.import new file mode 100644 index 0000000..b0e6f68 --- /dev/null +++ b/Art/LevelBackground.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/LevelBackground.png-925a1cb64c7367da07a35afa52738afc.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/LevelBackground.png" +dest_files=[ "res://.import/LevelBackground.png-925a1cb64c7367da07a35afa52738afc.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Art/Steelie 01.png b/Art/Steelie 01.png new file mode 100644 index 0000000..26671c2 Binary files /dev/null and b/Art/Steelie 01.png differ diff --git a/Art/Steelie 01.png.import b/Art/Steelie 01.png.import new file mode 100644 index 0000000..37768e0 --- /dev/null +++ b/Art/Steelie 01.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Steelie 01.png-d5f4b3609c0cfe00116b346d82c9c0ee.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Steelie 01.png" +dest_files=[ "res://.import/Steelie 01.png-d5f4b3609c0cfe00116b346d82c9c0ee.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Balls/Ball.gd b/Balls/Ball.gd new file mode 100644 index 0000000..d17e736 --- /dev/null +++ b/Balls/Ball.gd @@ -0,0 +1,19 @@ +extends RigidBody2D + +var held = false + + + + +func _physics_process(delta): + if held: + global_transform.origin = get_global_mouse_position() + + + + +func drop(impulse=Vector2.ZERO): + if held: + mode = RigidBody2D.MODE_RIGID + apply_central_impulse(impulse) + held = false diff --git a/Balls/Ball.tscn b/Balls/Ball.tscn new file mode 100644 index 0000000..f4687fc --- /dev/null +++ b/Balls/Ball.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://Art/Extra02.png" type="Texture" id=1] +[ext_resource path="res://Balls/Ball.gd" type="Script" id=2] + +[sub_resource type="PhysicsMaterial" id=2] + +[sub_resource type="CircleShape2D" id=1] +radius = 9.5 + +[node name="Ball" type="RigidBody2D" groups=[ +"Balls", +]] +collision_layer = 15 +collision_mask = 4 +physics_material_override = SubResource( 2 ) +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +scale = Vector2( 0.560606, 0.560606 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2( 2, 2 ) +shape = SubResource( 1 ) + +[connection signal="input_event" from="." to="." method="_on_Ball_input_event"] diff --git a/Cups/Cup.gd b/Cups/Cup.gd new file mode 100644 index 0000000..fc487c8 --- /dev/null +++ b/Cups/Cup.gd @@ -0,0 +1,7 @@ +extends Area2D + + +func _on_Cup_body_entered(body: Node) -> void: + if body.is_in_group("Balls"): + print("Yatta!") + body.queue_free() diff --git a/Cups/Cup.tscn b/Cups/Cup.tscn new file mode 100644 index 0000000..712d3fe --- /dev/null +++ b/Cups/Cup.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Art/Extras-07.png" type="Texture" id=1] +[ext_resource path="res://Cups/Cup.gd" type="Script" id=2] + +[node name="Cup" type="Area2D" groups=[ +"Buckets", +]] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) +flip_v = true + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PoolVector2Array( 28, 4, -28, 4, 0, 23 ) + +[connection signal="body_entered" from="." to="." method="_on_Cup_body_entered"] diff --git a/ServeArea.gd b/ServeArea.gd new file mode 100644 index 0000000..088d2d5 --- /dev/null +++ b/ServeArea.gd @@ -0,0 +1,31 @@ +extends Area2D + +var ball +var held_object = null + + + + +func _on_TextureButton_button_down() -> void: + ball = load("res://Balls/Ball.tscn").instance() + ball.position = get_global_mouse_position() + ball.mode = RigidBody2D.MODE_STATIC + ball.held = true + held_object = ball + add_child(ball) + + + + +func _on_TextureButton_button_up() -> void: + held_object.drop(Input.get_last_mouse_speed()) + ball.held = false + held_object = null + + + + +func _on_ServeArea_mouse_exited() -> void: + print("Gone") + if held_object != null: + _on_TextureButton_button_up() diff --git a/World.tscn b/World.tscn new file mode 100644 index 0000000..9d6a3d7 --- /dev/null +++ b/World.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://ServeArea.gd" type="Script" id=1] +[ext_resource path="res://Cups/Cup.tscn" type="PackedScene" id=2] +[ext_resource path="res://Art/LevelBackground.png" type="Texture" id=3] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 267.75, 124 ) + +[node name="World" type="Node2D"] + +[node name="TextureRect" type="TextureRect" parent="."] +margin_left = 2.0 +margin_right = 536.0 +margin_bottom = 957.0 +texture = ExtResource( 3 ) +expand = true +flip_v = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ServeArea" type="Area2D" parent="."] +script = ExtResource( 1 ) + +[node name="TextureButton" type="TextureButton" parent="ServeArea"] +margin_right = 539.0 +margin_bottom = 249.0 +mouse_filter = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CollisionShape2D" type="CollisionShape2D" parent="ServeArea"] +position = Vector2( 268.25, 124 ) +shape = SubResource( 1 ) + +[node name="Cup" parent="." instance=ExtResource( 2 )] +position = Vector2( 266, 908 ) + +[connection signal="mouse_exited" from="ServeArea" to="ServeArea" method="_on_ServeArea_mouse_exited"] +[connection signal="button_down" from="ServeArea/TextureButton" to="ServeArea" method="_on_TextureButton_button_down"] +[connection signal="button_up" from="ServeArea/TextureButton" to="ServeArea" method="_on_TextureButton_button_up"] diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/gml.gd b/gml.gd new file mode 100644 index 0000000..691ef08 --- /dev/null +++ b/gml.gd @@ -0,0 +1,86 @@ +# Skip's attempts to recreate common GML commands in Godot +class_name GML + +# [ SIGNAL CHEATSHEET ] +# +# Declare and emit (with args) signal from source. +# +# signal hit +# func _on_Hero_body_entered: +# emit_signal("hit", "fck that hurt", 1) +# +# Connect and handle (with args) signal from destination. +# +# func _ready: +# var proj = get_tree().get_root().find_node("Projectile",true,false) +# proj.connect("hit", self, "handle_hit") +# func handle_hit(message, damage): +# print(message) +# health -= damage + + +static func choose(choices): + # Picks a random item from a given array, "choices", of any size. + # Ex: cardinal = choose(["north", "south", "east", "west"]) + + return choices[randi() % choices.size()] + + + + +static func instance_create(x, y, scene_path, parent) -> Node: + # Creates an instance of a given node at the given coordinates + # as a child of a given parent. + # Ex: instance_create(30, 100, "res://Actors/EnemyShip.tscn", self) + var scene = load(scene_path) + var id = scene.instance() + id.position = Vector2(x, y) + parent.add_child(id) + + + return id + + + + +static func image_angle(me, degrees): + me.rotation_degrees = degrees + + + + +static func point_direction(x1, y1, x2, y2) -> float: + # Returns the angle (in degrees) specified by two given points. + # Ex: rotation_degrees = point_direction($Hero.position.x, $Hero.position.y, $Enemy.position.x, $Enemy.position.y) + + return rad2deg(Vector2(x2, y2).angle_to_point(Vector2(x1, y1))) + + + + +static func move_xy(distance, angle_in_degrees) -> Vector2: + # Returns new (relative) coordinates depicting a point having moved a given distance (in pixels) in a given direction (angle in degrees). + # Ex: Enemy.position += move_xy(speed, Hero.position.angle_to_point(Enemy.position)) + return Vector2(cos(deg2rad(angle_in_degrees)),sin(deg2rad(angle_in_degrees))) * distance + + + + +static func distance_to_object(node1, node2) -> float: + # Returns the distance between node1 and node2 (in pixels) + # Ex: if distance_to_object(self, $Alarm) < 50: + return node1.position.distance_to(node2.position) + + +static func game_end(me): + # Quit the game. + # Ex: game_end(self) + + me.get_tree().quit() + +static func room_restart(me): + # Restart the scene. + # Ex: room_restart(self) + + me.get_tree().reload_current_scene() + diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..a4c02e6 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..bdb2d9c --- /dev/null +++ b/project.godot @@ -0,0 +1,48 @@ +; 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=4 + +_global_script_classes=[ { +"base": "Reference", +"class": "GML", +"language": "GDScript", +"path": "res://gml.gd" +} ] +_global_script_class_icons={ +"GML": "" +} + +[application] + +config/name="Pachinko" +run/main_scene="res://World.tscn" +config/icon="res://icon.png" + +[display] + +window/size/width=540 +window/size/height=960 +window/stretch/mode="2d" +window/stretch/aspect="keep_width" + +[layer_names] + +2d_physics/layer_1="Walls" +2d_physics/layer_2="Pins" +2d_physics/layer_3="Balls" +2d_physics/layer_4="Cups" +2d_physics/layer_5="Items" + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres"