Add pong3 demo using expression nodes

This commit is contained in:
Juan Linietsky
2016-09-04 14:17:52 -03:00
parent 109b704ae3
commit 5ee9e3cf6a
13 changed files with 70 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,17 +5,17 @@
[ext_resource path="res://ball.png" type="Texture" id=3]
[ext_resource path="res://pallete.tscn" type="PackedScene" id=4]
[sub_resource type="CircleShape2D" id=3]
[sub_resource type="CircleShape2D" id=1]
custom_solver_bias = 0.0
radius = 4.74303
[sub_resource type="RectangleShape2D" id=1]
[sub_resource type="RectangleShape2D" id=2]
custom_solver_bias = 0.0
extents = Vector2( 320, 10 )
[sub_resource type="RectangleShape2D" id=2]
[sub_resource type="RectangleShape2D" id=3]
custom_solver_bias = 0.0
extents = Vector2( 10, 200 )
@@ -31,7 +31,7 @@ texture = ExtResource( 1 )
transform/pos = Vector2( 320.29, 195.901 )
input/pickable = true
shapes/0/shape = SubResource( 3 )
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
shapes/0/trigger = false
gravity_vec = Vector2( 0, 1 )
@@ -46,7 +46,7 @@ texture = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="ball"]
shape = SubResource( 3 )
shape = SubResource( 1 )
trigger = false
_update_shape_index = 0
@@ -69,7 +69,7 @@ modulate = Color( 1, 0, 1, 1 )
[node name="top_margin" type="Area2D" parent="."]
input/pickable = true
shapes/0/shape = SubResource( 1 )
shapes/0/shape = SubResource( 2 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 320, -10 )
shapes/0/trigger = false
gravity_vec = Vector2( 0, 1 )
@@ -80,14 +80,14 @@ angular_damp = 1.0
[node name="shape" type="CollisionShape2D" parent="top_margin"]
transform/pos = Vector2( 320, -10 )
shape = SubResource( 1 )
shape = SubResource( 2 )
trigger = false
_update_shape_index = 0
[node name="bottom_margin" type="Area2D" parent="."]
input/pickable = true
shapes/0/shape = SubResource( 1 )
shapes/0/shape = SubResource( 2 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 320, 410 )
shapes/0/trigger = false
gravity_vec = Vector2( 0, 1 )
@@ -98,14 +98,14 @@ angular_damp = 1.0
[node name="shape" type="CollisionShape2D" parent="bottom_margin"]
transform/pos = Vector2( 320, 410 )
shape = SubResource( 1 )
shape = SubResource( 2 )
trigger = false
_update_shape_index = 0
[node name="left_margin" type="Area2D" parent="."]
input/pickable = true
shapes/0/shape = SubResource( 2 )
shapes/0/shape = SubResource( 3 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, -10, 200 )
shapes/0/trigger = false
gravity_vec = Vector2( 0, 1 )
@@ -116,14 +116,14 @@ angular_damp = 1.0
[node name="shape" type="CollisionShape2D" parent="left_margin"]
transform/pos = Vector2( -10, 200 )
shape = SubResource( 2 )
shape = SubResource( 3 )
trigger = false
_update_shape_index = 0
[node name="right_margin" type="Area2D" parent="."]
input/pickable = true
shapes/0/shape = SubResource( 2 )
shapes/0/shape = SubResource( 3 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 650, 200 )
shapes/0/trigger = false
gravity_vec = Vector2( 0, 1 )
@@ -134,7 +134,7 @@ angular_damp = 1.0
[node name="shape" type="CollisionShape2D" parent="right_margin"]
transform/pos = Vector2( 650, 200 )
shape = SubResource( 2 )
shape = SubResource( 3 )
trigger = false
_update_shape_index = 0

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

View File

@@ -0,0 +1,22 @@
[application]
name="Pong Visual Script"
main_scene="pong.tscn"
icon="res://icon.png"
[display]
width=640
height=400
stretch_2d=true
[input]
left_move_up=[key(A)]
left_move_down=[key(Z)]
right_move_up=[key(Up)]
right_move_down=[key(Down)]
[render]
default_clear_color=#ff000000

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

View File

@@ -0,0 +1,35 @@
[gd_scene load_steps=6 format=1]
[ext_resource path="res://pong.vs" type="Script" id=1]
[ext_resource path="res://left_pallete.png" type="Texture" id=2]
[ext_resource path="res://right_pallete.png" type="Texture" id=3]
[ext_resource path="res://separator.png" type="Texture" id=4]
[ext_resource path="res://ball.png" type="Texture" id=5]
[node name="game" type="Node2D"]
script/script = ExtResource( 1 )
[node name="left" type="Sprite" parent="."]
transform/pos = Vector2( 64.0121, 179.533 )
texture = ExtResource( 2 )
centered = false
[node name="right" type="Sprite" parent="."]
transform/pos = Vector2( 581.411, 175.239 )
texture = ExtResource( 3 )
centered = false
[node name="separator" type="Sprite" parent="."]
transform/pos = Vector2( 320, 200 )
texture = ExtResource( 4 )
[node name="ball" type="Sprite" parent="."]
transform/pos = Vector2( 320, 200 )
texture = ExtResource( 5 )

BIN
visual_script/pong3/pong.vs Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B