diff options
Diffstat (limited to 'demos/2d/dynamic_collision_shapes')
-rw-r--r-- | demos/2d/dynamic_collision_shapes/ball.gd | 18 | ||||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/ball.scn | bin | 1898 -> 1857 bytes | |||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd | 24 | ||||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn | bin | 4348 -> 4399 bytes |
4 files changed, 17 insertions, 25 deletions
diff --git a/demos/2d/dynamic_collision_shapes/ball.gd b/demos/2d/dynamic_collision_shapes/ball.gd index c17b20f9c8..169079ea46 100644 --- a/demos/2d/dynamic_collision_shapes/ball.gd +++ b/demos/2d/dynamic_collision_shapes/ball.gd @@ -1,21 +1,17 @@ extends RigidBody2D -# member variables here, example: -# var a=2 -# var b="textvar" +# Member variables +var timeout = 5 -var timeout=5 func _process(delta): - timeout-=delta - if (timeout<1): + timeout -= delta + if (timeout < 1): set_opacity(timeout) - if (timeout<0): + if (timeout < 0): queue_free() -func _ready(): - set_process(true) - # Initialization here - pass +func _ready(): + set_process(true) diff --git a/demos/2d/dynamic_collision_shapes/ball.scn b/demos/2d/dynamic_collision_shapes/ball.scn Binary files differindex e332de276d..51a91d5bc0 100644 --- a/demos/2d/dynamic_collision_shapes/ball.scn +++ b/demos/2d/dynamic_collision_shapes/ball.scn diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd index a6a42a1914..25db51642b 100644 --- a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd @@ -1,23 +1,19 @@ extends Node2D -# member variables here, example: -# var a=2 -# var b="textvar" -const EMIT_INTERVAL=0.1 -var timeout=EMIT_INTERVAL +# Member variables +const EMIT_INTERVAL = 0.1 +var timeout = EMIT_INTERVAL + func _process(delta): - timeout-=delta - if (timeout<0): - timeout=EMIT_INTERVAL + 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) ) + ball.set_pos(Vector2(randf()*get_viewport_rect().size.x, 0)) add_child(ball) - -func _ready(): - set_process(true) - # Initialization here - pass +func _ready(): + set_process(true) diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn Binary files differindex e6d1ebf9cf..6d17e2209f 100644 --- a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn |