diff options
Diffstat (limited to 'demos/2d/fog_of_war')
-rw-r--r-- | demos/2d/fog_of_war/engine.cfg | 12 | ||||
-rw-r--r-- | demos/2d/fog_of_war/floor.png | bin | 572 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/fog.gd | 78 | ||||
-rw-r--r-- | demos/2d/fog_of_war/fog.png | bin | 31448 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/fog.scn | bin | 4159 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/fog.xml | 29 | ||||
-rw-r--r-- | demos/2d/fog_of_war/icon.png | bin | 8681 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/tile_edit.scn | bin | 1570 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/troll.gd | 38 | ||||
-rw-r--r-- | demos/2d/fog_of_war/troll.png | bin | 7246 -> 0 bytes | |||
-rw-r--r-- | demos/2d/fog_of_war/troll.scn | bin | 1979 -> 0 bytes |
11 files changed, 0 insertions, 157 deletions
diff --git a/demos/2d/fog_of_war/engine.cfg b/demos/2d/fog_of_war/engine.cfg deleted file mode 100644 index 1f56851c58..0000000000 --- a/demos/2d/fog_of_war/engine.cfg +++ /dev/null @@ -1,12 +0,0 @@ -[application] - -name="Fog of War" -main_scene="res://fog.scn" -icon="res://icon.png" - -[input] - -move_up=[key(Up)] -move_bottom=[key(Down)] -move_left=[key(Left)] -move_right=[key(Right)] diff --git a/demos/2d/fog_of_war/floor.png b/demos/2d/fog_of_war/floor.png Binary files differdeleted file mode 100644 index 07b4f8c98f..0000000000 --- a/demos/2d/fog_of_war/floor.png +++ /dev/null diff --git a/demos/2d/fog_of_war/fog.gd b/demos/2d/fog_of_war/fog.gd deleted file mode 100644 index 3ac8df0e17..0000000000 --- a/demos/2d/fog_of_war/fog.gd +++ /dev/null @@ -1,78 +0,0 @@ - -extends TileMap - -# Member variables - -# Boundaries for the fog rectangle -var x_min = -20 # Left start tile -var x_max = 20 # Right end tile -var y_min = -20 # Top start tile -var y_max = 20 # Bottom end tile - -var position # Player's position - -# Iteration variables -var x -var y - -# Variables to check if the player moved -var x_old -var y_old - -# Array to build up the visible area like a square. -# First value determines the width/height of the tip. -# Here it would be 2*2 + 1 = 5 tiles wide/high. -# Second value determines the total squares size. -# Here it would be 5*2 + 1 = 10 tiles wide/high. -var l = range(2, 5) - - -# Process that runs in realtime -func _fixed_process(delta): - position = get_node("../troll").get_pos() - - # Calculate the corresponding tile - # from the players position - x = int(position.x/get_cell_size().x) - # Switching from positive to negative tile positions - # causes problems because of rounding problems - if position.x < 0: - x -= 1 # Correct negative values - - y = int(position.y/get_cell_size().y) - if (position.y < 0): - y -= 1 - - # Check if the player moved one tile further - if ((x_old != x) or (y_old != y)): - # Create the transparent part (visited area) - var end = l.size() - 1 - var start = 0 - for steps in range(l.size()): - for m in range(x - l[end] - 1, x + l[end] + 2): - for n in range(y - l[start] - 1, y + l[start] + 2): - if (get_cell(m, n) != 0): - set_cell(m, n, 1, 0, 0) - end -= 1 - start += 1 - - # Create the actual and active visible part - var end = l.size() - 1 - var start = 0 - for steps in range(l.size()): - for m in range(x - l[end], x + l[end] + 1): - for n in range(y - l[start], y + l[start] + 1): - set_cell(m, n, -1) - end -= 1 - start += 1 - - x_old = x - y_old = y - - -func _ready(): - # Create a square filled with the 100% opaque fog - for x in range(x_min, x_max): - for y in range(y_min, y_max): - set_cell(x, y, 0, 0, 0) - set_fixed_process(true) diff --git a/demos/2d/fog_of_war/fog.png b/demos/2d/fog_of_war/fog.png Binary files differdeleted file mode 100644 index 56980c298d..0000000000 --- a/demos/2d/fog_of_war/fog.png +++ /dev/null diff --git a/demos/2d/fog_of_war/fog.scn b/demos/2d/fog_of_war/fog.scn Binary files differdeleted file mode 100644 index cf19601567..0000000000 --- a/demos/2d/fog_of_war/fog.scn +++ /dev/null diff --git a/demos/2d/fog_of_war/fog.xml b/demos/2d/fog_of_war/fog.xml deleted file mode 100644 index ed08d84a1f..0000000000 --- a/demos/2d/fog_of_war/fog.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<resource_file type="TileSet" subresource_count="3" version="1.0" version_name="Godot Engine v1.0.stable.custom_build"> - <ext_resource path="res://floor.png" type="Texture"></ext_resource> - <ext_resource path="res://fog.png" type="Texture"></ext_resource> - <main_resource> - <string name="0/name"> "fog opaque" </string> - <resource name="0/texture" resource_type="Texture" path="res://fog.png"> </resource> - <vector2 name="0/tex_offset"> -48, -48 </vector2> - <vector2 name="0/shape_offset"> 0, 0 </vector2> - <rect2 name="0/region"> 0, 0, 144, 144 </rect2> - <array name="0/shapes" len="0" shared="false"> - </array> - <string name="1/name"> "fog transparent" </string> - <resource name="1/texture" resource_type="Texture" path="res://fog.png"> </resource> - <vector2 name="1/tex_offset"> -48, -48 </vector2> - <vector2 name="1/shape_offset"> 0, 0 </vector2> - <rect2 name="1/region"> 144, 0, 144, 144 </rect2> - <array name="1/shapes" len="0" shared="false"> - </array> - <string name="2/name"> "floor" </string> - <resource name="2/texture" resource_type="Texture" path="res://floor.png"> </resource> - <vector2 name="2/tex_offset"> 0, 0 </vector2> - <vector2 name="2/shape_offset"> 0, 0 </vector2> - <rect2 name="2/region"> 0, 0, 0, 0 </rect2> - <array name="2/shapes" len="0" shared="false"> - </array> - - </main_resource> -</resource_file>
\ No newline at end of file diff --git a/demos/2d/fog_of_war/icon.png b/demos/2d/fog_of_war/icon.png Binary files differdeleted file mode 100644 index a483390048..0000000000 --- a/demos/2d/fog_of_war/icon.png +++ /dev/null diff --git a/demos/2d/fog_of_war/tile_edit.scn b/demos/2d/fog_of_war/tile_edit.scn Binary files differdeleted file mode 100644 index 3eddf38e48..0000000000 --- a/demos/2d/fog_of_war/tile_edit.scn +++ /dev/null diff --git a/demos/2d/fog_of_war/troll.gd b/demos/2d/fog_of_war/troll.gd deleted file mode 100644 index 6f40072e84..0000000000 --- a/demos/2d/fog_of_war/troll.gd +++ /dev/null @@ -1,38 +0,0 @@ - -extends KinematicBody2D - -# This is a simple collision demo showing how -# the kinematic controller works. -# move() will allow to move the node, and will -# always move it to a non-colliding spot, -# as long as it starts from a non-colliding spot too. - -# Member variables -const MOTION_SPEED = 160 # Pixels/second - - -func _fixed_process(delta): - var motion = Vector2() - - if (Input.is_action_pressed("move_up")): - motion += Vector2(0, -1) - if (Input.is_action_pressed("move_bottom")): - motion += Vector2(0, 1) - if (Input.is_action_pressed("move_left")): - motion += Vector2(-1, 0) - if (Input.is_action_pressed("move_right")): - motion += Vector2(1, 0) - - motion = motion.normalized()*MOTION_SPEED*delta - motion = move(motion) - - # Make character slide nicely through the world - var slide_attempts = 4 - while(is_colliding() and slide_attempts > 0): - motion = get_collision_normal().slide(motion) - motion = move(motion) - slide_attempts -= 1 - - -func _ready(): - set_fixed_process(true) diff --git a/demos/2d/fog_of_war/troll.png b/demos/2d/fog_of_war/troll.png Binary files differdeleted file mode 100644 index 69f195d034..0000000000 --- a/demos/2d/fog_of_war/troll.png +++ /dev/null diff --git a/demos/2d/fog_of_war/troll.scn b/demos/2d/fog_of_war/troll.scn Binary files differdeleted file mode 100644 index ab9af17221..0000000000 --- a/demos/2d/fog_of_war/troll.scn +++ /dev/null |