Commit graph

6 commits

Author SHA1 Message Date
7dd7477a3b feat: implement ECS architecture with game entity management
- Introduced a new Entity-Component-System (ECS) architecture for the game.
- Created foundational components such as Transform, Velocity, Health, and Collidable.
- Developed systems for handling input, movement, collision detection, and rendering.
- Added game logic for player control, coin collection, and obstacle interactions.
- Implemented a performance monitor for real-time metrics display.
- Enhanced game initialization and entity creation processes.

This update significantly refactors the game structure, improving maintainability and scalability.
2025-11-26 15:38:11 -05:00
28c820488e Feature/Update versioning logic (#7)
All checks were successful
Build and Publish Docker Image / Build and Validate (push) Successful in 8s
Build and Publish Docker Image / Publish to Registry (push) Successful in 7s
Reviewed-on: #7
Co-authored-by: Juan Sebastian Montoya <juansmm@outlook.com>
Co-committed-by: Juan Sebastian Montoya <juansmm@outlook.com>
2025-11-26 11:22:30 -05:00
c5a7f160bc Feature/Add movement interpolation (#5)
All checks were successful
Build and Publish Docker Image / Build and Validate (push) Successful in 7s
Build and Publish Docker Image / Publish to Registry (push) Successful in 7s
- Updated Player class to use maxSpeed, acceleration, and deceleration for smoother movement.
- Introduced velocity vector for more responsive control and smoother diagonal movement.
- Enhanced update method to calculate target velocity based on input and apply easing for acceleration and deceleration.
- Implemented boundary checks to stop movement when hitting the edges of the play area.

Reviewed-on: #5
Co-authored-by: Juan Sebastian Montoya <juansmm@outlook.com>
Co-committed-by: Juan Sebastian Montoya <juansmm@outlook.com>
2025-11-26 09:36:39 -05:00
dfe87d63cc Feature/Touch support (#4)
All checks were successful
Build and Publish Docker Image / Build and Validate (push) Successful in 8s
Build and Publish Docker Image / Publish to Registry (push) Successful in 6s
# Add Touch Support and Documentation

## 📋 Summary

This PR adds comprehensive touch support for mobile devices and tablets, enabling players to control the game using touch gestures. Additionally, a complete README.md file has been added to document the game features, controls, and gameplay mechanics.

## 🎯 Changes Made

###  New Features
- **Touch Controls**: Full touch support for smartphones and tablets
  - Touch and drag anywhere on the screen to move the player
  - Movement direction calculated relative to screen center
  - Smooth, responsive touch input handling
  - Multi-touch support with proper touch ID tracking

- **Documentation**: Comprehensive README.md
  - Game overview and features
  - Detailed controls (keyboard and touch)
  - Game mechanics explanation
  - Technical details and architecture
  - Getting started guide
  - Tips for high scores

### 🔧 Technical Implementation

#### Touch Event Handling
- Added touch event listeners (`touchstart`, `touchmove`, `touchend`, `touchcancel`)
- Implemented touch position tracking relative to screen center
- Converted touch input to WASD key states for seamless integration
- Proper touch ID tracking to handle multiple simultaneous touches
- Touch movement threshold (10px) to prevent accidental movements

#### Code Structure
- Added touch-related properties to `Game` class:
  - `touchActive`, `touchStartX/Y`, `touchCurrentX/Y`, `touchId`
- New methods:
  - `setupTouchControls()`: Initializes touch event listeners
  - `handleTouchStart()`: Handles touch initiation
  - `handleTouchMove()`: Updates touch position during drag
  - `handleTouchEnd()`: Resets touch state
  - `updateTouchMovement()`: Converts touch input to movement keys

#### UI Updates
- Updated instructions to mention touch controls
- Responsive design maintained for mobile devices

## 📊 Statistics

- **Files Changed**: 2
  - `index.html`: +123 lines, -1 line
  - `README.md`: +171 lines (new file)
- **Total Changes**: +293 insertions, -1 deletion
- **Commits**: 2

## 🧪 Testing

### Desktop Testing
-  Keyboard controls (WASD and Arrow Keys) still work correctly
-  No regression in existing functionality
-  Game performance unchanged

### Mobile Testing
-  Touch controls work on smartphones
-  Touch controls work on tablets
-  Movement is smooth and responsive
-  Touch input properly resets on touch end
-  Multiple touches handled correctly (only first touch tracked)

## 📱 Mobile Compatibility

The game now fully supports:
- iOS devices (iPhone, iPad)
- Android devices (phones and tablets)
- Other touch-enabled devices

Touch controls use the center of the screen as a reference point, making it intuitive for users to drag in any direction to move.

## 🎮 User Experience Improvements

1. **Accessibility**: Game is now playable on mobile devices without keyboard
2. **Intuitive Controls**: Touch and drag is natural for mobile users
3. **Documentation**: README provides clear instructions for all users
4. **No Visual Clutter**: Touch controls work without on-screen joystick

## 🔍 Code Quality

- Clean, maintainable code structure
- Proper event handling with `preventDefault()` to avoid browser defaults
- Touch events use `{ passive: false }` for proper scroll prevention
- Consistent with existing code style and patterns
- No breaking changes to existing functionality

## 📝 Notes

- Touch controls integrate seamlessly with existing keyboard controls
- Both input methods can work simultaneously (though not recommended)
- Touch movement uses the same movement system as keyboard input
- README includes comprehensive documentation for future developers

##  Checklist

- [x] Touch controls implemented and tested
- [x] Mobile compatibility verified
- [x] README.md created with comprehensive documentation
- [x] No regression in desktop functionality
- [x] Code follows existing patterns and style
- [x] Instructions updated to mention touch controls

---

**Ready for Review** 🚀

Reviewed-on: #4
Co-authored-by: Juan Sebastian Montoya <juansmm@outlook.com>
Co-committed-by: Juan Sebastian Montoya <juansmm@outlook.com>
2025-11-26 01:31:15 -05:00
fc24028ed9 Refactor to ES6 classes with GameObject inheritance pattern
- Convert from function-based to class-based architecture
- Create GameObject base class with common functionality (position, collision, scene management)
- Implement Player, Coin, and Obstacle classes extending GameObject
- Add Game class to manage game lifecycle and state
- Fix shadow rendering by configuring directional light shadow camera bounds
- Fix player collision to prevent sinking below ground (horizontal push only)
- Improve code organization and maintainability with OOP principles
2025-11-25 14:32:48 -05:00
0bf4afd499 initial commit 2025-11-25 14:21:59 -05:00