1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-25 01:24:21 +00:00

❇️ Add object wrapping

This commit is contained in:
Steffo 2020-10-04 17:29:28 +02:00
parent d4dbb4c55c
commit f8f935a99a
15 changed files with 89 additions and 51 deletions

View file

@ -1,13 +1,11 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Objects/SpecialObjects/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Objects/SpecialObjects/Conductor.tscn" type="PackedScene" id=2]
[ext_resource path="res://Objects/ConveyorBelt/ConveyorBelt.tscn" type="PackedScene" id=3]
[ext_resource path="res://Objects/SpecialObjects/SingleScreenWalls.tscn" type="PackedScene" id=4]
[ext_resource path="res://Objects/ScrollingObjects/Press.tscn" type="PackedScene" id=5]
[ext_resource path="res://Objects/ScrollingObjects/ScrollingPipe.tscn" type="PackedScene" id=6]
[ext_resource path="res://Objects/ScrollingObjects/Buzzsaw.tscn" type="PackedScene" id=7]
[ext_resource path="res://Objects/ScrollingObjects/ScrollingPipesTileMap.tscn" type="PackedScene" id=8]
[ext_resource path="res://Objects/SpecialObjects/Wrapper.tscn" type="PackedScene" id=5]
[ext_resource path="res://Objects/ScrollingObjects/ScrollingBlock.tscn" type="PackedScene" id=6]
[node name="Main" type="Node2D"]
__meta__ = {
@ -16,45 +14,21 @@ __meta__ = {
[node name="Conductor" parent="." instance=ExtResource( 2 )]
[node name="Wrapper" parent="." instance=ExtResource( 5 )]
[node name="SingleScreenWalls" parent="." instance=ExtResource( 4 )]
[node name="ConveyorBelt" parent="." instance=ExtResource( 3 )]
position = Vector2( 640, 700 )
cb_speed = 100.0
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 340, 500 )
[node name="Buzzsaw" parent="." instance=ExtResource( 7 )]
position = Vector2( 1000, 540 )
[node name="ScrollingBlock" parent="." instance=ExtResource( 6 )]
position = Vector2( 700, 660 )
[node name="Buzzsaw2" parent="." instance=ExtResource( 7 )]
position = Vector2( 1160, 540 )
[node name="ScrollingBlock2" parent="." instance=ExtResource( 6 )]
position = Vector2( 840, 660 )
[node name="Buzzsaw4" parent="." instance=ExtResource( 7 )]
position = Vector2( 1840, 540 )
[node name="Buzzsaw5" parent="." instance=ExtResource( 7 )]
position = Vector2( 2140, 660 )
[node name="Buzzsaw6" parent="." instance=ExtResource( 7 )]
position = Vector2( 2280, 660 )
[node name="Buzzsaw7" parent="." instance=ExtResource( 7 )]
position = Vector2( 2640, 580 )
[node name="Buzzsaw8" parent="." instance=ExtResource( 7 )]
position = Vector2( 2980, 260 )
[node name="Buzzsaw3" parent="." instance=ExtResource( 7 )]
position = Vector2( 1080, 540 )
[node name="ScrollingPipe" parent="." instance=ExtResource( 6 )]
position = Vector2( 840, 540 )
[node name="TileMap" parent="ScrollingPipe" instance=ExtResource( 8 )]
position = Vector2( 20, -20 )
tile_data = PoolIntArray( -524237, 0, 65536, -524234, 0, 65536, -458711, 0, 0, -458710, 0, 1, -458704, 0, 0, -458703, 0, 1, -458701, 0, 65536, -458698, 0, 65536, -458696, 0, 0, -458695, 0, 1, -393179, 0, 0, -393178, 0, 1, -393175, 0, 131072, -393174, 0, 131073, -393170, 0, 0, -393169, 0, 65537, -393168, 0, 131073, -393167, 0, 65536, -393165, 0, 65536, -393162, 0, 65536, -393160, 0, 65536, -393159, 0, 131072, -393158, 0, 65537, -393157, 0, 1, -327647, 0, 0, -327646, 0, 1, -327643, 0, 131072, -327642, 0, 131073, -327634, 0, 65536, -327631, 0, 65536, -327629, 0, 131072, -327628, 0, 65537, -327627, 0, 65537, -327626, 0, 131073, -327624, 0, 65536, -327621, 0, 65536, -262118, 0, 0, -262117, 0, 65537, -262116, 0, 65537, -262115, 0, 65537, -262114, 0, 1, -262111, 0, 131072, -262110, 0, 131073, -262098, 0, 65536, -262095, 0, 131072, -262094, 0, 65537, -262093, 0, 65537, -262092, 0, 65537, -262091, 0, 65537, -262090, 0, 65537, -262089, 0, 65537, -262088, 0, 131073, -262085, 0, 65536, -196582, 0, 65536, -196578, 0, 65536, -196562, 0, 65536, -196549, 0, 65536, -131046, 0, 65536, -131042, 0, 65536, -131026, 0, 65536, -1, 0, 0, -65536, 0, 65537, -65535, 0, 65537, -65527, 0, 65537, -65526, 0, 65537, -65525, 0, 1, -65518, 0, 0, -65517, 0, 65537, -65516, 0, 65537, -65515, 0, 65537, -65514, 0, 1, -65510, 0, 65536, -65506, 0, 65536, -65490, 0, 65536, -65484, 0, 0, -65483, 0, 1, 65535, 0, 65536, 11, 0, 65536, 17, 0, 0, 18, 0, 131073, 22, 0, 65536, 26, 0, 65536, 30, 0, 65536, 46, 0, 65536, 47, 0, 0, 48, 0, 65537, 49, 0, 65537, 50, 0, 65537, 51, 0, 65537, 52, 0, 131073, 53, 0, 131072, 54, 0, 65537, 55, 0, 65537, 56, 0, 65537, 57, 0, 1, 59, 0, 0, 60, 0, 1, 131071, 0, 65536, 65547, 0, 65536, 65552, 0, 0, 65553, 0, 131073, 65558, 0, 65536, 65561, 0, 0, 65562, 0, 131073, 65566, 0, 65536, 65582, 0, 65536, 65583, 0, 65536, 65593, 0, 65536, 65595, 0, 65536, 65596, 0, 65536, 65597, 0, 0, 65598, 0, 1, 196607, 0, 65536, 131083, 0, 65536, 131087, 0, 0, 131088, 0, 131073, 131094, 0, 65536, 131097, 0, 65536, 131102, 0, 65536, 131109, 0, 0, 131110, 0, 65537, 131111, 0, 65537, 131112, 0, 65537, 131113, 0, 65537, 131114, 0, 1, 131118, 0, 65536, 131119, 0, 65536, 131125, 0, 65537, 131126, 0, 65537, 131127, 0, 65537, 131128, 0, 65537, 131129, 0, 131073, 131131, 0, 65536, 131132, 0, 65536, 131133, 0, 65536, 131134, 0, 65536, 131135, 0, 0, 131136, 0, 1, 262143, 0, 65536, 196619, 0, 65536, 196622, 0, 0, 196623, 0, 131073, 196630, 0, 65536, 196633, 0, 65536, 196638, 0, 65536, 196645, 0, 65536, 196650, 0, 65536, 196654, 0, 65536, 196655, 0, 65536, 196667, 0, 65536, 196668, 0, 65536, 196669, 0, 65536, 196670, 0, 65536, 196671, 0, 65536, 196672, 0, 65536, 196673, 0, 0, 196674, 0, 1 )
[node name="Press" parent="." instance=ExtResource( 5 )]
position = Vector2( 3720, 0 )
[node name="ScrollingBlock3" parent="." instance=ExtResource( 6 )]
position = Vector2( 980, 660 )

View file

@ -1,8 +1,10 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Sprites/saw.png" type="Texture" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Buzzsaw.gd" type="Script" id=2]
[ext_resource path="res://Objects/ScrollingObjects/ConveyorScrollParent.tscn" type="PackedScene" id=3]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.tscn" type="PackedScene" id=3]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=4]
[sub_resource type="CircleShape2D" id=1]
radius = 71.9263
@ -27,7 +29,7 @@ tracks/0/keys = {
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
rotation = 5.1159
rotation = 3.58744
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
@ -37,3 +39,6 @@ shape = SubResource( 1 )
anims/SpinClockwise = SubResource( 2 )
[node name="ConveyorScrollParent" parent="." instance=ExtResource( 3 )]
[node name="WrapParent" parent="." instance=ExtResource( 4 )]
position = Vector2( 80, 0 )

View file

@ -1,8 +1,10 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Sprites/press_bottom.png" type="Texture" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Press.gd" type="Script" id=2]
[ext_resource path="res://Sprites/press_pipes.png" type="Texture" id=3]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=4]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.tscn" type="PackedScene" id=5]
[sub_resource type="Animation" id=1]
resource_name = "Stomp"
@ -91,3 +93,8 @@ disabled = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, 76.5 )
[node name="ConveyorScrollParent" parent="." instance=ExtResource( 5 )]
[node name="WrapParent" parent="." instance=ExtResource( 4 )]
position = Vector2( 80, 0 )

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Sprites/crate.png" type="Texture" id=1]
[ext_resource path="res://Objects/ScrollingObjects/ConveyorScrollParent.tscn" type="PackedScene" id=2]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.tscn" type="PackedScene" id=2]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 20, 20 )
@ -18,3 +19,6 @@ texture = ExtResource( 1 )
shape = SubResource( 1 )
[node name="ConveyorScrollParent" parent="." instance=ExtResource( 2 )]
[node name="WrapParent" parent="." instance=ExtResource( 3 )]
position = Vector2( 24, 0 )

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Objects/ScrollingObjects/ConveyorScrollParent.tscn" type="PackedScene" id=2]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.tscn" type="PackedScene" id=2]
[node name="ScrollingPipe" type="KinematicBody2D"]
collision_layer = 8
@ -8,3 +9,5 @@ collision_mask = 2
motion/sync_to_physics = true
[node name="ConveyorScrollParent" parent="." instance=ExtResource( 2 )]
[node name="WrapParent" parent="." instance=ExtResource( 1 )]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Objects/ScrollingObjects/ConveyorScrollParent.gd" type="Script" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.gd" type="Script" id=1]
[node name="ConveyorScrollParent" type="Node"]
script = ExtResource( 1 )

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Objects/ScrollingObjects/ScrollParent.gd" type="Script" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/ScrollParent.gd" type="Script" id=1]
[node name="ScrollParent" type="Node"]
script = ExtResource( 1 )

