Skip to content

AslamSujah/Magic_Tray_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Magic Tray - Educational Memory Game for Children

Developer: Aslam Sujah ๐Ÿค Client: Mahthi Hassan

A fully responsive, mobile-optimized educational web game that challenges children's memory and pattern recognition skills through themed object categories. Perfect for learning while having fun!

๐ŸŽฎ Game Overview

Magic Tray is an educational memory-based puzzle game where children:

  1. Choose from different themed categories (Shapes, Fruits, Vegetables, Animals, Body Parts, Family)
  2. Watch a sequence of items from their chosen category appear on the magic tray
  3. Remember the exact order of appearance
  4. Recreate the sequence by selecting items in the correct order
  5. Progress through increasingly challenging levels with bonus lives and scoring

๐Ÿ“ Project Structure

Magic_Tray_Game/
โ”œโ”€โ”€ index.html          # Main game HTML structure and UI components
โ”œโ”€โ”€ styles.css          # Responsive styling, animations, and mobile optimization
โ”œโ”€โ”€ game.js            # Complete game logic, mechanics, and interactions
โ””โ”€โ”€ README.md          # This comprehensive documentation

โœจ Key Features

๐ŸŽฏ Educational Categories

  • โ™ฆ Shapes: Circle, Square, Triangle, Diamond, Heart, Oval, Rectangle, Star
  • ๐ŸŽ Fruits: Apple, Banana, Orange, Grapes, Strawberry, Watermelon, Pineapple, Avocado
  • ๐Ÿฅ• Vegetables: Carrot, Hot Pepper, Tomato, Corn, Eggplant, Cucumber, Onion, Potato
  • ๐Ÿ˜ Animals: Dog, Cat, Rabbit, Bear, Lion, Elephant, Monkey, Panda
  • ๐Ÿ‘๏ธ Body Parts: Eye, Nose, Mouth, Ear, Hand, Leg, Heart, Brain
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Family: Mom, Dad, Sister, Brother, Grandma, Grandpa, Baby, Family

๐Ÿง  Core Gameplay

  • Category Selection: Choose your preferred learning theme
  • Memory Challenge: Watch and recreate themed item sequences
  • Progressive Difficulty: Sequences get longer and faster as you advance
  • Lives System: 3 lives per game with bonus lives on level up (max 5 lives)
  • Educational Scoring: Points based on sequence length, level, and speed bonuses

๐Ÿ“ฑ Child-Friendly Design

  • Large Touch Targets: Easy for small fingers to tap (44px minimum)
  • Bright Colors: Engaging visual design with color-coded items
  • Simple Navigation: Intuitive interface suitable for kids
  • ๐Ÿ—ฃ๏ธ English Pronunciation: Each object is pronounced clearly to improve language skills
  • Safe Content: All content appropriate for children
  • Haptic Feedback: Vibration support on compatible devices

๐ŸŽจ Visual & Audio Features

  • Themed Categories: Each category has distinct visual identity
  • Smooth Animations: Item appearances, selections, and transitions
  • Sound Effects: Audio feedback for interactions and results
  • Visual Feedback: Highlighting, pulsing, and celebration animations
  • Responsive Design: Works perfectly on all screen sizes (320px to 4K)

๐Ÿ”ง Customization Options

  • Difficulty Levels: Easy (3-4 items), Medium (4-6 items), Hard (6-8 items)
  • Speed Settings: Slow, Medium, Fast sequence display
  • Sound Toggle: Enable/disable audio feedback
  • ๐Ÿ—ฃ๏ธ Pronunciation: Enable/disable English pronunciation of object names
  • Settings Persistence: Preferences saved locally in browser

๐Ÿš€ Quick Start

Option 1: Hosted Deployment (AWS Apache Web Server)

This instance is hosted on an AWS Ubuntu VM running the Apache Web Server.

Option 2: Direct Browser Access

Simply open index.html in any modern web browser - no server required!

Option 3: Local Web Server

For enhanced features and testing, use any web server:

# Using Python 3
python3 -m http.server 8080

# Using Node.js (if you have http-server installed)
npx http-server -p 8080

# Using PHP
php -S localhost:8080

Then open your browser to http://localhost:8080

๐ŸŽฏ Game Mechanics

Scoring System

  • Base Score: 100 points per correct sequence
  • Level Bonus: +10 points ร— current level
  • Length Bonus: +5 points ร— sequence length
  • Speed Bonus: Fast (+20), Medium (+10), Slow (+0)

Progression System

  • 5 sequences per level before advancing
  • Bonus life awarded on level up (maximum 5 lives)
  • Increasing difficulty with longer sequences
  • Speed increases at higher levels for added challenge

Lives System

  • 3 lives to start the game
  • Lose 1 life for incorrect sequences
  • Gain 1 life on level up (capped at 5 lives)
  • Game over when all lives are lost

๐Ÿš€ How to Play

Getting Started

  1. Open index.html in any modern web browser
  2. Read the welcome message and game instructions
  3. Tap "๐Ÿš€ Choose Category" to see available themes

Category Selection

  1. Browse through 6 different themed categories
  2. Tap on a category card to select it
  3. Preview the items in your chosen category
  4. Tap "๐ŸŽฎ Start Game" to begin playing

Gameplay Flow

  1. Watch Phase: Items from your chosen category appear in sequence on the magic tray
  2. Listen Phase: Each item name is pronounced clearly in English (if enabled)
  3. Memory Phase: Items disappear - remember the order and names!
  4. Recreation Phase: Tap items in the correct sequence (hear pronunciation again)
  5. Evaluation Phase: Get feedback and advance or try again

Game Controls

  • Category Cards: Tap to select your preferred theme
  • Item Selection: Tap items to select them in sequence
  • ๐Ÿ—‘๏ธ Clear Button: Reset your current selection
  • โœ… Submit Button: Check your sequence (auto-submits when complete)
  • โธ๏ธ Pause Button: Pause during sequence display
  • ๐Ÿ’ก Hint Button: Get helpful clues when stuck
  • โš™๏ธ Settings: Adjust difficulty, speed, and audio preferences

๐Ÿ“ฑ Mobile Features & Responsive Design

Fully Responsive

  • Desktop: Optimized for mouse interaction and larger screens
  • Tablet: Perfect touch targets and medium-sized interface
  • Mobile: Large buttons and touch-friendly design
  • All Screen Sizes: Works from 320px to 4K displays
  • Special Optimization: Enhanced for common mobile dimensions

Touch Optimization

  • Large Touch Targets: Minimum 44px for accessibility compliance
  • Visual Feedback: Clear indication of all interactions
  • Haptic Vibration: Physical feedback on supported devices
  • Gesture Prevention: Avoids accidental actions during gameplay
  • Enhanced Touch Events: Smooth mobile experience with proper event handling

Performance Features

  • Smooth Animations: Optimized for mobile GPUs using CSS transforms
  • Efficient Rendering: Minimal DOM manipulation and reflows
  • Memory Management: Optimized for long play sessions
  • Battery Optimization: Reduced motion options for power saving

๐Ÿ”ง Technical Details

Browser Compatibility

  • โœ… Chrome 60+ - Full support with all features
  • โœ… Firefox 55+ - Full support with all features
  • โœ… Safari 12+ - Full support with all features
  • โœ… Edge 79+ - Full support with all features
  • โœ… Mobile Browsers - iOS Safari, Chrome Mobile, Samsung Internet

Technologies Used

  • Pure HTML5/CSS3/JavaScript - No external dependencies
  • CSS Grid & Flexbox - Modern responsive layouts
  • CSS Animations - Hardware-accelerated transitions and effects
  • Web Audio API - Sound effects with graceful fallbacks
  • ๐Ÿ—ฃ๏ธ Web Speech API - Text-to-speech for pronunciation learning
  • Local Storage API - Settings and preferences persistence
  • Vibration API - Haptic feedback on compatible mobile devices

Performance Optimizations

  • CSS-only animations where possible for better performance
  • Efficient DOM manipulation with minimal reflows and repaints
  • Event delegation for better memory usage
  • Optimized touch events specifically for mobile devices
  • Responsive images and scalable vector graphics

๐ŸŽ“ Educational Value

This game helps develop:

  • Working Memory - Holding sequences in mind while processing
  • Pattern Recognition - Identifying relationships between items
  • Attention & Focus - Concentrating during sequence displays
  • Visual Processing - Quick identification of different objects
  • Sequential Thinking - Understanding order and progression
  • ๐Ÿ—ฃ๏ธ English Language Skills - Learning correct pronunciation and vocabulary
  • Vocabulary Building - Expanding knowledge of themed categories
  • Cognitive Flexibility - Switching between different categories and strategies

Perfect for:

  • Early childhood education (ages 4-12)
  • Brain training and cognitive exercise
  • Memory improvement practice
  • English language learning for children
  • Special needs education with customizable difficulty
  • Family fun and bonding activities

๐Ÿ”ง Troubleshooting

Common Issues & Solutions

Game doesn't load properly:

  • Ensure all files (index.html, styles.css, game.js) are in the same directory
  • Try refreshing the browser (Ctrl+F5 or Cmd+Shift+R)
  • Check browser console for errors (F12 Developer Tools)
  • Verify JavaScript is enabled in browser settings

Buttons not working on mobile:

  • Ensure you're using a modern mobile browser (Chrome/Firefox recommended)
  • Try clearing browser cache and cookies
  • Check if JavaScript is enabled
  • Test in different browsers for compatibility

Sound/Pronunciation not working:

  • Check if browser supports Web Audio API and Speech Synthesis
  • Ensure sound is enabled in game settings (โš™๏ธ Settings)
  • Try a different browser (Chrome/Firefox have best support)
  • Check device volume and browser audio permissions

