Compare commits
9 Commits
adefc59bea
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e9432fa82 | |||
| fb4434a537 | |||
| cda31fcac9 | |||
| c697b996d8 | |||
| ec473dc4e3 | |||
| 2cb265c922 | |||
| 666648c154 | |||
| 6a5a18ca42 | |||
| 14a50364f3 |
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
GODOT_VERSION = '4.6.2-stable'
|
||||
GODOT_BIN = '/tmp/godot_ci/Godot_v4.6.2-stable_linux.x86_64'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Godot Setup') {
|
||||
steps {
|
||||
sh '''
|
||||
if [ ! -x "$GODOT_BIN" ]; then
|
||||
mkdir -p /tmp/godot_ci
|
||||
curl -fsSL -o /tmp/godot_ci/godot.zip \
|
||||
"https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip"
|
||||
unzip -o /tmp/godot_ci/godot.zip -d /tmp/godot_ci/
|
||||
chmod +x "$GODOT_BIN"
|
||||
fi
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Import Assets') {
|
||||
steps {
|
||||
// Godot must import assets before tests can run
|
||||
sh '$GODOT_BIN --headless --import || true'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
sh '$GODOT_BIN --headless -s res://addons/gut/gut_cmdln.gd -gdir=res://test/ -gexit'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo '✅ All tests passed'
|
||||
}
|
||||
failure {
|
||||
echo '❌ Tests failed'
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+77
-36
@@ -65,7 +65,6 @@ Hospital (Node2D)
|
||||
|
||||
- **Entwicklungs-Rechner:** Dein Arbeitsplatz reicht
|
||||
- **Android-Export:** Android Studio SDK + JDK (einmalig einrichten)
|
||||
- **iOS-Export:** Mac + Xcode + Apple Developer Account (€99/Jahr) — **oder:** Android zuerst, iOS später nachziehen
|
||||
- **Version Control:** Git (Godot-Projekte sind git-freundlich, `.import/` und `.godot/` in `.gitignore`)
|
||||
|
||||
### Empfohlene VS Code Setup (alternativ zum Godot-Editor)
|
||||
@@ -234,25 +233,24 @@ Hier scheitern die meisten Hobby-Gamedev-Projekte. Drei realistische Wege:
|
||||
|
||||
Realistisch für einen Vollzeit-Entwickler mit Familie und Side-Projekten. Kürzer geht, wenn du die Abende länger nutzt.
|
||||
|
||||
### Sprint 0: Setup (Woche 1)
|
||||
- [ ] Godot 4 installieren, Android-Export einrichten
|
||||
- [ ] Git-Repo anlegen
|
||||
- [ ] GDScript-Grundlagen durchgehen (Godot-Docs, 3-5h)
|
||||
- [ ] Apple Developer Account falls iOS geplant
|
||||
- [ ] Projektname + Logo-Idee
|
||||
### Sprint 0: Setup (Woche 1) ✅
|
||||
- [x] Godot 4 installieren, Android-Export einrichten
|
||||
- [x] Git-Repo anlegen
|
||||
- [x] GDScript-Grundlagen durchgehen (Godot-Docs, 3-5h)
|
||||
- [x] Projektname + Logo-Idee → "Cozypaw Hospital"
|
||||
|
||||
### Sprint 1-2: Proof of Concept (Woche 2-3)
|
||||
- [ ] Ein Raum (z.B. Empfang) mit Hintergrund
|
||||
- [ ] Eine Figur (Platzhalter-Häschen) per Drag bewegen
|
||||
- [ ] Ein interaktives Objekt (z.B. Blume pflücken)
|
||||
- [ ] Auf echtem Tablet testen
|
||||
- **Gate:** Funktioniert der Kern-Loop? Finden die Kinder es gut?
|
||||
### Sprint 1-2: Proof of Concept (Woche 2-3) ✅
|
||||
- [x] Ein Raum (z.B. Empfang) mit Hintergrund
|
||||
- [x] Eine Figur (Platzhalter-Häschen) per Drag bewegen
|
||||
- [x] Ein interaktives Objekt (z.B. Blume pflücken)
|
||||
- [x] Auf echtem Tablet testen
|
||||
- **Gate:** ✅ Kern-Loop funktioniert
|
||||
|
||||
### Sprint 3-4: Core Systems (Woche 4-5)
|
||||
- [ ] Raum-Navigationssystem (Etagen-Wechsel per Aufzug)
|
||||
- [ ] Save/Load-System
|
||||
- [ ] Settings-Menü (Lautstärke, Reset)
|
||||
- [ ] Character-State-System (gesund, krank, schläft)
|
||||
### Sprint 3-4: Core Systems (Woche 4-5) ✅
|
||||
- [x] Raum-Navigationssystem (Etagen-Wechsel per Aufzug)
|
||||
- [x] Save/Load-System
|
||||
- [x] Settings-Menü (Lautstärke, Reset)
|
||||
- [x] Character-State-System (gesund, krank, schläft)
|
||||
|
||||
### Sprint 5-7: Erdgeschoss (Woche 6-8) ✅
|
||||
- [x] Empfang komplett
|
||||
@@ -271,22 +269,71 @@ Realistisch für einen Vollzeit-Entwickler mit Familie und Side-Projekten. Kürz
|
||||
- [x] Kreißsaal (kindgerecht: Mama kommt rein, Baby ist da)
|
||||
- [x] Säuglingsstation mit Wiegen
|
||||
|
||||
### Sprint 14: Zuhause & Garten (Woche 15)
|
||||
- [ ] Garten-Szene
|
||||
- [ ] Party-Mechanik (Geschenke auspacken, Tee)
|
||||
---
|
||||
|
||||
### Sprint 15: Polish & Sound (Woche 16)
|
||||
- [ ] Alle Sounds einbauen
|
||||
- [ ] Hintergrundmusik mit Cross-Fade
|
||||
- [ ] Animations-Feinschliff
|
||||
- [ ] Tutorial / erster Start
|
||||
> **Scope-Erweiterung:** Die folgenden Sprints gingen über den ursprünglichen 16-Wochen-Plan hinaus und bauten das Spielsystem signifikant aus.
|
||||
|
||||
### Sprint 16: Release-Vorbereitung (Woche 17+)
|
||||
### Sprint 15 (git): Character v2 ✅
|
||||
- [x] SnapPoint-System (Figuren rasten an Möbeln/Objekten ein)
|
||||
- [x] SnapReceiver-Komponente
|
||||
- [x] AnimState-System (idle, picked_up, placed)
|
||||
- [x] OutfitLayers (visuelle Outfit-Schichten pro Figur)
|
||||
- [x] HandSlots (Figur kann Objekte halten)
|
||||
|
||||
### Sprint 16 (git): Snap-Points in allen Räumen ✅
|
||||
- [x] 25 SnapPoints quer über alle 12 Räume
|
||||
- [x] 115 Unit-Tests
|
||||
|
||||
### Sprint 17 (git): Hand-Slots & Outfit-Items ✅
|
||||
- [x] HoldableItem mit Hand-Slot-Erkennung
|
||||
- [x] OutfitItem mit Tap-to-Undress
|
||||
- [x] GameState v2 — Outfit und gehaltene Items werden gespeichert
|
||||
|
||||
### Sprint 18 (git): Room Chests & Item-Spawning ✅
|
||||
- [x] RoomChest mit Spawn- und Rücknahme-Logik
|
||||
- [x] ChestItemData Resource
|
||||
- [x] RoomChestConfig (alle Räume konfiguriert)
|
||||
- [x] Chest-Nodes in allen 12 Räumen
|
||||
|
||||
### Sprint 19 (git): AudioManager & Cross-Fade ✅
|
||||
- [x] AudioManager Autoload mit `_SFX_MAP`
|
||||
- [x] Etagen-Musik mit Cross-Fade zwischen Räumen
|
||||
- [x] Basis-SFX: item_drag, item_drop, item_spawn, chest_tap
|
||||
|
||||
### Sprint 20 (git): Navigation-Integration ✅
|
||||
- [x] RoomNavigator → GameState.set_current_room
|
||||
- [x] AudioManager wird beim Raumwechsel getriggert
|
||||
- [x] Kamera wird beim Laden auf gespeicherten Raum restored
|
||||
|
||||
### Sprint 21 (git): Interaktive Objekte SFX ✅
|
||||
- [x] 7 neue `play_sfx`-Aufrufe in interaktiven Objekten
|
||||
- [x] SFX: xray_scan, gift_open, tea_pour, cradle_rock, ambulance_siren, delivery_cheer, object_tap
|
||||
|
||||
### Sprint 22 (git): Character SFX & Ambient ✅
|
||||
- [x] character_pickup, character_tap, character_place SFX
|
||||
- [x] UltrasoundMachine: loopender Herzschlag-Ambient
|
||||
|
||||
---
|
||||
|
||||
### Sprint 14: Zuhause & Garten ✅
|
||||
- [x] Garten-Szene (GardenParty)
|
||||
- [x] Party-Mechanik: Geschenke auspacken (GiftBox), Tee einschenken (TeaPot)
|
||||
- [x] Kuchen schneiden (Cake) mit Reset-Statemachine
|
||||
- [x] Luftballons (Balloon) mit Pop/Respawn-Statemachine
|
||||
- [x] Stuhl-SnapPoints in der Gartenparty
|
||||
- [x] Floor-Music-Tracks 0–3 (echte CC0-Audiodateien)
|
||||
|
||||
### Sprint 15 (Plan): Polish & Sound ✅
|
||||
- [x] Alle Sounds einbauen → erledigt in Sprint 21 + 22
|
||||
- [x] Hintergrundmusik mit Cross-Fade → erledigt in Sprint 19
|
||||
- [x] Animations-Feinschliff → erledigt in Sprint 15 (git) Character v2
|
||||
- [ ] Tutorial / erster Start ← **offen**
|
||||
|
||||
### Sprint 16 (Plan): Release-Vorbereitung
|
||||
- [ ] Icon, Splash Screen
|
||||
- [ ] Play Console Setup, Screenshots, Beschreibung
|
||||
- [ ] Internal Testing mit Kindern
|
||||
- [ ] Release auf Play Store (Android zuerst)
|
||||
- [ ] iOS-Port falls gewünscht
|
||||
- [ ] Internal Testing mit Kindern (UAT)
|
||||
- [ ] Release auf Play Store (Android)
|
||||
|
||||
---
|
||||
|
||||
@@ -298,11 +345,6 @@ Realistisch für einen Vollzeit-Entwickler mit Familie und Side-Projekten. Kürz
|
||||
3. Oder: Direkte APK-Distribution in der Familie (kein Store nötig)
|
||||
4. Ggf. später: Öffentlicher Release
|
||||
|
||||
### iOS (später)
|
||||
- Apple Developer Account (€99/Jahr)
|
||||
- TestFlight für Familie
|
||||
- App Store Review deutlich strenger als Google
|
||||
|
||||
### **WICHTIG — COPPA/Kids-Compliance**
|
||||
Da Zielgruppe 3+ Jahre:
|
||||
- Keine Analytics (Google Analytics, Firebase, etc.)
|
||||
@@ -324,7 +366,6 @@ Da Zielgruppe 3+ Jahre:
|
||||
| Risiko | Mitigation |
|
||||
|---|---|
|
||||
| **Asset-Produktion zieht sich** | Mit Platzhaltern entwickeln, Assets parallelisieren |
|
||||
| **iOS-Deployment kompliziert** | Erst Android, iOS später |
|
||||
| **Feature-Creep** | Strikt am MVP-Plan halten, später iterieren |
|
||||
| **Motivation ebbt nach 2 Monaten ab** | Kinder regelmäßig Build zeigen → Feedback = Motor |
|
||||
| **Komplexe Animationen** | Mit einfachen 2-Frame-Animationen starten |
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cozypaw_gardenparty"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cozypaw_gardenparty"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/GiftBox.tscn" id="1_giftbox"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/TeaPot.tscn" id="2_teapot"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/objects/HomeButton.tscn" id="3_homebtn"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="4_snap"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/room_chest.gd" id="5_chest"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/balloon.gd" id="6_balloon"]
|
||||
[ext_resource type="Script" path="res://scripts/objects/cake.gd" id="7_cake"]
|
||||
|
||||
[node name="GardenParty" type="Node2D"]
|
||||
|
||||
@@ -59,8 +61,24 @@ position = Vector2(640, 464)
|
||||
[node name="GiftBox2" parent="." instance=ExtResource("1_giftbox")]
|
||||
position = Vector2(730, 464)
|
||||
|
||||
[node name="GiftBox3" parent="." instance=ExtResource("1_giftbox")]
|
||||
[node name="Cake" type="Node2D" parent="."]
|
||||
position = Vector2(820, 464)
|
||||
script = ExtResource("7_cake")
|
||||
|
||||
[node name="Base" type="ColorRect" parent="Cake"]
|
||||
offset_left = -40.0
|
||||
offset_top = -20.0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 20.0
|
||||
color = Color(0.72, 0.52, 0.32, 1)
|
||||
|
||||
[node name="Slice" type="ColorRect" parent="Cake"]
|
||||
offset_left = 5.0
|
||||
offset_top = -22.0
|
||||
offset_right = 33.0
|
||||
offset_bottom = 18.0
|
||||
color = Color(0.88, 0.74, 0.58, 1)
|
||||
rotation = 0.15
|
||||
|
||||
[node name="TeaCup" type="ColorRect" parent="."]
|
||||
offset_left = 558.0
|
||||
@@ -69,28 +87,50 @@ offset_right = 590.0
|
||||
offset_bottom = 464.0
|
||||
color = Color(0.96, 0.92, 0.84, 1)
|
||||
|
||||
[node name="Balloon1" type="ColorRect" parent="."]
|
||||
offset_left = 180.0
|
||||
offset_top = 120.0
|
||||
offset_right = 220.0
|
||||
offset_bottom = 180.0
|
||||
[node name="Balloon1" type="Node2D" parent="."]
|
||||
position = Vector2(200, 150)
|
||||
script = ExtResource("6_balloon")
|
||||
|
||||
[node name="Body" type="ColorRect" parent="Balloon1"]
|
||||
offset_left = -20.0
|
||||
offset_top = -30.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 30.0
|
||||
color = Color(0.96, 0.44, 0.44, 1)
|
||||
|
||||
[node name="Balloon2" type="ColorRect" parent="."]
|
||||
offset_left = 1020.0
|
||||
offset_top = 100.0
|
||||
offset_right = 1060.0
|
||||
offset_bottom = 160.0
|
||||
[node name="Balloon2" type="Node2D" parent="."]
|
||||
position = Vector2(1040, 130)
|
||||
script = ExtResource("6_balloon")
|
||||
|
||||
[node name="Body" type="ColorRect" parent="Balloon2"]
|
||||
offset_left = -20.0
|
||||
offset_top = -30.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 30.0
|
||||
color = Color(0.56, 0.76, 0.96, 1)
|
||||
|
||||
[node name="HomeButtonReturn" parent="." instance=ExtResource("3_homebtn")]
|
||||
position = Vector2(100, 620)
|
||||
go_to_garden = false
|
||||
|
||||
[node name="ChairLeft" type="ColorRect" parent="."]
|
||||
offset_left = 500.0
|
||||
offset_top = 476.0
|
||||
offset_right = 560.0
|
||||
offset_bottom = 496.0
|
||||
color = Color(0.60, 0.42, 0.26, 1)
|
||||
|
||||
[node name="SnapTableLeft" type="Node2D" parent="."]
|
||||
position = Vector2(530, 455)
|
||||
script = ExtResource("4_snap")
|
||||
|
||||
[node name="ChairRight" type="ColorRect" parent="."]
|
||||
offset_left = 720.0
|
||||
offset_top = 476.0
|
||||
offset_right = 780.0
|
||||
offset_bottom = 496.0
|
||||
color = Color(0.60, 0.42, 0.26, 1)
|
||||
|
||||
[node name="SnapTableRight" type="Node2D" parent="."]
|
||||
position = Vector2(750, 455)
|
||||
script = ExtResource("4_snap")
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
## Balloon — tap to pop, auto-respawns after a delay.
|
||||
class_name Balloon extends Node2D
|
||||
|
||||
enum State { IDLE, POPPING, POPPED, RESPAWNING }
|
||||
|
||||
const POP_DURATION: float = 0.15
|
||||
const RESPAWN_DURATION: float = 0.30
|
||||
const RESPAWN_DELAY: float = 5.0
|
||||
const BUTTON_HALF_SIZE: float = 20.0
|
||||
|
||||
var _state: State = State.IDLE
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if _state != State.IDLE:
|
||||
return
|
||||
if not event is InputEventScreenTouch:
|
||||
return
|
||||
var touch: InputEventScreenTouch = event as InputEventScreenTouch
|
||||
if not touch.pressed:
|
||||
return
|
||||
var local: Vector2 = to_local(touch.position)
|
||||
if abs(local.x) > BUTTON_HALF_SIZE or abs(local.y) > BUTTON_HALF_SIZE:
|
||||
return
|
||||
_start_pop()
|
||||
|
||||
|
||||
func _start_pop() -> void:
|
||||
AudioManager.play_sfx("object_tap")
|
||||
_state = State.POPPING
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_IN)
|
||||
tween.set_trans(Tween.TRANS_BACK)
|
||||
tween.tween_property(self, "scale", Vector2.ZERO, POP_DURATION)
|
||||
tween.tween_callback(_on_pop_complete)
|
||||
|
||||
|
||||
func _on_pop_complete() -> void:
|
||||
_state = State.POPPED
|
||||
var tween: Tween = create_tween()
|
||||
tween.tween_interval(RESPAWN_DELAY)
|
||||
tween.tween_callback(_start_respawn)
|
||||
|
||||
|
||||
func _start_respawn() -> void:
|
||||
_state = State.RESPAWNING
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_BACK)
|
||||
tween.tween_property(self, "scale", Vector2.ONE, RESPAWN_DURATION)
|
||||
tween.tween_callback(_on_respawn_complete)
|
||||
|
||||
|
||||
func _on_respawn_complete() -> void:
|
||||
_state = State.IDLE
|
||||
@@ -0,0 +1,56 @@
|
||||
## Cake — tap to cut a slice, slice auto-respawns after a delay.
|
||||
class_name Cake extends Node2D
|
||||
|
||||
enum State { WHOLE, CUTTING, CUT, RESETTING }
|
||||
|
||||
const CUT_DURATION: float = 0.3
|
||||
const RESET_DURATION: float = 0.3
|
||||
const RESET_DELAY: float = 3.0
|
||||
const BUTTON_HALF_WIDTH: float = 40.0
|
||||
const BUTTON_HALF_HEIGHT: float = 20.0
|
||||
|
||||
var _state: State = State.WHOLE
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if _state != State.WHOLE:
|
||||
return
|
||||
if not event is InputEventScreenTouch:
|
||||
return
|
||||
var touch: InputEventScreenTouch = event as InputEventScreenTouch
|
||||
if not touch.pressed:
|
||||
return
|
||||
var local: Vector2 = to_local(touch.position)
|
||||
if abs(local.x) > BUTTON_HALF_WIDTH or abs(local.y) > BUTTON_HALF_HEIGHT:
|
||||
return
|
||||
_start_cutting()
|
||||
|
||||
|
||||
func _start_cutting() -> void:
|
||||
AudioManager.play_sfx("object_tap")
|
||||
_state = State.CUTTING
|
||||
var slice: Node2D = get_node_or_null("Slice") as Node2D
|
||||
var tween: Tween = create_tween()
|
||||
if slice != null:
|
||||
tween.tween_property(slice, "modulate:a", 0.0, CUT_DURATION)
|
||||
tween.tween_callback(_on_cut_complete)
|
||||
|
||||
|
||||
func _on_cut_complete() -> void:
|
||||
_state = State.CUT
|
||||
var tween: Tween = create_tween()
|
||||
tween.tween_interval(RESET_DELAY)
|
||||
tween.tween_callback(_start_reset)
|
||||
|
||||
|
||||
func _start_reset() -> void:
|
||||
_state = State.RESETTING
|
||||
var slice: Node2D = get_node_or_null("Slice") as Node2D
|
||||
var tween: Tween = create_tween()
|
||||
if slice != null:
|
||||
tween.tween_property(slice, "modulate:a", 1.0, RESET_DURATION)
|
||||
tween.tween_callback(_on_reset_complete)
|
||||
|
||||
|
||||
func _on_reset_complete() -> void:
|
||||
_state = State.WHOLE
|
||||
@@ -1,11 +1,14 @@
|
||||
## GiftBox — tap while closed to open: lid rises and fades out, gift inside fades in.
|
||||
## Auto-resets after RESET_DELAY seconds.
|
||||
class_name GiftBox extends Node2D
|
||||
|
||||
enum State { CLOSED, OPENING, OPEN }
|
||||
enum State { CLOSED, OPENING, RESETTING }
|
||||
|
||||
const LID_OPEN_Y: float = -120.0
|
||||
const CLOSED_LID_Y: float = -60.0
|
||||
const OPEN_DURATION: float = 0.5
|
||||
const GIFT_FADE_DURATION: float = 0.4
|
||||
const RESET_DELAY: float = 3.0
|
||||
const BUTTON_HALF_WIDTH: float = 40.0
|
||||
const BUTTON_HALF_HEIGHT: float = 50.0
|
||||
|
||||
@@ -37,7 +40,7 @@ func _start_opening() -> void:
|
||||
_state = State.OPENING
|
||||
var lid: Node2D = get_node_or_null("Lid") as Node2D
|
||||
if lid == null:
|
||||
_state = State.OPEN
|
||||
_on_lid_opened()
|
||||
return
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
@@ -48,9 +51,26 @@ func _start_opening() -> void:
|
||||
|
||||
|
||||
func _on_lid_opened() -> void:
|
||||
_state = State.OPEN
|
||||
_state = State.RESETTING
|
||||
var gift: Node2D = get_node_or_null("Gift") as Node2D
|
||||
if gift == null:
|
||||
return
|
||||
var tween: Tween = create_tween()
|
||||
tween.tween_property(gift, "modulate:a", 1.0, GIFT_FADE_DURATION)
|
||||
if gift != null:
|
||||
tween.tween_property(gift, "modulate:a", 1.0, GIFT_FADE_DURATION)
|
||||
tween.tween_interval(RESET_DELAY)
|
||||
tween.tween_callback(_start_close_lid)
|
||||
|
||||
|
||||
func _start_close_lid() -> void:
|
||||
var lid: Node2D = get_node_or_null("Lid") as Node2D
|
||||
var gift: Node2D = get_node_or_null("Gift") as Node2D
|
||||
var tween: Tween = create_tween()
|
||||
if lid != null:
|
||||
tween.parallel().tween_property(lid, "position:y", CLOSED_LID_Y, OPEN_DURATION)
|
||||
tween.parallel().tween_property(lid, "modulate:a", 1.0, OPEN_DURATION)
|
||||
if gift != null:
|
||||
tween.parallel().tween_property(gift, "modulate:a", 0.0, OPEN_DURATION)
|
||||
tween.tween_callback(_on_reset_complete)
|
||||
|
||||
|
||||
func _on_reset_complete() -> void:
|
||||
_state = State.CLOSED
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
## Tests for Balloon — state machine transitions.
|
||||
extends GutTest
|
||||
|
||||
const BalloonScript = preload("res://scripts/objects/balloon.gd")
|
||||
|
||||
var _balloon: Node2D
|
||||
|
||||
|
||||
func before_each() -> void:
|
||||
_balloon = BalloonScript.new()
|
||||
add_child_autofree(_balloon)
|
||||
|
||||
|
||||
func test_initial_state_is_idle() -> void:
|
||||
assert_eq(_balloon._state, BalloonScript.State.IDLE)
|
||||
|
||||
|
||||
func test_start_pop_transitions_to_popping() -> void:
|
||||
_balloon._start_pop()
|
||||
assert_eq(_balloon._state, BalloonScript.State.POPPING)
|
||||
|
||||
|
||||
func test_on_pop_complete_transitions_to_popped() -> void:
|
||||
_balloon._on_pop_complete()
|
||||
assert_eq(_balloon._state, BalloonScript.State.POPPED)
|
||||
|
||||
|
||||
func test_on_respawn_complete_transitions_to_idle() -> void:
|
||||
_balloon._state = BalloonScript.State.RESPAWNING
|
||||
_balloon._on_respawn_complete()
|
||||
assert_eq(_balloon._state, BalloonScript.State.IDLE)
|
||||
@@ -0,0 +1,31 @@
|
||||
## Tests for Cake — state machine transitions.
|
||||
extends GutTest
|
||||
|
||||
const CakeScript = preload("res://scripts/objects/cake.gd")
|
||||
|
||||
var _cake: Node2D
|
||||
|
||||
|
||||
func before_each() -> void:
|
||||
_cake = CakeScript.new()
|
||||
add_child_autofree(_cake)
|
||||
|
||||
|
||||
func test_initial_state_is_whole() -> void:
|
||||
assert_eq(_cake._state, CakeScript.State.WHOLE)
|
||||
|
||||
|
||||
func test_start_cutting_transitions_to_cutting() -> void:
|
||||
_cake._start_cutting()
|
||||
assert_eq(_cake._state, CakeScript.State.CUTTING)
|
||||
|
||||
|
||||
func test_on_cut_complete_transitions_to_cut() -> void:
|
||||
_cake._on_cut_complete()
|
||||
assert_eq(_cake._state, CakeScript.State.CUT)
|
||||
|
||||
|
||||
func test_on_reset_complete_transitions_to_whole() -> void:
|
||||
_cake._state = CakeScript.State.RESETTING
|
||||
_cake._on_reset_complete()
|
||||
assert_eq(_cake._state, CakeScript.State.WHOLE)
|
||||
@@ -1,4 +1,4 @@
|
||||
## Tests for GiftBox — CLOSED/OPENING/OPEN state machine transitions.
|
||||
## Tests for GiftBox — CLOSED/OPENING/RESETTING state machine transitions.
|
||||
extends GutTest
|
||||
|
||||
var _box: GiftBox
|
||||
@@ -23,10 +23,10 @@ func test_start_opening_transitions_to_opening() -> void:
|
||||
assert_eq(_box._state, GiftBox.State.OPENING)
|
||||
|
||||
|
||||
func test_on_lid_opened_transitions_to_open() -> void:
|
||||
func test_on_lid_opened_transitions_to_resetting() -> void:
|
||||
_box._start_opening()
|
||||
_box._on_lid_opened()
|
||||
assert_eq(_box._state, GiftBox.State.OPEN)
|
||||
assert_eq(_box._state, GiftBox.State.RESETTING)
|
||||
|
||||
|
||||
func test_input_ignored_when_state_is_opening() -> void:
|
||||
@@ -38,13 +38,13 @@ func test_input_ignored_when_state_is_opening() -> void:
|
||||
assert_eq(_box._state, GiftBox.State.OPENING)
|
||||
|
||||
|
||||
func test_input_ignored_when_state_is_open() -> void:
|
||||
_box._state = GiftBox.State.OPEN
|
||||
func test_input_ignored_when_state_is_resetting() -> void:
|
||||
_box._state = GiftBox.State.RESETTING
|
||||
var event: InputEventScreenTouch = InputEventScreenTouch.new()
|
||||
event.pressed = true
|
||||
event.position = _box.global_position
|
||||
_box._input(event)
|
||||
assert_eq(_box._state, GiftBox.State.OPEN)
|
||||
assert_eq(_box._state, GiftBox.State.RESETTING)
|
||||
|
||||
|
||||
func test_tap_outside_hitbox_does_not_open() -> void:
|
||||
@@ -61,3 +61,9 @@ func test_release_event_does_not_open() -> void:
|
||||
event.position = _box.global_position
|
||||
_box._input(event)
|
||||
assert_eq(_box._state, GiftBox.State.CLOSED)
|
||||
|
||||
|
||||
func test_on_reset_complete_transitions_to_closed() -> void:
|
||||
_box._state = GiftBox.State.RESETTING
|
||||
_box._on_reset_complete()
|
||||
assert_eq(_box._state, GiftBox.State.CLOSED)
|
||||
|
||||
Reference in New Issue
Block a user