Camera fix, spike art revision
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 358 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 368 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 378 B |
@ -2,8 +2,9 @@ extends Camera2D
|
||||
|
||||
var horizontal_facing = 0
|
||||
var vertical_facing = 0
|
||||
var camera_horizontal_shift = 70
|
||||
var camera_horizontal_shift = 90
|
||||
var camera_vertical_shift = 90
|
||||
var time: float = 0
|
||||
|
||||
onready var tween = $ShiftTween
|
||||
onready var original_x_zoom = zoom.x
|
||||
@ -19,14 +20,14 @@ func _ready():
|
||||
prev_camera_pos = get_camera_screen_center()
|
||||
offset.x = -camera_horizontal_shift if zoom.x == original_x_zoom else 0
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
func _physics_process(delta: float) -> void:
|
||||
if(!GlobalState.is_dead):
|
||||
time += delta
|
||||
_adapt_to_movement()
|
||||
#TODO Do this via a event or let it be to track blobbies movement better
|
||||
else:
|
||||
self.position = blobby.global_position
|
||||
_death_cam()
|
||||
prev_camera_pos = get_camera_screen_center()
|
||||
|
||||
func _set_boundaries():
|
||||
# This is ok, because it only happens on initialization
|
||||
@ -58,21 +59,26 @@ func _adapt_to_movement():
|
||||
var target_offset: Vector2 = Vector2(0,0)
|
||||
var tween_v = false
|
||||
var tween_h = false
|
||||
var new_h_facing = sign(get_camera_screen_center().x - prev_camera_pos.x) if abs(get_camera_screen_center().x - prev_camera_pos.x) >= 1 else 0.0
|
||||
if new_h_facing != 0 && horizontal_facing != new_h_facing:
|
||||
horizontal_facing = new_h_facing
|
||||
target_offset.x = camera_horizontal_shift * horizontal_facing
|
||||
tween_h = true
|
||||
|
||||
# var new_v_facing = sign(get_camera_position().y - prev_camera_pos.y)
|
||||
# if new_v_facing != 0 && vertical_facing != new_v_facing:
|
||||
# vertical_facing = new_v_facing
|
||||
# target_offset.y = camera_vertical_shift * vertical_facing
|
||||
# print(target_offset)
|
||||
# tween_v = true
|
||||
# TODO Make smarter
|
||||
if(time > 0.1):
|
||||
time = 0.0
|
||||
var cam_offset = get_camera_screen_center().x - prev_camera_pos.x
|
||||
var new_h_facing = sign(cam_offset)
|
||||
if new_h_facing != 0 && horizontal_facing != new_h_facing:
|
||||
horizontal_facing = new_h_facing
|
||||
target_offset.x = camera_horizontal_shift * horizontal_facing
|
||||
tween_h = true
|
||||
|
||||
# var new_v_facing = sign(get_camera_position().y - prev_camera_pos.y)
|
||||
# if new_v_facing != 0 && vertical_facing != new_v_facing:
|
||||
# vertical_facing = new_v_facing
|
||||
# target_offset.y = camera_vertical_shift * vertical_facing
|
||||
# print(target_offset)
|
||||
# tween_v = true
|
||||
|
||||
if ((tween_h || tween_v ) && zoom == Vector2(original_x_zoom, original_y_zoom)):
|
||||
#TODO Motion may be too complex
|
||||
prev_camera_pos = get_camera_screen_center()
|
||||
if ((tween_h || tween_v )):
|
||||
#TODO Motion may be too complex
|
||||
tween.interpolate_property(
|
||||
self,
|
||||
"offset",
|
||||
@ -82,8 +88,9 @@ func _adapt_to_movement():
|
||||
Tween.TRANS_SINE,
|
||||
Tween.EASE_OUT
|
||||
)
|
||||
|
||||
tween.start()
|
||||
self.position = blobby.global_position
|
||||
position = blobby.position
|
||||
|
||||
func _death_cam():
|
||||
$AnimationPlayer.play("deathCam")
|
||||
|
||||
@ -115,6 +115,30 @@ tracks/8/keys = {
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/9/type = "value"
|
||||
tracks/9/path = NodePath(".:drag_margin_h_enabled")
|
||||
tracks/9/interp = 1
|
||||
tracks/9/loop_wrap = true
|
||||
tracks/9/imported = false
|
||||
tracks/9/enabled = true
|
||||
tracks/9/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/10/type = "value"
|
||||
tracks/10/path = NodePath(".:drag_margin_v_enabled")
|
||||
tracks/10/interp = 1
|
||||
tracks/10/loop_wrap = true
|
||||
tracks/10/imported = false
|
||||
tracks/10/enabled = true
|
||||
tracks/10/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ true ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=6]
|
||||
resource_name = "deathCam"
|
||||
@ -243,15 +267,12 @@ tracks/9/keys = {
|
||||
}
|
||||
|
||||
[node name="BlobbyCam" type="Camera2D"]
|
||||
scale = Vector2( 1.00291, 0.958333 )
|
||||
rotating = true
|
||||
current = true
|
||||
zoom = Vector2( 0.75, 0.75 )
|
||||
process_mode = 0
|
||||
drag_margin_left = 1.0
|
||||
drag_margin_top = 1.0
|
||||
drag_margin_right = 1.0
|
||||
drag_margin_bottom = 1.0
|
||||
drag_margin_h_enabled = true
|
||||
drag_margin_v_enabled = true
|
||||
editor_draw_screen = false
|
||||
script = ExtResource( 1 )
|
||||
|
||||
|
||||
175
src/Levels/02 Level.tscn
Normal file
@ -48,5 +48,5 @@ animations = [ {
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 1 )
|
||||
frame = 19
|
||||
frame = 17
|
||||
playing = true
|
||||
|
||||