mirror of
https://github.com/GDQuest/godot-platformer-2d.git
synced 2026-01-23 02:14:19 +00:00
Merge pull request #177 from henriiquecampos/fixes-and-tweaks
Fixes to Levels, background and debug
This commit is contained in:
commit
ad33cf98e0
10 changed files with 48 additions and 29 deletions
|
|
@ -290,6 +290,11 @@ DEBUG_die={
|
|||
"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":81,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
toggle_full_screen={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":16777244,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ extends Area2D
|
|||
|
||||
class_name DamageSource
|
||||
|
||||
export var damage: int = 1
|
||||
export var damage := 1
|
||||
export var is_instakill := false
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
class_name Hit
|
||||
|
||||
var damage := 0
|
||||
var is_instakill := false
|
||||
|
||||
func _init(source: DamageSource) -> void:
|
||||
damage = source.damage
|
||||
is_instakill = source.is_instakill
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ func _ready() -> void:
|
|||
func take_damage(hit: Hit) -> void:
|
||||
if invulnerable:
|
||||
return
|
||||
|
||||
|
||||
if hit.is_instakill:
|
||||
emit_signal("health_depleted")
|
||||
return
|
||||
|
||||
var old_health = health
|
||||
health -= hit.damage
|
||||
emit_signal("damage_taken")
|
||||
|
|
@ -58,8 +62,8 @@ func remove_modifier(id: int) -> void:
|
|||
|
||||
func set_invulnerable_for_seconds(time: float) -> void:
|
||||
invulnerable = true
|
||||
|
||||
|
||||
var timer := get_tree().create_timer(time)
|
||||
yield(timer, "timeout")
|
||||
|
||||
|
||||
invulnerable = false
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ gravity_point = true
|
|||
position = Vector2( 308.292, 985.772 )
|
||||
|
||||
[node name="Exit" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 576.472, 793.699 )
|
||||
position = Vector2( 184, 1081.39 )
|
||||
|
||||
[node name="Exit2" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 26256.7, 1535.41 )
|
||||
position = Vector2( 26256, 1648 )
|
||||
next_level_file_path = "res://src/Levels/Level2.tscn"
|
||||
|
|
|
|||
|
|
@ -111,4 +111,4 @@ gravity_point = true
|
|||
position = Vector2( 300.591, 913.335 )
|
||||
|
||||
[node name="Exit" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 28536.1, 1531.18 )
|
||||
position = Vector2( 28536, 1645.36 )
|
||||
|
|
|
|||
|
|
@ -1,29 +1,21 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/environment/background/cloud_big_1.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/environment/background/cloud_small_1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/environment/background/cloud_small_2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/environment/background/mountains.png" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="Gradient" id=1]
|
||||
offsets = PoolRealArray( 0, 0.813609 )
|
||||
colors = PoolColorArray( 0.184314, 0.564706, 0.831373, 1, 0.364706, 0.705882, 0.843137, 1 )
|
||||
|
||||
[sub_resource type="GradientTexture" id=2]
|
||||
gradient = SubResource( 1 )
|
||||
width = 1080
|
||||
[ext_resource path="res://assets/environment/background/sky.png" type="Texture" id=5]
|
||||
|
||||
[node name="SkyParallaxBackground" type="ParallaxBackground"]
|
||||
|
||||
[node name="ParallaxLayer" type="ParallaxLayer" parent="."]
|
||||
motion_scale = Vector2( 0, 0 )
|
||||
|
||||
[node name="SkyGradient" type="Sprite" parent="ParallaxLayer"]
|
||||
position = Vector2( -960, -540 )
|
||||
rotation = 1.5708
|
||||
scale = Vector2( 1, -1920 )
|
||||
texture = SubResource( 2 )
|
||||
centered = false
|
||||
[node name="SkyGradient" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 5 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ParallaxBackground2" type="ParallaxLayer" parent="."]
|
||||
motion_scale = Vector2( 0.08, 0.08 )
|
||||
|
|
@ -62,12 +54,13 @@ position = Vector2( 1562.91, -96.6282 )
|
|||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="ParallaxBackground3" type="ParallaxLayer" parent="."]
|
||||
motion_scale = Vector2( 0.12, 0.08 )
|
||||
motion_scale = Vector2( 0.12, 0.1 )
|
||||
motion_mirroring = Vector2( 1917, 0 )
|
||||
|
||||
[node name="Mountains" type="Sprite" parent="ParallaxBackground3"]
|
||||
position = Vector2( 860, 260 )
|
||||
scale = Vector2( 2, 1.276 )
|
||||
position = Vector2( 0, 222 )
|
||||
texture = ExtResource( 4 )
|
||||
centered = false
|
||||
region_rect = Rect2( 0, 0, 3834, 445 )
|
||||
region_filter_clip = true
|
||||
|
||||
|
|
|
|||
|
|
@ -26,3 +26,5 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
var last_checkpoint_name: String = visited_checkpoints[level.name].back()
|
||||
var last_checkpoint: Area2D = level.get_node("Checkpoints/" + last_checkpoint_name)
|
||||
$Player.state_machine.transition_to("Die", {last_checkpoint = last_checkpoint})
|
||||
elif event.is_action_pressed("toggle_full_screen"):
|
||||
OS.window_fullscreen = not OS.window_fullscreen
|
||||
|
|
|
|||
12
game/src/Objects/FallLimitArea.tscn
Normal file
12
game/src/Objects/FallLimitArea.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://src/Combat/DamageSource.tscn" type="PackedScene" id=1]
|
||||
|
||||
[sub_resource type="LineShape2D" id=1]
|
||||
|
||||
[node name="FallLimitArea" instance=ExtResource( 1 )]
|
||||
position = Vector2( 0, -2.93628 )
|
||||
is_instakill = true
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource( 1 )
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
extends MarginContainer
|
||||
# Contains UI widgets that display debug info about the game world
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed('toggle_debug_menu'):
|
||||
visible = not visible
|
||||
accept_event()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue