Naprawa strzelania dzialkiem
This commit is contained in:
parent
4d4403d6d1
commit
bcde93eca9
@ -1,7 +1,7 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
var _age := 0.0
|
var _age := 0.0
|
||||||
const DURATION := 0.075
|
const DURATION := 0.065
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
z_index = 25
|
z_index = 25
|
||||||
@ -14,8 +14,23 @@ func _process(delta: float) -> void:
|
|||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
var fade := 1.0 - _age / DURATION
|
var fade := clampf(1.0 - _age / DURATION, 0.0, 1.0)
|
||||||
draw_circle(Vector2.ZERO, 12 * fade, Color(1.0, 0.48, 0.08, 0.18 * fade))
|
var length_scale := 0.45 + fade * 0.55
|
||||||
draw_colored_polygon(PackedVector2Array([Vector2(-2, -3), Vector2(8, -2), Vector2(19, 0), Vector2(8, 2), Vector2(-2, 3)]), Color(1.0, 0.7, 0.18, fade))
|
# Compact flame lobes instead of thin crossing lines that flicker at subpixels.
|
||||||
draw_line(Vector2(-2, 0), Vector2(13 * fade, 0), Color(1.0, 0.97, 0.8, fade), 2, true)
|
draw_set_transform(Vector2.ZERO, 0.0, Vector2(length_scale, 0.65 + fade * 0.35))
|
||||||
draw_line(Vector2(1, -7 * fade), Vector2(1, 7 * fade), Color(1.0, 0.78, 0.3, fade * 0.7), 1, true)
|
for index in range(4, 0, -1):
|
||||||
|
draw_circle(Vector2(4.0, 0.0), float(index) * 2.4, Color(1.0, 0.32, 0.035, 0.025 * fade), true, -1, true)
|
||||||
|
var flame := PackedVector2Array([
|
||||||
|
Vector2(-1, -2), Vector2(3, -4), Vector2(7, -2.5),
|
||||||
|
Vector2(10, -3.5), Vector2(8.5, -1), Vector2(16, 0),
|
||||||
|
Vector2(9, 1.6), Vector2(10.5, 3), Vector2(6, 2.5),
|
||||||
|
Vector2(3, 4), Vector2(-1, 2),
|
||||||
|
])
|
||||||
|
draw_colored_polygon(flame, Color(1.0, 0.35, 0.045, fade * 0.85))
|
||||||
|
draw_polyline(flame, Color(1.0, 0.5, 0.07, fade * 0.35), 1.0, true)
|
||||||
|
draw_colored_polygon(PackedVector2Array([
|
||||||
|
Vector2(0, -1.5), Vector2(4, -2), Vector2(11, 0),
|
||||||
|
Vector2(4, 2), Vector2(0, 1.5),
|
||||||
|
]), Color(1.0, 0.78, 0.22, fade))
|
||||||
|
draw_line(Vector2.ZERO, Vector2(6, 0), Color(1.0, 0.97, 0.76, fade), 2.2, true)
|
||||||
|
draw_set_transform(Vector2.ZERO)
|
||||||
|
|||||||
@ -71,4 +71,3 @@ func _make_stars(layer_name: String, speed: float, count: int, seed_offset: int)
|
|||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
# The map boundary remains in world space.
|
# The map boundary remains in world space.
|
||||||
draw_rect(Rect2(-WORLD_SIZE * 0.5, WORLD_SIZE), Color(0.12, 0.52, 0.68, 0.48), false, 3.0)
|
draw_rect(Rect2(-WORLD_SIZE * 0.5, WORLD_SIZE), Color(0.12, 0.52, 0.68, 0.48), false, 3.0)
|
||||||
|
|
||||||
|
|||||||
@ -147,15 +147,17 @@ func _fire_projectile(item: ItemInstance) -> void:
|
|||||||
bool(hit["critical"])
|
bool(hit["critical"])
|
||||||
)
|
)
|
||||||
ship.get_parent().add_child(projectile)
|
ship.get_parent().add_child(projectile)
|
||||||
|
projectile.reset_physics_interpolation()
|
||||||
projectile.set("missile_homing", definition.missile_homing)
|
projectile.set("missile_homing", definition.missile_homing)
|
||||||
WEAPON_AUDIO_SCRIPT.play(ship.get_parent(), muzzle_position, definition.weapon_kind)
|
WEAPON_AUDIO_SCRIPT.play(ship.get_parent(), muzzle_position, definition.weapon_kind)
|
||||||
if definition.weapon_kind == ItemDefinition.WeaponKind.MACHINE_GUN:
|
if definition.weapon_kind == ItemDefinition.WeaponKind.MACHINE_GUN:
|
||||||
var flash := Node2D.new()
|
var flash := Node2D.new()
|
||||||
flash.set_script(preload("res://scripts/game/muzzle_flash.gd"))
|
flash.set_script(preload("res://scripts/game/muzzle_flash.gd"))
|
||||||
# Keep the short flash attached to the muzzle while the ship moves.
|
# Keep the short flash attached to the muzzle while the ship moves.
|
||||||
|
flash.position = ship.to_local(muzzle_position)
|
||||||
|
flash.rotation = direction.angle() - ship.global_rotation
|
||||||
ship.add_child(flash)
|
ship.add_child(flash)
|
||||||
flash.global_position = muzzle_position
|
flash.reset_physics_interpolation()
|
||||||
flash.global_rotation = direction.angle()
|
|
||||||
|
|
||||||
func _exit_tree() -> void:
|
func _exit_tree() -> void:
|
||||||
for beam in _laser_lines:
|
for beam in _laser_lines:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user