Code Room
Vibe codingMediumvc-g363
Subject Ai code reviewLevel Mid–Senior~15 minCommon in Algorithms & data structures interviewsIndustries Computer games, Software development

Question

An AI assistant wrote this Godot 4 GDScript for a cooldown-based dash ability. Players on low-end phones (low FPS) report the dash sometimes triggers twice or the cooldown counts down faster than the on-screen timer. Review the code and find the delta-time / sampling bug.

gdscript
func _process(delta):    if Input.is_action_pressed("dash") and cooldown <= 0:        velocity = facing * DASH_SPEED        cooldown = DASH_COOLDOWN    cooldown -= 1   # tick the cooldown down one per frame    move_and_slide()
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.