# Changelog

## Latest Update - Box Physics & Combat System

### ✨ New Features

#### 1. **Z-Axis Physics for Boxes**
- Boxes now fly in realistic arcs when thrown (just like players)
- Added `position_z`, `velocity_z`, `gravity_z` simulation
- Visual feedback with sprite offset and scaling based on height
- Smooth landing animation with squash-and-stretch effect

#### 2. **Dynamic Shadow System**
- Added shadow sprites to both players and boxes
- Shadows scale down and fade as objects get higher
- Real-time shadow updates based on Z-position
- Helps visualize height in the 2D top-down view

#### 3. **Box Breaking Mechanic**
- Boxes shatter into 4 smaller pieces on impact
- Pieces fly outward in random directions
- Fade out animation before disappearing
- Triggered when hitting players or other boxes mid-air

#### 4. **Combat System**
- Players take 10 damage when hit by thrown boxes
- Knockback effect pushes players away from impact
- Flash red visual feedback on damage
- Health system with respawn at origin on death
- Damage synced across network

#### 5. **Mid-Air Collision Detection**
- Boxes detect collisions while airborne
- Separate handling for player vs box collisions
- Chain reactions: thrown box breaks target box too
- Network-synchronized breaking effects

### 🔧 Technical Improvements

#### CharacterBody2D Migration
- Converted boxes from RigidBody2D to CharacterBody2D
- Deterministic physics for better network sync
- Direct velocity control instead of forces/impulses
- Eliminated non-deterministic physics simulation issues

#### Helper Functions
- Added `_is_box()` and `_is_player()` helper functions
- Simplified collision detection logic
- Easier to maintain and extend

#### Network Synchronization
- Added `_sync_damage()` RPC for player damage
- All breaking effects visible on all clients
- Proper authority checks for damage dealing

### 🎨 Visual Enhancements
- Shadow sprites with dynamic opacity
- Height-based sprite scaling
- Landing squash-and-stretch animation
- Breaking particle effects

### 📝 Documentation Updates
- Updated README with new features
- Added combat system details
- Documented box breaking mechanics
- Updated interaction system description

---

## Previous Updates

### Multiplayer Foundation
- Host/Join system with ENet
- Local + Online multiplayer support
- Command-line arguments (`--host`, `--join`)
- Player synchronization

### Interaction System
- Tap vs Hold grab mechanics
- Lift, push, pull, throw
- Player-on-player interactions
- Smart placement system
- Z-axis simulation for thrown players

### Network Improvements
- Fixed player spawning on clients
- Proper authority management
- RPC synchronization for all interactions
- Collision state syncing

