mirror of
https://github.com/Steffo99/looping-for-loops.git
synced 2024-11-21 23:54:23 +00:00
❇️ Add tentative ScrollingBlock
This commit is contained in:
parent
9cb35030f2
commit
fb70634b66
11 changed files with 253 additions and 13 deletions
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Scenes/Player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Scenes/Player.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://Scenes/Conductor.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Scenes/Conductor.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://Scenes/ConveyorBelt.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://Scenes/ConveyorBelt.tscn" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://Scenes/Obstacles/ScrollingBlock.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ song_offset = 200000.0
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 622.258, 379.938 )
|
position = Vector2( 622.258, 379.938 )
|
||||||
|
jump_buffer_msec = 80.0
|
||||||
|
|
||||||
[node name="ConveyorBelt" parent="." instance=ExtResource( 3 )]
|
[node name="ConveyorBelt" parent="." instance=ExtResource( 3 )]
|
||||||
position = Vector2( 640, 700 )
|
position = Vector2( 640, 700 )
|
||||||
|
@ -19,3 +21,33 @@ conveyor_speed = 100.0
|
||||||
[node name="ConveyorBelt2" parent="." instance=ExtResource( 3 )]
|
[node name="ConveyorBelt2" parent="." instance=ExtResource( 3 )]
|
||||||
position = Vector2( 640, 20 )
|
position = Vector2( 640, 20 )
|
||||||
conveyor_speed = -100.0
|
conveyor_speed = -100.0
|
||||||
|
|
||||||
|
[node name="ScrollingBlock" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 980, 660 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock3" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 980, 620 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock4" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 1020, 620 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock6" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 1020, 580 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock5" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 1020, 660 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock2" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 940, 660 )
|
||||||
|
collision_mask = 2147483650
|
||||||
|
scroll_velocity = Vector2( -100, 0 )
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
[gd_scene format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[ext_resource path="res://Sprites/scrolling_block.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Scripts/Obstacles/ScrollingBlock.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
|
extents = Vector2( 20, 20 )
|
||||||
|
|
||||||
|
[node name="ScrollingBlock" type="KinematicBody2D"]
|
||||||
|
collision_layer = 8
|
||||||
|
collision_mask = 2
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource( 1 )
|
||||||
|
|
12
Scripts/Obstacles/ScrollingBlock.gd
Normal file
12
Scripts/Obstacles/ScrollingBlock.gd
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
extends ExtendedKinematicBody2D
|
||||||
|
class_name ScrollingBlock
|
||||||
|
|
||||||
|
|
||||||
|
export(Vector2) var scroll_velocity: Vector2 = Vector2(-10, 0)
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
# FIXME: This doesn't really work... Any other things we could try?
|
||||||
|
var collision = move_and_collide(scroll_velocity * delta)
|
||||||
|
if collision:
|
||||||
|
print(collision)
|
|
@ -15,9 +15,11 @@ var jump_buffer: int = 0
|
||||||
var is_quick_falling: bool = false
|
var is_quick_falling: bool = false
|
||||||
var quick_fall_buffer: int = 0
|
var quick_fall_buffer: int = 0
|
||||||
|
|
||||||
|
func up_normal():
|
||||||
|
return -gravity.normalized()
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
var up_normal = -gravity.normalized()
|
var up_normal = up_normal()
|
||||||
var floor_normal = get_floor_normal()
|
var floor_normal = get_floor_normal()
|
||||||
|
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
|
@ -58,4 +60,8 @@ func _physics_process(delta):
|
||||||
if Input.is_action_pressed("plr_right"):
|
if Input.is_action_pressed("plr_right"):
|
||||||
movement += Vector2.RIGHT * move_speed
|
movement += Vector2.RIGHT * move_speed
|
||||||
|
|
||||||
move_and_slide(movement, up_normal)
|
player_move(movement)
|
||||||
|
|
||||||
|
|
||||||
|
func player_move(movement):
|
||||||
|
move_and_slide(movement, up_normal())
|
||||||
|
|
34
Sprites/button.png.import
Normal file
34
Sprites/button.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/button.png-877ac5cd2b80fdc0cebdbf31a84881c2.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/button.png"
|
||||||
|
dest_files=[ "res://.import/button.png-877ac5cd2b80fdc0cebdbf31a84881c2.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
34
Sprites/button_left.png.import
Normal file
34
Sprites/button_left.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/button_left.png-206fbca05b2d52e70c9e97e1821d0246.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/button_left.png"
|
||||||
|
dest_files=[ "res://.import/button_left.png-206fbca05b2d52e70c9e97e1821d0246.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
34
Sprites/button_right.png.import
Normal file
34
Sprites/button_right.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/button_right.png-8030242b7555d3b0634c117bb992b3f8.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/button_right.png"
|
||||||
|
dest_files=[ "res://.import/button_right.png-8030242b7555d3b0634c117bb992b3f8.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
34
Sprites/red_button.png.import
Normal file
34
Sprites/red_button.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/red_button.png-414b3db90d1cea22521067e11dd7d149.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/red_button.png"
|
||||||
|
dest_files=[ "res://.import/red_button.png-414b3db90d1cea22521067e11dd7d149.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
Sprites/scrolling_block.png
(Stored with Git LFS)
Normal file
BIN
Sprites/scrolling_block.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/scrolling_block.png.import
Normal file
34
Sprites/scrolling_block.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/scrolling_block.png-8ffa2a5bdae1a814eec757ce2af9b35f.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/scrolling_block.png"
|
||||||
|
dest_files=[ "res://.import/scrolling_block.png-8ffa2a5bdae1a814eec757ce2af9b35f.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
|
@ -28,12 +28,18 @@ _global_script_classes=[ {
|
||||||
"class": "Player",
|
"class": "Player",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://Scripts/Player.gd"
|
"path": "res://Scripts/Player.gd"
|
||||||
|
}, {
|
||||||
|
"base": "ExtendedKinematicBody2D",
|
||||||
|
"class": "ScrollingBlock",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://Scripts/Obstacles/ScrollingBlock.gd"
|
||||||
} ]
|
} ]
|
||||||
_global_script_class_icons={
|
_global_script_class_icons={
|
||||||
"Conductor": "",
|
"Conductor": "",
|
||||||
"ConveyorBelt": "",
|
"ConveyorBelt": "",
|
||||||
"ExtendedKinematicBody2D": "",
|
"ExtendedKinematicBody2D": "",
|
||||||
"Player": ""
|
"Player": "",
|
||||||
|
"ScrollingBlock": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
@ -53,12 +59,7 @@ plr_up={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||||
}
|
|
||||||
plr_down={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
plr_left={
|
plr_left={
|
||||||
|
@ -80,6 +81,7 @@ plr_right={
|
||||||
2d_physics/layer_1="Default"
|
2d_physics/layer_1="Default"
|
||||||
2d_physics/layer_2="Player"
|
2d_physics/layer_2="Player"
|
||||||
2d_physics/layer_3="Conveyor Belt"
|
2d_physics/layer_3="Conveyor Belt"
|
||||||
|
2d_physics/layer_4="Obstacles"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue