Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export_presets.cfg
.mono/
data_*/
mono_crash.*.json

.vercel
Empty file added ANIMATION_SYSTEM_COMPLETE.md
Empty file.
Empty file added ANIMATION_TEST_README.md
Empty file.
Empty file added AREA1_ENERGY_CELL_FIX.md
Empty file.
103 changes: 103 additions & 0 deletions AREAS_4_5_6_CHECKPOINT_UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Areas 4, 5, and 6 - Checkpoint Respawn System Applied

## Summary
Extended the enemy death checkpoint respawn system to work with enemies in Areas 4, 5, and 6.

## Updated Enemy Scripts

### 1. bat.gd
**Used by:** Bat enemies and Slime enemies (both use bat.gd script)
**Change:** Added checkpoint respawn tracking for non-stomp collisions

```gdscript
func _on_Hurtbox_body_entered(body: Node) -> void:
if body is CharacterBody2D:
# Stomp kills bat
if body.global_position.y < global_position.y - 4:
queue_free()
if body.has_method("bounce"):
body.bounce()
else:
# Player hit from side - record checkpoint respawn
if RespawnManager:
RespawnManager.set_death_cause("hazard")
RespawnManager.record_death_position(body.global_position)
if body.has_method("take_damage"):
body.take_damage(1)
```

**Behavior:**
- ✅ Stomp from above → Bat dies, player bounces (no player damage)
- ✅ Hit from side → Player damaged, respawns at checkpoint (energy cell)

### 2. plant_bullet.gd
**Used by:** Plant enemy projectiles
**Change:** Added checkpoint respawn tracking when bullet hits player

```gdscript
func _on_body_entered(body: Node) -> void:
if body is CharacterBody2D:
# Record checkpoint respawn for plant bullet hit
if RespawnManager:
RespawnManager.set_death_cause("hazard")
RespawnManager.record_death_position(body.global_position)
if body.has_method("take_damage"):
body.take_damage(damage)
queue_free()
```

**Behavior:**
- ✅ Bullet hits player → Player damaged, respawns at checkpoint (energy cell)

## Affected Areas

### Area 4
- **Enemies:** Ghost (no collision), Bat
- **Energy Cells:** Orange and Banana checkpoints
- **Behavior:** Bat collisions now use checkpoint respawn

### Area 5
- **Enemies:** Slime (uses bat.gd script), Spinning saw hazards
- **Energy Cells:** 7 energy cells
- **Behavior:** Slime collisions now use checkpoint respawn

### Area 6
- **Enemies:** Plant (shoots bullets), Slime, Bluebird, Spinning saw hazards
- **Energy Cells:** 8 energy cells
- **Behavior:**
- Plant bullet hits use checkpoint respawn
- Slime collisions use checkpoint respawn
- Bluebird already had checkpoint respawn (updated earlier)

## Respawn Behavior Summary

### Fall Deaths
- Death cause: `"fall"`
- Respawn location: Area start position
- **Does NOT use checkpoint**

### Enemy/Hazard Deaths
- Death cause: `"hazard"`
- Respawn location: Near energy cell checkpoint
- **Uses checkpoint** (fruit-based respawn points)

## Enemies with Checkpoint Respawn

✅ **Area 1:** Radish, Snail, Duck
✅ **Area 2:** Radish, Snail, Duck, Bluebird
✅ **Area 4:** Bat
✅ **Area 5:** Slime (uses bat.gd), Spinning saws
✅ **Area 6:** Plant (bullets), Slime (uses bat.gd), Bluebird

## Testing Checklist

- [ ] Area 4: Die to Bat → Should respawn at orange/banana checkpoint
- [ ] Area 5: Die to Slime → Should respawn at energy cell checkpoint
- [ ] Area 6: Die to Plant bullet → Should respawn at energy cell checkpoint
- [ ] Area 6: Die to Slime → Should respawn at energy cell checkpoint
- [ ] All areas: Fall off map → Should respawn at area start (not checkpoint)
- [ ] All areas: Collect new energy cell → Checkpoint updates to new position

## Implementation Complete ✅

All enemy types across Areas 1, 2, 4, 5, and 6 now consistently use the checkpoint respawn system when killing the player through hazard contact.
187 changes: 187 additions & 0 deletions AREA_1_CHECKPOINT_MAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Area 1 - Energy Cell Checkpoint Locations

## Energy Cells in Area 1

Based on `area_1.tscn`, there are **6 energy cells** that act as checkpoints:

### Energy Cell Positions

1. **EnergyCell1** - Position: (30, 598)
- Near the starting area
- First checkpoint for the player

2. **EnergyCell2** - Position: (187, 471)
- Mid-level platform
- Good checkpoint for upper area exploration

3. **EnergyCell3** - Position: (-100, 553)
- Left side of the map
- Checkpoint for western exploration

4. **EnergyCell4** - Position: (-196, 456)
- Far left, higher platform
- Advanced checkpoint