Performance issues:

  • Close other browser tabs to free up memory
  • Try reducing animation settings in game options
  • Use a newer device/browser for better performance
  • Clear browser cache and restart browser

Touch controls not responsive:

  • Ensure touch events are supported on your device
  • Try tapping more firmly or holding slightly longer
  • Check if screen protector is interfering with touch
  • Test with different fingers or a stylus

๐ŸŽจ Customization Guide

Adding New Items to Existing Categories

Edit the objectPools object in game.js. For example, to add a new shape:

magic: {
    name: 'โ™ฆ Shapes',
    description: 'Different Shapes',
    items: [
        // existing items...
        { id: 'hexagon', emoji: 'โฌก', color: 'item-custom', name: 'Hexagon' }
    ]
}

Adding New Categories

  1. Add a new category to the objectPools object in game.js
  2. Include exactly 8 items with unique IDs, emojis, colors, and names
  3. Test the category thoroughly across different devices
  4. Update this README with the new category information

Adjusting Difficulty Levels

Modify sequence length ranges in the getSequenceLength() function:

const baseLengths = {
    easy: { min: 2, max: 3 },    // Easier for young children
    medium: { min: 4, max: 6 },  // Default balanced difficulty
    hard: { min: 6, max: 8 }     // Challenging for older kids
};

Styling Customization

  • Colors: Modify CSS custom properties in styles.css
  • Animations: Adjust keyframes and transition durations
  • Layout: Change grid templates and spacing values
  • Themes: Add new color schemes and visual styles

๐Ÿ‘จโ€๐Ÿ’ป Development Information

Architecture Overview

  • index.html - Main game interface, UI components, and structure
  • styles.css - All styling, animations, responsive design, and mobile optimization
  • game.js - Complete game logic, state management, and user interactions
  • README.md - Comprehensive documentation and setup guide

Key Classes and Functions

  • MagicTrayGame - Main game class handling all game logic and state
  • objectPools - Contains all category data and themed items
  • pronounceWord() - Text-to-speech functionality for educational purposes
  • showSequence() - Displays the sequence for players to memorize
  • checkSequence() - Validates player input against correct sequence
  • setupEventListeners() - Handles all user interactions and events

Responsive Design Architecture

  • Mobile-first approach with progressive enhancement
  • Multiple breakpoints for different screen sizes and orientations
  • Touch-optimized event handling with proper touch/click separation
  • Flexible grid systems that adapt seamlessly to any screen size

๐Ÿ† Tips for Success

  1. Focus intensely during the sequence display phase
  2. Use visualization techniques to remember item order
  3. Practice regularly to improve memory capacity and speed
  4. Start with easier settings and gradually increase difficulty
  5. Take breaks to avoid mental fatigue and maintain focus
  6. Use hints strategically when stuck on difficult sequences
  7. Pay attention to patterns in item selection and categories
  8. Practice pronunciation along with the game for language learning
  9. Try different categories to keep the game fresh and engaging
  10. Challenge family members for competitive fun and bonding

๐ŸŒŸ Recent Updates & Features

Version 2.0 - Enhanced Mobile Experience

  • โœ… Fixed responsive design issues at various mobile dimensions
  • โœ… Improved touch event handling for better mobile interaction
  • โœ… Enhanced button touch targets (minimum 44px for accessibility)
  • โœ… Optimized CSS breakpoints for all screen sizes
  • โœ… Better visual feedback for touch interactions
  • โœ… Improved accessibility features and compliance
  • โœ… Performance optimizations specifically for mobile devices

Key Technical Improvements

  • Touch Events: Fixed interference between touch and click events
  • Responsive Design: Added specific breakpoints for common mobile sizes
  • Button Interaction: Enhanced touch targets and visual feedback systems
  • Cross-Platform: Consistent experience across all devices and browsers
  • Performance: Optimized animations and rendering for mobile hardware

๐Ÿ“ž Support & Contributing

Getting Help

If you encounter any issues or have suggestions for improvements:

  1. Check the troubleshooting section above for common solutions
  2. Test with the latest version of Chrome or Firefox
  3. Ensure JavaScript is enabled in your browser settings
  4. Try clearing browser cache and cookies
  5. Test on different devices to isolate device-specific issues

Contributing to the Project

  1. Fork or download the project files
  2. Create a feature branch for your improvements
  3. Make your changes and test thoroughly on multiple devices
  4. Test across different browsers and screen sizes
  5. Update documentation as needed
  6. Submit your improvements with detailed descriptions

Enjoy your magical memory adventure! ๐Ÿช„โœจ

Magic Tray Game - Where Learning Meets Fun!

Happy Learning and Playing! ๐ŸŽฎ๐Ÿง โœจ


This game is designed with love for children's education and cognitive development. Every feature has been carefully crafted to provide both entertainment and learning value.

About

A fully responsive, mobile-optimized educational web game that challenges children's memory and pattern recognition skills through themed object categories. Perfect for learning while having fun!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors