├── .gitignore ├── pig.png ├── apple.png ├── .gitattributes ├── apple.tscn ├── piggy.gd ├── pig.png.import ├── apple.png.import ├── icon.svg.import ├── LICENSE.txt ├── world.tscn ├── project.godot ├── piggy.tscn └── icon.svg /.gitignore: -------------------------------------------------------------------------------- 1 | # Godot 4+ specific ignores 2 | .godot/ 3 | -------------------------------------------------------------------------------- /pig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uheartbeast/Piggy-Godot-4/HEAD/pig.png -------------------------------------------------------------------------------- /apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uheartbeast/Piggy-Godot-4/HEAD/apple.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize EOL for all files that Git considers text files. 2 | * text=auto eol=lf 3 | -------------------------------------------------------------------------------- /apple.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://bxhvi1wx0wpng"] 2 | 3 | [ext_resource type="Texture2D" uid="uid://dgujggb5uwm26" path="res://apple.png" id="1_45myt"] 4 | 5 | [sub_resource type="CircleShape2D" id="CircleShape2D_4soqw"] 6 | radius = 5.0 7 | 8 | [node name="Apple" type="Area2D"] 9 | collision_layer = 2 10 | collision_mask = 0 11 | 12 | [node name="Sprite2D" type="Sprite2D" parent="."] 13 | texture = ExtResource("1_45myt") 14 | 15 | [node name="CollisionShape2D" type="CollisionShape2D" parent="."] 16 | shape = SubResource("CircleShape2D_4soqw") 17 | -------------------------------------------------------------------------------- /piggy.gd: -------------------------------------------------------------------------------- 1 | extends Area2D 2 | 3 | @export var speed = 70 4 | 5 | @onready var animation_player = $AnimationPlayer 6 | @onready var sprite_2d = $Sprite2D 7 | 8 | func _process(delta): 9 | var input_vector = Input.get_vector("move_left", "move_right", "move_up", "move_down") 10 | 11 | if input_vector == Vector2.ZERO: 12 | animation_player.play("idle") 13 | else: 14 | animation_player.play("run") 15 | if input_vector.x != 0: 16 | sprite_2d.scale.x = sign(input_vector.x) 17 | position += input_vector * speed * delta 18 | 19 | 20 | func _on_area_entered(area): 21 | area.queue_free() 22 | scale *= 1.1 23 | -------------------------------------------------------------------------------- /pig.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://c4kd1m6p6n4dj" 6 | path="res://.godot/imported/pig.png-27c779637403e465d2e03317ab3cc4a3.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://pig.png" 14 | dest_files=["res://.godot/imported/pig.png-27c779637403e465d2e03317ab3cc4a3.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /apple.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://dgujggb5uwm26" 6 | path="res://.godot/imported/apple.png-53a5ba701c353857fc5b432b6c413138.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://apple.png" 14 | dest_files=["res://.godot/imported/apple.png-53a5ba701c353857fc5b432b6c413138.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /icon.svg.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://duayj6xt7vqlm" 6 | path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://icon.svg" 14 | dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | svg/scale=1.0 36 | editor/scale_with_editor_scale=false 37 | editor/convert_colors_with_editor_theme=false 38 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Heart Gamedev LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /world.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=3 uid="uid://yi7uaj22bbtj"] 2 | 3 | [ext_resource type="PackedScene" uid="uid://cufebj14t7eor" path="res://piggy.tscn" id="1_yo4vd"] 4 | [ext_resource type="PackedScene" uid="uid://bxhvi1wx0wpng" path="res://apple.tscn" id="2_iqmjl"] 5 | 6 | [node name="World" type="Node2D"] 7 | 8 | [node name="Piggy" parent="." instance=ExtResource("1_yo4vd")] 9 | position = Vector2(151, 76) 10 | 11 | [node name="Apple" parent="." instance=ExtResource("2_iqmjl")] 12 | position = Vector2(117, 129) 13 | 14 | [node name="Apple2" parent="." instance=ExtResource("2_iqmjl")] 15 | position = Vector2(54, 94) 16 | 17 | [node name="Apple3" parent="." instance=ExtResource("2_iqmjl")] 18 | position = Vector2(131, 29) 19 | 20 | [node name="Apple4" parent="." instance=ExtResource("2_iqmjl")] 21 | position = Vector2(252, 29) 22 | 23 | [node name="Apple5" parent="." instance=ExtResource("2_iqmjl")] 24 | position = Vector2(243, 81) 25 | 26 | [node name="Apple6" parent="." instance=ExtResource("2_iqmjl")] 27 | position = Vector2(267, 134) 28 | 29 | [node name="Apple7" parent="." instance=ExtResource("2_iqmjl")] 30 | position = Vector2(52, 141) 31 | 32 | [node name="Apple8" parent="." instance=ExtResource("2_iqmjl")] 33 | position = Vector2(93, 164) 34 | 35 | [node name="Apple9" parent="." instance=ExtResource("2_iqmjl")] 36 | position = Vector2(176, 144) 37 | 38 | [node name="Apple10" parent="." instance=ExtResource("2_iqmjl")] 39 | position = Vector2(85, 85) 40 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=5 10 | 11 | [application] 12 | 13 | config/name="Piggy Recording" 14 | run/main_scene="res://world.tscn" 15 | config/features=PackedStringArray("4.0", "GL Compatibility") 16 | config/icon="res://icon.svg" 17 | 18 | [display] 19 | 20 | window/size/viewport_width=320 21 | window/size/viewport_height=180 22 | window/size/window_width_override=1280 23 | window/size/window_height_override=720 24 | window/stretch/mode="canvas_items" 25 | 26 | [input] 27 | 28 | move_right={ 29 | "deadzone": 0.5, 30 | "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null) 31 | ] 32 | } 33 | move_left={ 34 | "deadzone": 0.5, 35 | "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":4194319,"key_label":0,"unicode":0,"echo":false,"script":null) 36 | ] 37 | } 38 | move_up={ 39 | "deadzone": 0.5, 40 | "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":4194320,"key_label":0,"unicode":0,"echo":false,"script":null) 41 | ] 42 | } 43 | move_down={ 44 | "deadzone": 0.5, 45 | "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":4194322,"key_label":0,"unicode":0,"echo":false,"script":null) 46 | ] 47 | } 48 | 49 | [layer_names] 50 | 51 | 2d_physics/layer_1="piggy" 52 | 2d_physics/layer_2="apples" 53 | 54 | [rendering] 55 | 56 | textures/canvas_textures/default_texture_filter=0 57 | renderer/rendering_method="gl_compatibility" 58 | renderer/rendering_method.mobile="gl_compatibility" 59 | -------------------------------------------------------------------------------- /piggy.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=8 format=3 uid="uid://cufebj14t7eor"] 2 | 3 | [ext_resource type="Texture2D" uid="uid://c4kd1m6p6n4dj" path="res://pig.png" id="1_3u75m"] 4 | [ext_resource type="Script" path="res://piggy.gd" id="1_tp0v1"] 5 | 6 | [sub_resource type="Animation" id="Animation_jsqka"] 7 | resource_name = "idle" 8 | tracks/0/type = "value" 9 | tracks/0/imported = false 10 | tracks/0/enabled = true 11 | tracks/0/path = NodePath("Sprite2D:frame") 12 | tracks/0/interp = 1 13 | tracks/0/loop_wrap = true 14 | tracks/0/keys = { 15 | "times": PackedFloat32Array(0), 16 | "transitions": PackedFloat32Array(1), 17 | "update": 1, 18 | "values": [0] 19 | } 20 | 21 | [sub_resource type="Animation" id="Animation_rplog"] 22 | length = 0.001 23 | tracks/0/type = "value" 24 | tracks/0/imported = false 25 | tracks/0/enabled = true 26 | tracks/0/path = NodePath("Sprite2D:frame") 27 | tracks/0/interp = 1 28 | tracks/0/loop_wrap = true 29 | tracks/0/keys = { 30 | "times": PackedFloat32Array(0), 31 | "transitions": PackedFloat32Array(1), 32 | "update": 1, 33 | "values": [0] 34 | } 35 | 36 | [sub_resource type="Animation" id="Animation_nbmff"] 37 | resource_name = "run" 38 | length = 0.3 39 | loop_mode = 1 40 | tracks/0/type = "value" 41 | tracks/0/imported = false 42 | tracks/0/enabled = true 43 | tracks/0/path = NodePath("Sprite2D:frame") 44 | tracks/0/interp = 1 45 | tracks/0/loop_wrap = true 46 | tracks/0/keys = { 47 | "times": PackedFloat32Array(0, 0.1, 0.2), 48 | "transitions": PackedFloat32Array(1, 1, 1), 49 | "update": 1, 50 | "values": [1, 2, 0] 51 | } 52 | 53 | [sub_resource type="AnimationLibrary" id="AnimationLibrary_35xnc"] 54 | _data = { 55 | "RESET": SubResource("Animation_rplog"), 56 | "idle": SubResource("Animation_jsqka"), 57 | "run": SubResource("Animation_nbmff") 58 | } 59 | 60 | [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_68i0g"] 61 | radius = 7.0 62 | height = 22.0 63 | 64 | [node name="Piggy" type="Area2D"] 65 | collision_mask = 2 66 | script = ExtResource("1_tp0v1") 67 | speed = 65 68 | 69 | [node name="Sprite2D" type="Sprite2D" parent="."] 70 | texture = ExtResource("1_3u75m") 71 | hframes = 3 72 | 73 | [node name="AnimationPlayer" type="AnimationPlayer" parent="."] 74 | libraries = { 75 | "": SubResource("AnimationLibrary_35xnc") 76 | } 77 | 78 | [node name="CollisionShape2D" type="CollisionShape2D" parent="."] 79 | position = Vector2(0, 3) 80 | rotation = 1.5708 81 | shape = SubResource("CapsuleShape2D_68i0g") 82 | 83 | [connection signal="area_entered" from="." to="." method="_on_area_entered"] 84 | -------------------------------------------------------------------------------- /icon.svg: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------