fix: generous black borders around levels
This commit is contained in:
parent
1d55756ade
commit
bfe0805377
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 109 B |
@ -117,7 +117,7 @@ _global_script_class_icons={
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Blobby"
|
config/name="Blobby"
|
||||||
run/main_scene="res://src/UserInterface/Screens/MainMenu/MainScreen.tscn"
|
run/main_scene="res://src/Levels/Level 1.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
config/windows_native_icon="res://icon.ico"
|
config/windows_native_icon="res://icon.ico"
|
||||||
|
|
||||||
|
|||||||
@ -4385,7 +4385,7 @@ texture = SubResource( 62 )
|
|||||||
offset = Vector2( 1, 0 )
|
offset = Vector2( 1, 0 )
|
||||||
hframes = 6
|
hframes = 6
|
||||||
vframes = 6
|
vframes = 6
|
||||||
frame = 8
|
frame = 6
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo="
|
"_editor_description_": "YXNlcHJpdGVfd2l6YXJkX2NvbmZpZwpwbGF5ZXJ8PUJsb2JieVNwcml0ZS9CbG9iYnltYXRpb25QbGF5ZXIKc291cmNlfD1yZXM6Ly9hc3NldHMvYmxvYmJ5L2Jsb2JieS1zcHJpdGVzaGVldHQuYXNlcHJpdGUKbGF5ZXJ8PUJsb2JieQpvcF9leHB8PUZhbHNlCm9fZm9sZGVyfD0Kb19uYW1lfD0Kb25seV92aXNpYmxlfD1GYWxzZQpvX2V4X3B8PQo="
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/environment/decor/glass.png" type="Texture" id=1]
|
[ext_resource path="res://assets/environment/decor/glass.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://assets/environment/decor/Roots_And_Leafs.png" type="Texture" id=2]
|
[ext_resource path="res://assets/environment/decor/Roots_And_Leafs.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://assets/environment/blocks/Alien-Ship-Ground-Inner-Black.png" type="Texture" id=3]
|
||||||
|
|
||||||
[sub_resource type="TileSet" id=1]
|
[sub_resource type="TileSet" id=1]
|
||||||
0/name = "glass.png 0"
|
0/name = "glass.png 0"
|
||||||
@ -130,6 +131,20 @@
|
|||||||
8/shape_one_way_margin = 0.0
|
8/shape_one_way_margin = 0.0
|
||||||
8/shapes = [ ]
|
8/shapes = [ ]
|
||||||
8/z_index = 0
|
8/z_index = 0
|
||||||
|
9/name = "Alien-Ship-Ground-Inner-Black.png 9"
|
||||||
|
9/texture = ExtResource( 3 )
|
||||||
|
9/tex_offset = Vector2( 0, 0 )
|
||||||
|
9/modulate = Color( 1, 1, 1, 1 )
|
||||||
|
9/region = Rect2( 0, 0, 32, 32 )
|
||||||
|
9/tile_mode = 0
|
||||||
|
9/occluder_offset = Vector2( 0, 0 )
|
||||||
|
9/navigation_offset = Vector2( 0, 0 )
|
||||||
|
9/shape_offset = Vector2( 0, 0 )
|
||||||
|
9/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||||
|
9/shape_one_way = false
|
||||||
|
9/shape_one_way_margin = 0.0
|
||||||
|
9/shapes = [ ]
|
||||||
|
9/z_index = 0
|
||||||
|
|
||||||
[node name="GlassAndRoots" type="TileMap"]
|
[node name="GlassAndRoots" type="TileMap"]
|
||||||
tile_set = SubResource( 1 )
|
tile_set = SubResource( 1 )
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -51,5 +51,4 @@ scale = Vector2( 1.5, 1 )
|
|||||||
position = Vector2( 0, 1.5 )
|
position = Vector2( 0, 1.5 )
|
||||||
z_index = -1
|
z_index = -1
|
||||||
frames = SubResource( 1 )
|
frames = SubResource( 1 )
|
||||||
frame = 8
|
|
||||||
playing = true
|
playing = true
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const PhysicsConst = preload("res://src/Utilities/Physic/PhysicsConst.gd")
|
|||||||
|
|
||||||
var mass = 1
|
var mass = 1
|
||||||
var coupled_mass = mass
|
var coupled_mass = mass
|
||||||
var spring_k = -400
|
var spring_k = 400
|
||||||
var start_y = 0
|
var start_y = 0
|
||||||
var y_velocity = 0
|
var y_velocity = 0
|
||||||
var friction = 0.91
|
var friction = 0.91
|
||||||
@ -17,81 +17,77 @@ var shock_ready = true
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
start_y = self.position.y
|
start_y = self.position.y
|
||||||
|
|
||||||
|
|
||||||
# TODO Limit spring deformation
|
# TODO Limit spring deformation
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
var bc = _body_contact()
|
var bc = _body_contact()
|
||||||
if !bc:
|
if !bc:
|
||||||
shock_ready = true
|
shock_ready = true
|
||||||
if bc && shock_ready:
|
if bc && shock_ready:
|
||||||
_Kinematic_Body_on_Spring()
|
_Kinematic_Body_on_Spring()
|
||||||
|
|
||||||
var spring_force = spring_k * (self.position.y - self.start_y)
|
var spring_force = spring_k * (self.start_y - self.position.y)
|
||||||
if coupled_body != null:
|
if coupled_body != null:
|
||||||
coupled_mass = mass + coupled_body.mass
|
coupled_mass = mass + coupled_body.mass
|
||||||
else:
|
else:
|
||||||
coupled_mass = mass
|
coupled_mass = mass
|
||||||
|
|
||||||
var weight_force = coupled_mass * PhysicsConst.gravity
|
var weight_force = coupled_mass * PhysicsConst.gravity
|
||||||
var result_force = weight_force + spring_force
|
var result_force = weight_force + spring_force
|
||||||
y_velocity = PhysicsFunc.two_step_euler(
|
y_velocity = PhysicsFunc.two_step_euler(
|
||||||
y_velocity, result_force, coupled_mass, delta
|
y_velocity, result_force, coupled_mass, delta
|
||||||
)
|
)
|
||||||
|
|
||||||
y_velocity *= friction
|
y_velocity *= friction
|
||||||
|
|
||||||
self.position.y += y_velocity * delta
|
self.position.y += y_velocity * delta
|
||||||
|
|
||||||
|
|
||||||
func _body_contact() -> bool:
|
func _body_contact() -> bool:
|
||||||
var areas: Array = $SpringSkin.get_overlapping_areas()
|
var areas: Array = $SpringSkin.get_overlapping_areas()
|
||||||
for i in range(0, areas.size()):
|
for i in range(0, areas.size()):
|
||||||
if ["BlobbySkin","EnemySkin"].has(areas[i].name):
|
coupled_body = areas[i].get_parent()
|
||||||
coupled_body = areas[i].get_parent()
|
return true
|
||||||
return true
|
coupled_body = null
|
||||||
coupled_body = null
|
return false
|
||||||
return false
|
|
||||||
|
|
||||||
|
|
||||||
func _Kinematic_Body_on_Spring() -> void:
|
func _Kinematic_Body_on_Spring() -> void:
|
||||||
var a_velocity = stored_incoming_velocity
|
var a_velocity = stored_incoming_velocity
|
||||||
var a_mass = coupled_body.mass
|
var a_mass = coupled_body.mass
|
||||||
var b_velocity = y_velocity
|
var b_velocity = y_velocity
|
||||||
var b_mass = mass
|
var b_mass = mass
|
||||||
y_velocity += PhysicsFunc.complete_unelastic_shock(
|
y_velocity += PhysicsFunc.complete_unelastic_shock(
|
||||||
a_velocity, b_velocity, a_mass, b_mass
|
a_velocity, b_velocity, a_mass, b_mass
|
||||||
)
|
)
|
||||||
stored_incoming_velocity = 0
|
stored_incoming_velocity = 0
|
||||||
shock_ready = false
|
shock_ready = false
|
||||||
|
|
||||||
|
|
||||||
func _on_SpringSkin_area_exited(_area: Area2D) -> void:
|
func _on_SpringSkin_area_exited(_area: Area2D) -> void:
|
||||||
var displacement = self.position.y - self.start_y
|
var displacement = self.position.y - self.start_y
|
||||||
var potential_spring_energy = spring_k * 0.5 * pow(displacement, 2)
|
var potential_spring_energy = spring_k * 0.5 * pow(displacement, 2)
|
||||||
var mass_ratio = 1 - mass / coupled_mass
|
var mass_ratio = 1 - mass / coupled_mass
|
||||||
var transferred_kinetic_energy = potential_spring_energy * mass_ratio
|
var transferred_kinetic_energy = potential_spring_energy * mass_ratio
|
||||||
var kinetic_energy_in_velocity = (
|
var kinetic_energy_in_velocity = (
|
||||||
-sign(displacement)
|
-sign(displacement)
|
||||||
* sqrt(
|
* sqrt(
|
||||||
abs(
|
2 * transferred_kinetic_energy / max(coupled_mass - mass, 0.001)
|
||||||
2 * transferred_kinetic_energy / max(coupled_mass - mass, 0.001)
|
)
|
||||||
)
|
)
|
||||||
)
|
if coupled_body != null:
|
||||||
)
|
coupled_body.velocity.y += kinetic_energy_in_velocity
|
||||||
if coupled_body != null:
|
|
||||||
coupled_body.velocity.y += kinetic_energy_in_velocity
|
|
||||||
|
|
||||||
|
|
||||||
func _on_EnteringVelocityDetector_area_entered(area: Area2D) -> void:
|
func _on_EnteringVelocityDetector_area_entered(area: Area2D) -> void:
|
||||||
if area.name == "BlobbySkin":
|
if area.get_parent().velocity.y > 0:
|
||||||
if area.get_parent().velocity.y > 0:
|
stored_incoming_velocity = area.get_parent().velocity.y
|
||||||
stored_incoming_velocity = area.get_parent().velocity.y
|
|
||||||
|
|
||||||
|
|
||||||
func _on_EnteringVelocityDetector_area_exited(area: Area2D) -> void:
|
func _on_EnteringVelocityDetector_area_exited(area: Area2D) -> void:
|
||||||
if coupled_body == null:
|
if coupled_body == null:
|
||||||
$SpringSound.play()
|
$SpringSound.play()
|
||||||
|
|||||||
@ -22,6 +22,7 @@ texture = ExtResource( 2 )
|
|||||||
[node name="SpringSkin" type="Area2D" parent="."]
|
[node name="SpringSkin" type="Area2D" parent="."]
|
||||||
collision_layer = 32
|
collision_layer = 32
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="SpringSkin"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="SpringSkin"]
|
||||||
position = Vector2( -0.0412841, -1.27843 )
|
position = Vector2( -0.0412841, -1.27843 )
|
||||||
@ -39,7 +40,8 @@ one_way_collision = true
|
|||||||
[node name="EnteringVelocityDetector" type="Area2D" parent="."]
|
[node name="EnteringVelocityDetector" type="Area2D" parent="."]
|
||||||
position = Vector2( 0, -3.04889 )
|
position = Vector2( 0, -3.04889 )
|
||||||
collision_layer = 32
|
collision_layer = 32
|
||||||
collision_mask = 43
|
collision_mask = 3
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnteringVelocityDetector"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnteringVelocityDetector"]
|
||||||
position = Vector2( 0.00395775, -1.07744 )
|
position = Vector2( 0.00395775, -1.07744 )
|
||||||
|
|||||||
@ -41,7 +41,7 @@ resource_name = "LowPassFilter"
|
|||||||
cutoff_hz = 3000.0
|
cutoff_hz = 3000.0
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
bus/0/volume_db = inf_neg
|
bus/0/volume_db = -10.4576
|
||||||
bus/1/name = "Music"
|
bus/1/name = "Music"
|
||||||
bus/1/solo = false
|
bus/1/solo = false
|
||||||
bus/1/mute = false
|
bus/1/mute = false
|
||||||
|
|||||||
@ -226,8 +226,7 @@ scroll_horizontal_enabled = false
|
|||||||
script = ExtResource( 11 )
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/Panel/LevelList"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/Panel/LevelList"]
|
||||||
margin_right = 123.0
|
margin_right = 119.0
|
||||||
margin_bottom = 102.0
|
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user