pongodot

Tinkering with Godot, remaking pong
git clone git://git.hellocld.com/pongodot
Log | Files | Refs

commit af3d7fec9d0f2630b1306105f383240f18045a5f
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Sat,  2 Nov 2019 15:55:27 -0400

Init commit

Diffstat:
A.gitignore | 9+++++++++
AAssets/Sprites/Ball.aseprite | 0
AAssets/Sprites/Ball.png | 0
AAssets/Sprites/Ball.png.import | 34++++++++++++++++++++++++++++++++++
AAssets/Sprites/Paddle.aseprite | 0
AAssets/Sprites/Paddle.png | 0
AAssets/Sprites/Paddle.png.import | 34++++++++++++++++++++++++++++++++++
AAssets/Sprites/Palette.aseprite | 0
ABall.gd | 17+++++++++++++++++
ABall.tscn | 19+++++++++++++++++++
AGame.tscn | 13+++++++++++++
APaddle.tscn | 14++++++++++++++
Adefault_env.tres | 7+++++++
Aicon.png | 0
Aicon.png.import | 34++++++++++++++++++++++++++++++++++
Aproject.godot | 30++++++++++++++++++++++++++++++
16 files changed, 211 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,9 @@ + +# Godot-specific ignores +.import/ +export.cfg +export_presets.cfg + +# Mono-specific ignores +.mono/ +data_*/ diff --git a/Assets/Sprites/Ball.aseprite b/Assets/Sprites/Ball.aseprite Binary files differ. diff --git a/Assets/Sprites/Ball.png b/Assets/Sprites/Ball.png Binary files differ. diff --git a/Assets/Sprites/Ball.png.import b/Assets/Sprites/Ball.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Ball.png-5b4622e3d3b0d857ad7f0b029aa95411.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/Ball.png" +dest_files=[ "res://.import/Ball.png-5b4622e3d3b0d857ad7f0b029aa95411.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=false +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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/Sprites/Paddle.aseprite b/Assets/Sprites/Paddle.aseprite Binary files differ. diff --git a/Assets/Sprites/Paddle.png b/Assets/Sprites/Paddle.png Binary files differ. diff --git a/Assets/Sprites/Paddle.png.import b/Assets/Sprites/Paddle.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Paddle.png-94d9dfb6e69592dfe061ee5b983024f1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/Paddle.png" +dest_files=[ "res://.import/Paddle.png-94d9dfb6e69592dfe061ee5b983024f1.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=false +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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Assets/Sprites/Palette.aseprite b/Assets/Sprites/Palette.aseprite Binary files differ. diff --git a/Ball.gd b/Ball.gd @@ -0,0 +1,17 @@ +extends Area2D + +export var _speed = 10 +var _dir = Vector2(1, 1) + +func _process(delta): + position += _dir * _speed * delta + if position.x >= get_viewport().size.x or position.x < 0: + _dir.x *= -1 + if position.y >= get_viewport().size.y or position.y < 0: + _dir.y *= -1 + + + + +func _on_Ball_area_entered(area): + print("Area entered!") diff --git a/Ball.tscn b/Ball.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Ball.gd" type="Script" id=1] +[ext_resource path="res://Assets/Sprites/Ball.png" type="Texture" id=2] + +[sub_resource type="CircleShape2D" id=1] +radius = 16.0 + +[node name="Ball" type="Area2D"] +editor/display_folded = true +script = ExtResource( 1 ) +_speed = 32 + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) +[connection signal="area_entered" from="." to="." method="_on_Ball_area_entered"] diff --git a/Game.tscn b/Game.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Ball.tscn" type="PackedScene" id=1] +[ext_resource path="res://Paddle.tscn" type="PackedScene" id=2] + +[node name="Node2D" type="Node2D"] + +[node name="Ball" parent="." instance=ExtResource( 1 )] +position = Vector2( 55, 50 ) +_speed = 64 + +[node name="Paddle" parent="." instance=ExtResource( 2 )] +position = Vector2( 333.107, 245.815 ) diff --git a/Paddle.tscn b/Paddle.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Assets/Sprites/Paddle.png" type="Texture" id=1] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 16, 64 ) + +[node name="Paddle" type="Area2D"] + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) diff --git a/default_env.tres 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/icon.png b/icon.png Binary files differ. diff --git a/icon.png.import b/icon.png.import @@ -0,0 +1,34 @@ +[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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot @@ -0,0 +1,30 @@ +; 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=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="pongodot" +config/icon="res://icon.png" + +[display] + +window/size/width=640 +window/size/height=480 +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[rendering] + +environment/default_environment="res://default_env.tres"