View file

@ -0,0 +1,12 @@
extends Node2D
class_name WrapParent
onready var parent: Node2D = get_parent()
onready var wrapper: Wrapper = get_tree().current_scene.get_node("Wrapper")
onready var absolute_position: Vector2 = parent.position
func _physics_process(delta):
if global_position.x <= 0:
parent.position.x += wrapper.total_length

View file

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.gd" type="Script" id=1]
[node name="WrapParent" type="Node2D"]
script = ExtResource( 1 )

View file

@ -0,0 +1,5 @@
extends Node
class_name Wrapper
export(float, 1500, 20000) var total_length: float = 1500

View file

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Objects/SpecialObjects/Wrapper.gd" type="Script" id=1]
[node name="Wrapper" type="Node"]
script = ExtResource( 1 )
total_length = 1500.0

View file

@ -27,7 +27,7 @@ _global_script_classes=[ {
"base": "ScrollParent",
"class": "ConveyorScrollParent",
"language": "GDScript",
"path": "res://Objects/ScrollingObjects/ConveyorScrollParent.gd"
"path": "res://Objects/ScrollingObjects/Utilities/ConveyorScrollParent.gd"
}, {
"base": "KinematicBody2D",
"class": "Player",
@ -42,12 +42,22 @@ _global_script_classes=[ {
"base": "Node",
"class": "ScrollParent",
"language": "GDScript",
"path": "res://Objects/ScrollingObjects/ScrollParent.gd"
"path": "res://Objects/ScrollingObjects/Utilities/ScrollParent.gd"
}, {
"base": "ScrollingObject2D",
"class": "ScrollingArea",
"language": "GDScript",
"path": "res://ScrollingArea.gd"
}, {
"base": "Node2D",
"class": "WrapParent",
"language": "GDScript",
"path": "res://Objects/ScrollingObjects/Utilities/WrapParent.gd"
}, {
"base": "Node",
"class": "Wrapper",
"language": "GDScript",
"path": "res://Objects/SpecialObjects/Wrapper.gd"
} ]
_global_script_class_icons={
"Buzzsaw": "",
@ -57,13 +67,15 @@ _global_script_class_icons={
"Player": "",
"Press": "",
"ScrollParent": "",
"ScrollingArea": ""
"ScrollingArea": "",
"WrapParent": "",
"Wrapper": ""
}
[application]
config/name="ld47"
run/main_scene="res://Objects/SpecialObjects/Main.tscn"
run/main_scene="res://Objects/Main.tscn"
[display]