Commit c898ca36 authored by Nathan Lovato's avatar Nathan Lovato
Browse files

Add infinite fence

parent 0004da18
......@@ -6,8 +6,8 @@
[ext_resource path="res://assets/ground.png" type="Texture" id=4]
[ext_resource path="res://PillarSpawner/PillarSpawner.tscn" type="PackedScene" id=5]
[ext_resource path="res://Gnu/Gnu.tscn" type="PackedScene" id=6]
[ext_resource path="res://assets/fence.png" type="Texture" id=7]
[ext_resource path="res://SpriteSpawner/SpriteSpawner.gd" type="Script" id=8]
[ext_resource path="res://SpriteSpawner/SpriteSpawner.gd" type="Script" id=7]
[ext_resource path="res://SpriteSpawner/Fence.tscn" type="PackedScene" id=8]
[ext_resource path="res://SpriteSpawner/GroundSprite.tscn" type="PackedScene" id=9]
[node name="Game" type="Node2D"]
......@@ -29,7 +29,6 @@ scale = Vector2( 0.66, 1 )
transform = Transform2D( 0.66, 0, 0, 1, 0, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground2"]
visible = false
[node name="ground2" type="Sprite" parent="ParallaxBackground2/ParallaxLayer"]
modulate = Color( 0.878431, 0.286275, 0.643137, 1 )
......@@ -42,7 +41,6 @@ scale = Vector2( 0.8, 1 )
transform = Transform2D( 0.8, 0, 0, 1, 0, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
visible = false
[node name="ground3" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
modulate = Color( 0.760784, 0.0980392, 0.494118, 1 )
......@@ -56,15 +54,19 @@ position = Vector2( 0, 950 )
position = Vector2( 190, 960 )
z_index = 1
[node name="fence" type="Sprite" parent="."]
position = Vector2( 533.5, 1607.5 )
texture = ExtResource( 7 )
[node name="FenceSpawner" type="Node2D" parent="."]
z_index = 100
script = ExtResource( 7 )
sprite_scene = ExtResource( 8 )
[node name="SpawnPosition" type="Position2D" parent="FenceSpawner"]
position = Vector2( -100, 1660 )
[node name="GroundSpawner" type="Node2D" parent="."]
z_index = 100
script = ExtResource( 8 )
script = ExtResource( 7 )
sprite_scene = ExtResource( 9 )
[node name="SpawnPosition" type="Position2D" parent="GroundSpawner"]
position = Vector2( -100, 1920 )
position = Vector2( -100, 1960 )
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/fence.png" type="Texture" id=1]
[node name="Fence" type="Sprite"]
texture = ExtResource( 1 )
offset = Vector2( 533.5, -60 )
......@@ -13,10 +13,9 @@ var WINDOW_WIDTH : int = ProjectSettings.get('display/window/size/width')
func _ready() -> void:
assert sprite_scene
if Engine.editor_hint:
if not sprite_scene:
return
add_child(sprite_scene.instance())
spawn_position.add_child(sprite_scene.instance())
else:
var sprite : Sprite = sprite_scene.instance()
var amount_to_fill_screen = ceil(WINDOW_WIDTH / sprite.texture.get_width())
......@@ -29,5 +28,5 @@ func spawn_sprite() -> void:
var sprite : Sprite = sprite_scene.instance()
sprite.connect("tree_exited", self, "spawn_sprite")
sprite.position = spawn_position.position
call_deferred("add_child", sprite)
add_child(sprite)
spawn_position.position.x += sprite.texture.get_width()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment