summaryrefslogtreecommitdiff
path: root/demos/2d/pong
diff options
context:
space:
mode:
Diffstat (limited to 'demos/2d/pong')
-rw-r--r--demos/2d/pong/ball.pngbin203 -> 0 bytes
-rw-r--r--demos/2d/pong/engine.cfg22
-rw-r--r--demos/2d/pong/icon.pngbin956 -> 0 bytes
-rw-r--r--demos/2d/pong/left_pallete.pngbin200 -> 0 bytes
-rw-r--r--demos/2d/pong/pong.gd67
-rw-r--r--demos/2d/pong/pong.xml191
-rw-r--r--demos/2d/pong/right_pallete.pngbin202 -> 0 bytes
-rw-r--r--demos/2d/pong/separator.pngbin203 -> 0 bytes
8 files changed, 0 insertions, 280 deletions
diff --git a/demos/2d/pong/ball.png b/demos/2d/pong/ball.png
deleted file mode 100644
index c0f6da4f6f..0000000000
--- a/demos/2d/pong/ball.png
+++ /dev/null
Binary files differ
diff --git a/demos/2d/pong/engine.cfg b/demos/2d/pong/engine.cfg
deleted file mode 100644
index 9e76449bcf..0000000000
--- a/demos/2d/pong/engine.cfg
+++ /dev/null
@@ -1,22 +0,0 @@
-[application]
-
-name="Pong"
-main_scene="pong.xml"
-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
diff --git a/demos/2d/pong/icon.png b/demos/2d/pong/icon.png
deleted file mode 100644
index eab34de53d..0000000000
--- a/demos/2d/pong/icon.png
+++ /dev/null
Binary files differ
diff --git a/demos/2d/pong/left_pallete.png b/demos/2d/pong/left_pallete.png
deleted file mode 100644
index f0d4b549d0..0000000000
--- a/demos/2d/pong/left_pallete.png
+++ /dev/null
Binary files differ
diff --git a/demos/2d/pong/pong.gd b/demos/2d/pong/pong.gd
deleted file mode 100644
index 81afbd9961..0000000000
--- a/demos/2d/pong/pong.gd
+++ /dev/null
@@ -1,67 +0,0 @@
-
-extends Node2D
-
-# Member variables
-const INITIAL_BALL_SPEED = 80
-var ball_speed = INITIAL_BALL_SPEED
-var screen_size = Vector2(640, 400)
-
-# Default ball direction
-var direction = Vector2(-1, 0)
-var pad_size = Vector2(8, 32)
-const PAD_SPEED = 150
-
-
-func _process(delta):
- # Get ball position and pad rectangles
- var ball_pos = get_node("ball").get_pos()
- var left_rect = Rect2(get_node("left").get_pos() - pad_size*0.5, pad_size)
- var right_rect = Rect2(get_node("right").get_pos() - pad_size*0.5, pad_size)
-
- # Integrate new ball postion
- ball_pos += direction*ball_speed*delta
-
- # Flip when touching roof or floor
- if ((ball_pos.y < 0 and direction.y < 0) or (ball_pos.y > screen_size.y and direction.y > 0)):
- direction.y = -direction.y
-
- # Flip, change direction and increase speed when touching pads
- if ((left_rect.has_point(ball_pos) and direction.x < 0) or (right_rect.has_point(ball_pos) and direction.x > 0)):
- direction.x = -direction.x
- ball_speed *= 1.1
- direction.y = randf()*2.0 - 1
- direction = direction.normalized()
-
- # Check gameover
- if (ball_pos.x < 0 or ball_pos.x > screen_size.x):
- ball_pos = screen_size*0.5
- ball_speed = INITIAL_BALL_SPEED
- direction = Vector2(-1, 0)
-
- get_node("ball").set_pos(ball_pos)
-
- # Move left pad
- var left_pos = get_node("left").get_pos()
-
- if (left_pos.y > 0 and Input.is_action_pressed("left_move_up")):
- left_pos.y += -PAD_SPEED*delta
- if (left_pos.y < screen_size.y and Input.is_action_pressed("left_move_down")):
- left_pos.y += PAD_SPEED*delta
-
- get_node("left").set_pos(left_pos)
-
- # Move right pad
- var right_pos = get_node("right").get_pos()
-
- if (right_pos.y > 0 and Input.is_action_pressed("right_move_up")):
- right_pos.y += -PAD_SPEED*delta
- if (right_pos.y < screen_size.y and Input.is_action_pressed("right_move_down")):
- right_pos.y += PAD_SPEED*delta
-
- get_node("right").set_pos(right_pos)
-
-
-func _ready():
- screen_size = get_viewport_rect().size # Get actual size
- pad_size = get_node("left").get_texture().get_size()
- set_process(true)
diff --git a/demos/2d/pong/pong.xml b/demos/2d/pong/pong.xml
deleted file mode 100644
index 2189be7c62..0000000000
--- a/demos/2d/pong/pong.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<resource_file type="PackedScene" subresource_count="6" version="2.0" version_name="Godot Engine v2.0.alpha.custom_build">
- <ext_resource path="res://pong.gd" type="Script" index="0"></ext_resource>
- <ext_resource path="res://left_pallete.png" type="Texture" index="1"></ext_resource>
- <ext_resource path="res://separator.png" type="Texture" index="3"></ext_resource>
- <ext_resource path="res://right_pallete.png" type="Texture" index="2"></ext_resource>
- <ext_resource path="res://ball.png" type="Texture" index="4"></ext_resource>
- <main_resource>
- <dictionary name="_bundled" shared="false">
- <string> "conn_count" </string>
- <int> 0 </int>
- <string> "conns" </string>
- <int_array len="0"> </int_array>
- <string> "editable_instances" </string>
- <array len="0" shared="false">
- </array>
- <string> "names" </string>
- <string_array len="11">
- <string> "game" </string>
- <string> "script/script" </string>
- <string> "__meta__" </string>
- <string> "Node2D" </string>
- <string> "left" </string>
- <string> "transform/pos" </string>
- <string> "texture" </string>
- <string> "Sprite" </string>
- <string> "right" </string>
- <string> "separator" </string>
- <string> "ball" </string>
- </string_array>
- <string> "node_count" </string>
- <int> 5 </int>
- <string> "node_paths" </string>
- <array len="0" shared="false">
- </array>
- <string> "nodes" </string>
- <int_array len="55"> -1, -1, 3, 0, -1, 2, 1, 0, 2, 1, 0, 0, 0, 7, 4, -1, 2, 5, 2, 6, 3, 0, 0, 0, 7, 8, -1, 2, 5, 4, 6, 5, 0, 0, 0, 7, 9, -1, 2, 5, 6, 6, 7, 0, 0, 0, 7, 10, -1, 2, 5, 8, 6, 9, 0 </int_array>
- <string> "variants" </string>
- <array len="10" shared="false">
- <resource external="0"> </resource>
- <dictionary shared="false">
- <string> "__editor_plugin_screen__" </string>
- <string> "Script" </string>
- <string> "__editor_plugin_states__" </string>
- <dictionary shared="false">
- <string> "2D" </string>
- <dictionary shared="false">
- <string> "ofs" </string>
- <vector2> -54.59, -36.0052 </vector2>
- <string> "snap_grid" </string>
- <bool> False </bool>
- <string> "snap_offset" </string>
- <vector2> 0, 0 </vector2>
- <string> "snap_pixel" </string>
- <bool> False </bool>
- <string> "snap_relative" </string>
- <bool> False </bool>
- <string> "snap_rotation" </string>
- <bool> False </bool>
- <string> "snap_rotation_offset" </string>
- <real> 0 </real>
- <string> "snap_rotation_step" </string>
- <real> 0.261799 </real>
- <string> "snap_show_grid" </string>
- <bool> False </bool>
- <string> "snap_step" </string>
- <vector2> 10, 10 </vector2>
- <string> "zoom" </string>
- <real> 1.108033 </real>
- </dictionary>
- <string> "3D" </string>
- <dictionary shared="false">
- <string> "ambient_light_color" </string>
- <color> 0.15, 0.15, 0.15, 1 </color>
- <string> "default_light" </string>
- <bool> True </bool>
- <string> "default_srgb" </string>
- <bool> False </bool>
- <string> "deflight_rot_x" </string>
- <real> 0.942478 </real>
- <string> "deflight_rot_y" </string>
- <real> 0.628319 </real>
- <string> "fov" </string>
- <real> 45 </real>
- <string> "show_grid" </string>
- <bool> True </bool>
- <string> "show_origin" </string>
- <bool> True </bool>
- <string> "viewport_mode" </string>
- <int> 1 </int>
- <string> "viewports" </string>
- <array len="4" shared="false">
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "listener" </string>
- <bool> True </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "listener" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "listener" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- </dictionary>
- <dictionary shared="false">
- <string> "distance" </string>
- <real> 4 </real>
- <string> "listener" </string>
- <bool> False </bool>
- <string> "pos" </string>
- <vector3> 0, 0, 0 </vector3>
- <string> "use_environment" </string>
- <bool> False </bool>
- <string> "use_orthogonal" </string>
- <bool> False </bool>
- <string> "x_rot" </string>
- <real> 0 </real>
- <string> "y_rot" </string>
- <real> 0 </real>
- </dictionary>
- </array>
- <string> "zfar" </string>
- <real> 500 </real>
- <string> "znear" </string>
- <real> 0.1 </real>
- </dictionary>
- <string> "Anim" </string>
- <dictionary shared="false">
- <string> "visible" </string>
- <bool> False </bool>
- </dictionary>
- </dictionary>
- <string> "__editor_run_settings__" </string>
- <dictionary shared="false">
- <string> "custom_args" </string>
- <string> "-l $scene" </string>
- <string> "run_mode" </string>
- <int> 0 </int>
- </dictionary>
- </dictionary>
- <vector2> 67.6875, 183.208 </vector2>
- <resource external="1"> </resource>
- <vector2> 577, 187 </vector2>
- <resource external="2"> </resource>
- <vector2> 320, 200 </vector2>
- <resource external="3"> </resource>
- <vector2> 320.283, 188 </vector2>
- <resource external="4"> </resource>
- </array>
- <string> "version" </string>
- <int> 2 </int>
- </dictionary>
-
- </main_resource>
-</resource_file> \ No newline at end of file
diff --git a/demos/2d/pong/right_pallete.png b/demos/2d/pong/right_pallete.png
deleted file mode 100644
index 3cdb673a5b..0000000000
--- a/demos/2d/pong/right_pallete.png
+++ /dev/null
Binary files differ
diff --git a/demos/2d/pong/separator.png b/demos/2d/pong/separator.png
deleted file mode 100644
index 56874a59cb..0000000000
--- a/demos/2d/pong/separator.png
+++ /dev/null
Binary files differ