Initial commit — Godot space roguelite source
- Touch controls: direct InputEventScreenTouch in shop_ui (bypass relay) - ItemDB: static preload list instead of DirAccess scan (export fix) - All 18 items with EN localisation (name_en, desc_en, category_en) - Ship playstyles: NOVA-1 shield, INFERNO ram, AURORA agile/tank - Quasar: SMBH visual, jet boost, merge, push, BH-eating - Atlas & UI text updated EN+DE Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
extends RefCounted
|
||||
class_name BigWipe
|
||||
|
||||
enum Phase { INACTIVE, COLLAPSE, FLASH, DONE }
|
||||
var phase: Phase = Phase.INACTIVE
|
||||
var timer: float = 0.0
|
||||
var flash_timer: float = 0.0
|
||||
var p1_survived: bool = false
|
||||
var p2_survived: bool = false
|
||||
var p1_pressed: bool = false
|
||||
var p2_pressed: bool = false
|
||||
|
||||
const COLLAPSE_DURATION := 140.0 / 60.0 # frames to seconds
|
||||
const FLASH_DURATION := 24.0 / 60.0
|
||||
const WIPE_BONUS := 500
|
||||
|
||||
signal wipe_complete(p1_survived, p2_survived)
|
||||
|
||||
func start() -> void:
|
||||
phase = Phase.COLLAPSE
|
||||
timer = 0.0
|
||||
p1_pressed = false
|
||||
p2_pressed = false
|
||||
p1_survived = false
|
||||
p2_survived = false
|
||||
|
||||
func is_active() -> bool:
|
||||
return phase != Phase.INACTIVE and phase != Phase.DONE
|
||||
|
||||
func collapse_progress() -> float:
|
||||
return clamp(timer / COLLAPSE_DURATION, 0.0, 1.0)
|
||||
|
||||
func update(delta: float, is_multiplayer: bool) -> void:
|
||||
match phase:
|
||||
Phase.COLLAPSE:
|
||||
timer += delta
|
||||
if timer >= COLLAPSE_DURATION:
|
||||
phase = Phase.FLASH
|
||||
flash_timer = 0.0
|
||||
p1_survived = p1_pressed
|
||||
p2_survived = p2_pressed if is_multiplayer else false
|
||||
Phase.FLASH:
|
||||
flash_timer += delta
|
||||
if flash_timer >= FLASH_DURATION:
|
||||
phase = Phase.DONE
|
||||
wipe_complete.emit(p1_survived, p2_survived)
|
||||
|
||||
func player_press_survive(player_idx: int) -> void:
|
||||
if phase != Phase.COLLAPSE: return
|
||||
if player_idx == 0: p1_pressed = true
|
||||
else: p2_pressed = true
|
||||
|
||||
func draw_overlay(canvas: CanvasItem, world_w: float, world_h: float, _blink_t: float) -> void:
|
||||
match phase:
|
||||
Phase.FLASH:
|
||||
var f := 1.0 - flash_timer / FLASH_DURATION
|
||||
canvas.draw_rect(Rect2(0, 0, world_w, world_h), Color(1, 1, 1, f))
|
||||
Phase.COLLAPSE:
|
||||
var dim: float = collapse_progress() * 0.4
|
||||
canvas.draw_rect(Rect2(0, 0, world_w, world_h), Color(0, 0, 0, dim))
|
||||
Reference in New Issue
Block a user