Update all Pong demos to Godot 3.1.2 and conform to style guides
@@ -7,5 +7,4 @@ script = ExtResource( 1 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
||||
@@ -12,4 +12,3 @@ sun_energy = 16.0
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
|
||||
|
||||
@@ -4,4 +4,3 @@
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
||||
@@ -12,4 +12,3 @@ sun_energy = 16.0
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
106
visual_script/pong/pong.tscn
Normal file
@@ -0,0 +1,106 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/paddle.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://scripts/ball.vs" type="Script" id=4]
|
||||
[ext_resource path="res://ball.png" type="Texture" id=5]
|
||||
[ext_resource path="res://separator.png" type="Texture" id=6]
|
||||
[ext_resource path="res://scripts/wall.vs" type="Script" id=7]
|
||||
[ext_resource path="res://scripts/ceiling_floor.vs" type="Script" id=8]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 4, 16 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 10, 200 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 320, 10 )
|
||||
|
||||
[node name="Pong" type="Node2D"]
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
margin_right = 640.0
|
||||
margin_bottom = 400.0
|
||||
color = Color( 0.141176, 0.152941, 0.164706, 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Left" type="Area2D" parent="."]
|
||||
position = Vector2( 67.6285, 192.594 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Left"]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="Left"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Right" type="Area2D" parent="."]
|
||||
position = Vector2( 563.815, 188.919 )
|
||||
script = ExtResource( 1 )
|
||||
ball_dir = -1.0
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Right"]
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="Right"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Ball" type="Area2D" parent="."]
|
||||
position = Vector2( 320.5, 191.124 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Ball"]
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="Ball"]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Separator" type="Sprite" parent="."]
|
||||
position = Vector2( 320, 200 )
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="LeftWall" type="Area2D" parent="."]
|
||||
position = Vector2( -10, 200 )
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="LeftWall"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="RightWall" type="Area2D" parent="."]
|
||||
position = Vector2( 650, 200 )
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="RightWall"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Ceiling" type="Area2D" parent="."]
|
||||
position = Vector2( 320, -10 )
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="Ceiling"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Floor" type="Area2D" parent="."]
|
||||
position = Vector2( 320, 410 )
|
||||
script = ExtResource( 8 )
|
||||
bounce_direction = -1.0
|
||||
|
||||
[node name="Collision" type="CollisionShape2D" parent="Floor"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2( 320, 200 )
|
||||
current = true
|
||||
[connection signal="area_entered" from="Left" to="Left" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="Right" to="Right" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="LeftWall" to="LeftWall" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="RightWall" to="RightWall" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="Ceiling" to="Ceiling" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="Floor" to="Floor" method="_on_area_entered"]
|
||||
@@ -15,7 +15,7 @@ _global_script_class_icons={
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Visual Pong"
|
||||
config/name="Pong with VisualScript"
|
||||
run/main_scene="pong.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
@@ -36,22 +36,31 @@ singletons=[ ]
|
||||
left_move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":89,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
left_move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right_move_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
right_move_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
BIN
visual_script/pong/scripts/ball.vs
Normal file
BIN
visual_script/pong/scripts/ceiling_floor.vs
Normal file
BIN
visual_script/pong/scripts/paddle.vs
Normal file
BIN
visual_script/pong/scripts/wall.vs
Normal file
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
@@ -1,106 +0,0 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://paddle.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://ball.vs" type="Script" id=4]
|
||||
[ext_resource path="res://ball.png" type="Texture" id=5]
|
||||
[ext_resource path="res://separator.png" type="Texture" id=6]
|
||||
[ext_resource path="res://wall.vs" type="Script" id=7]
|
||||
[ext_resource path="res://ceiling_floor.vs" type="Script" id=8]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 4, 16 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 10, 200 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 320, 10 )
|
||||
|
||||
[node name="game" type="Node2D"]
|
||||
|
||||
[node name="TextureRect" type="ColorRect" parent="."]
|
||||
margin_right = 640.0
|
||||
margin_bottom = 400.0
|
||||
color = Color( 0.141176, 0.152941, 0.164706, 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="left" type="Area2D" parent="."]
|
||||
position = Vector2( 67.6285, 192.594 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="sprite" type="Sprite" parent="left"]
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="left"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="right" type="Area2D" parent="."]
|
||||
position = Vector2( 563.815, 188.919 )
|
||||
script = ExtResource( 1 )
|
||||
ball_dir = -1.0
|
||||
|
||||
[node name="sprite" type="Sprite" parent="right"]
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="right"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="ball" type="Area2D" parent="."]
|
||||
position = Vector2( 320.5, 191.124 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="sprite" type="Sprite" parent="ball"]
|
||||
texture = ExtResource( 5 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="ball"]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="separator" type="Sprite" parent="."]
|
||||
position = Vector2( 320, 200 )
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="left_wall" type="Area2D" parent="."]
|
||||
position = Vector2( -10, 200 )
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="left_wall"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="right_wall" type="Area2D" parent="."]
|
||||
position = Vector2( 650, 200 )
|
||||
script = ExtResource( 7 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="right_wall"]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="ceiling" type="Area2D" parent="."]
|
||||
position = Vector2( 320, -10 )
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="ceiling"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="floor" type="Area2D" parent="."]
|
||||
position = Vector2( 320, 410 )
|
||||
script = ExtResource( 8 )
|
||||
y_direction = -1.0
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="floor"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
offset = Vector2( 320, 200 )
|
||||
current = true
|
||||
[connection signal="area_entered" from="left" to="left" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="right" to="right" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="left_wall" to="left_wall" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="right_wall" to="right_wall" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="ceiling" to="ceiling" method="_on_area_entered"]
|
||||
[connection signal="area_entered" from="floor" to="floor" method="_on_area_entered"]
|
||||