5. **EnergyCell5** - Position: (-196, 616)
- Far left, lower area
- Alternative path checkpoint

6. **EnergyCell6** - Position: (-179, 489)
- Far left, middle height
- Strategic checkpoint location

## How Checkpoints Work in Area 1

### Example Player Journey:

```
START (15.5, 500)
Collect EnergyCell1 (30, 598)
↓ [Checkpoint Activated!]
Move to platform edge
Jump from (50, 577)
↓ [Position recorded: last_pre_jump_pos = (50, 577)]
Fall off edge
↓ [Y > 800, fall detected]
DIE
RESPAWN at (50, 577) - The jump origin position!
↓ [Safe on platform, ready to try again]
```

### Strategic Checkpoint Placement

The energy cells are placed at key locations:
- ✅ **Near spawn point** - EnergyCell1 for immediate safety
- ✅ **Platform edges** - Before difficult jumps
- ✅ **Multiple heights** - Cover vertical exploration
- ✅ **Both sides** - Left and right path checkpoints

## Hazards in Area 1

The area contains **5 Radish enemies**:
1. Position: (-109, 641) - Patrol: 30px, Speed: 20
2. Position: (127, 625) - Patrol: 2px, Speed: 2 (slow)
3. Position: (-14, 481) - Patrol: 10px, Speed: 10
4. Position: (-102, 545) - Patrol: 2px, Speed: 2 (slow)
5. Position: (223, 481) - Patrol: 15px, Speed: 20

### Death by Enemy vs Fall

**Die to Radish enemy:**
- Respawn near death location (on safe ground)
- Uses energy cell checkpoint area

**Die from falling:**
- Respawn at last pre-jump position
- Won't fall again!

## Testing the System in Area 1

### Test 1: Basic Checkpoint
1. Start game in Area 1
2. Move to EnergyCell1 (30, 598)
3. Collect it (hear sound, see it disappear)
4. Walk to edge and fall off
5. **Expected:** Respawn near where you jumped from

### Test 2: Multiple Jumps
1. Collect EnergyCell2 (187, 471)
2. Jump from platform A → land safely
3. Jump from platform B → fall off
4. **Expected:** Respawn at platform B (last jump)

### Test 3: Enemy Death
1. Collect EnergyCell3 (-100, 553)
2. Get killed by Radish enemy
3. **Expected:** Respawn on safe ground near energy cell area

### Test 4: No Fall Loop
1. Collect any energy cell
2. Fall off map
3. Respawn
4. **Expected:** Standing on solid ground, NOT falling

## Visual Layout

```
Area 1 Map (Simplified):

[-196, 456] EC4
[-196, 616] EC5 ← [-179, 489] EC6
[-100, 553] EC3
[START] → [30, 598] EC1
[187, 471] EC2

Legend:
EC# = Energy Cell #
[x, y] = Position coordinates
→ = Player path
↓ = Fall/descent
```

## Respawn Flow Diagram

```
Player Movement
[Collect Energy Cell]
Checkpoint Activated ✓
Continue Playing
┌─────────┴─────────┐
↓ ↓
[Jump] [Walk/Run]
↓ ↓
Record Position Update Safe Ground
↓ ↓
[FALL?] ─────────────► [DIE?]
↓ ↓
YES YES
↓ ↓
Set Cause="fall" Set Cause="hazard"
↓ ↓
└─────────┬─────────┘
[RESPAWN LOGIC]
┌─────────┴─────────┐
↓ ↓
Cause="fall" Cause="hazard"
↓ ↓
Spawn at last Spawn near
jump position death location
↓ ↓
└─────────┬─────────┘
[Verify Safe Ground]
Has floor? ✓
No hazards? ✓
Can fit? ✓
[PLAYER RESPAWNED]
Grace period (0.6s)
Invulnerability (0.9s)
Ready to play! 🎮
```

## Summary

✅ **6 Energy Cells** in Area 1 serve as checkpoints
✅ Each collection creates a **respawn point**
✅ **Smart fall detection** - respawns before the fatal jump
✅ **Safe respawn** - verified ground, no hazards
✅ **Protection after respawn** - grace period + invulnerability

The system is **fully functional** and ready to use! 🎮✨
Binary file added Assets/Background/Blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Assets/Background/Blue.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://c0rpvvnjjgk7l"
path="res://.godot/imported/Blue.png-0b2097415107499dfba37177140790b4.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/Background/Blue.png"
dest_files=["res://.godot/imported/Blue.png-0b2097415107499dfba37177140790b4.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Assets/Background/Brown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Assets/Background/Brown.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://2bgrft0p6wq7"
path="res://.godot/imported/Brown.png-1f0dd4a798b454b8bff795b45a242328.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Assets/Background/Brown.png"
dest_files=["res://.godot/imported/Brown.png-1f0dd4a798b454b8bff795b45a242328.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added Assets/Background/Gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading