Skip to content

Commit 4d38bf3

Browse files
committed
copy episode 3 over
1 parent b0cffa6 commit 4d38bf3

17 files changed

Lines changed: 364 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[gd_resource type="Environment" load_steps=2 format=2]
2+
3+
[sub_resource type="ProceduralSky" id=1]
4+
5+
[resource]
6+
background_mode = 2
7+
background_sky = SubResource( 1 )
8+

TddAndPong/Episode4/icon.png

3.35 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://icon.png"
13+
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
stream=false
32+
size_limit=0
33+
detect_3d=true
34+
svg/scale=1.0

TddAndPong/Episode4/project.godot

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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=4
10+
11+
_global_script_classes=[ ]
12+
_global_script_class_icons={
13+
14+
}
15+
16+
[application]
17+
18+
config/name="PongGutDemo"
19+
config/icon="res://icon.png"
20+
21+
[editor_plugins]
22+
23+
enabled=PoolStringArray( "gut" )
24+
25+
[rendering]
26+
27+
environment/default_environment="res://default_env.tres"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[gd_scene load_steps=3 format=2]
2+
3+
[ext_resource path="res://scripts/ball.gd" type="Script" id=1]
4+
5+
[sub_resource type="CircleShape2D" id=1]
6+
7+
[node name="Ball" type="Area2D"]
8+
script = ExtResource( 1 )
9+
10+
[node name="Shape" type="CollisionShape2D" parent="."]
11+
shape = SubResource( 1 )
12+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[gd_scene load_steps=5 format=2]
2+
3+
[ext_resource path="res://scripts/game.gd" type="Script" id=1]
4+
[ext_resource path="res://scenes/Ball.tscn" type="PackedScene" id=2]
5+
[ext_resource path="res://scenes/Wall.tscn" type="PackedScene" id=3]
6+
[ext_resource path="res://scenes/Paddle.tscn" type="PackedScene" id=4]
7+
8+
[node name="Game" type="Node2D"]
9+
script = ExtResource( 1 )
10+
11+
[node name="Ball" parent="." instance=ExtResource( 2 )]
12+
position = Vector2( 462, 218 )
13+
14+
[node name="TopWall" parent="." instance=ExtResource( 3 )]
15+
position = Vector2( 464, 156 )
16+
_color = Color( 0.941176, 0.0784314, 0.0784314, 1 )
17+
18+
[node name="BottomWall" parent="." instance=ExtResource( 3 )]
19+
position = Vector2( 469, 291 )
20+
_color = Color( 0.0431373, 0.909804, 0.2, 1 )
21+
22+
[node name="P1Paddle" parent="." instance=ExtResource( 4 )]
23+
position = Vector2( 353, 225 )
24+
25+
[node name="P2Paddle" parent="." instance=ExtResource( 4 )]
26+
position = Vector2( 578, 218 )
27+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[gd_scene load_steps=3 format=2]
2+
3+
[ext_resource path="res://scripts/paddle.gd" type="Script" id=1]
4+
5+
[sub_resource type="RectangleShape2D" id=1]
6+
extents = Vector2( 10, 54.8 )
7+
8+
[node name="Paddle" type="Area2D"]
9+
script = ExtResource( 1 )
10+
11+
[node name="Shape" type="CollisionShape2D" parent="."]
12+
shape = SubResource( 1 )
13+
14+
[connection signal="area_entered" from="." to="." method="_on_Paddle_area_entered"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[gd_scene load_steps=3 format=2]
2+
3+
[ext_resource path="res://scripts/wall.gd" type="Script" id=1]
4+
5+
[sub_resource type="RectangleShape2D" id=1]
6+
extents = Vector2( 102, 10 )
7+
8+
[node name="Wall" type="Area2D"]
9+
script = ExtResource( 1 )
10+
11+
[node name="Shape" type="CollisionShape2D" parent="."]
12+
position = Vector2( 0, -1 )
13+
shape = SubResource( 1 )
14+
15+
[connection signal="area_entered" from="." to="." method="_on_Wall_area_entered"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
extends Area2D
2+
3+
var _speed = 0
4+
var _direction = Vector2(0, 0)
5+
6+
func get_speed():
7+
return _speed
8+
9+
func set_speed(speed):
10+
_speed = speed
11+
12+
func get_direction():
13+
return _direction
14+
15+
func set_direction(direction):
16+
if(!direction.is_normalized()):
17+
_direction = direction.normalized()
18+
else:
19+
_direction = direction
20+
21+
func _process(delta):
22+
var new_pos = _speed * _direction * delta
23+
set_position(get_position() + new_pos)
24+
25+
func _draw():
26+
draw_circle(Vector2(0 ,0), $Shape.shape.radius, Color(0, 0, 1))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends Node2D
2+
3+
func _ready():
4+
$Ball.set_speed(300)
5+
$Ball.set_direction(Vector2(1, 1))
6+

0 commit comments

Comments
 (0)