summaryrefslogtreecommitdiff
path: root/demos/2d/dynamic_collision_shapes
diff options
context:
space:
mode:
Diffstat (limited to 'demos/2d/dynamic_collision_shapes')
-rw-r--r--demos/2d/dynamic_collision_shapes/ball.gd21
-rw-r--r--demos/2d/dynamic_collision_shapes/ball.pngbin0 -> 321 bytes
-rw-r--r--demos/2d/dynamic_collision_shapes/ball.scnbin0 -> 1898 bytes
-rw-r--r--demos/2d/dynamic_collision_shapes/box.pngbin0 -> 253 bytes
-rw-r--r--demos/2d/dynamic_collision_shapes/circle.pngbin0 -> 889 bytes
-rw-r--r--demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd23
-rw-r--r--demos/2d/dynamic_collision_shapes/dynamic_colobjs.scnbin0 -> 4348 bytes
-rw-r--r--demos/2d/dynamic_collision_shapes/engine.cfg4
-rw-r--r--demos/2d/dynamic_collision_shapes/poly.pngbin0 -> 1638 bytes
9 files changed, 48 insertions, 0 deletions
diff --git a/demos/2d/dynamic_collision_shapes/ball.gd b/demos/2d/dynamic_collision_shapes/ball.gd
new file mode 100644
index 0000000000..c17b20f9c8
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/ball.gd
@@ -0,0 +1,21 @@
+
+extends RigidBody2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+var timeout=5
+
+func _process(delta):
+ timeout-=delta
+ if (timeout<1):
+ set_opacity(timeout)
+ if (timeout<0):
+ queue_free()
+func _ready():
+ set_process(true)
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/dynamic_collision_shapes/ball.png b/demos/2d/dynamic_collision_shapes/ball.png
new file mode 100644
index 0000000000..b7cf71da29
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/ball.png
Binary files differ
diff --git a/demos/2d/dynamic_collision_shapes/ball.scn b/demos/2d/dynamic_collision_shapes/ball.scn
new file mode 100644
index 0000000000..e332de276d
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/ball.scn
Binary files differ
diff --git a/demos/2d/dynamic_collision_shapes/box.png b/demos/2d/dynamic_collision_shapes/box.png
new file mode 100644
index 0000000000..f29b83ce38
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/box.png
Binary files differ
diff --git a/demos/2d/dynamic_collision_shapes/circle.png b/demos/2d/dynamic_collision_shapes/circle.png
new file mode 100644
index 0000000000..9fdfa550b1
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/circle.png
Binary files differ
diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
new file mode 100644
index 0000000000..a6a42a1914
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd
@@ -0,0 +1,23 @@
+
+extends Node2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+const EMIT_INTERVAL=0.1
+var timeout=EMIT_INTERVAL
+
+func _process(delta):
+ timeout-=delta
+ if (timeout<0):
+ timeout=EMIT_INTERVAL
+ var ball = preload("res://ball.scn").instance()
+ ball.set_pos( Vector2(randf() * get_viewport_rect().size.x, 0) )
+ add_child(ball)
+
+func _ready():
+ set_process(true)
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn
new file mode 100644
index 0000000000..e6d1ebf9cf
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn
Binary files differ
diff --git a/demos/2d/dynamic_collision_shapes/engine.cfg b/demos/2d/dynamic_collision_shapes/engine.cfg
new file mode 100644
index 0000000000..536b75f2f2
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Run-Time CollisionShape"
+main_scene="res://dynamic_colobjs.scn"
diff --git a/demos/2d/dynamic_collision_shapes/poly.png b/demos/2d/dynamic_collision_shapes/poly.png
new file mode 100644
index 0000000000..49ed55cc7d
--- /dev/null
+++ b/demos/2d/dynamic_collision_shapes/poly.png
Binary files differ