Spaces:
Running

File size: 2,616 Bytes
fd90d49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6c74397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

// Space Adventure Game Functions
function updatePlayer() {
    // Handle player movement
}

function updateBullets() {
    // Move bullets and remove off-screen ones
}

function updateAsteroids() {
    // Move asteroids and spawn new ones
}

function updateEnemies() {
    // Move enemies and handle their behavior
}

function updatePowerups() {
    // Move powerups and handle collection
}

function checkCollisions() {
    // Check all collision scenarios
}

function drawPlayer() {
    // Draw player ship
}

function drawBullets() {
    // Draw all active bullets
}

function drawAsteroids() {
    // Draw all asteroids
}

function drawEnemies() {
    // Draw all enemy ships
}

function drawPowerups() {
    // Draw all powerups
}

function handleKeyDown(e) {
    // Handle keyboard input
}

function handleKeyUp(e) {
    // Handle key release
}

// Main JavaScript file for the gaming site
document.addEventListener('DOMContentLoaded', function() {
    // Initialize tooltips for game ratings
    const tooltipTriggers = document.querySelectorAll('[data-tooltip]');
    
    tooltipTriggers.forEach(trigger => {
        trigger.addEventListener('mouseenter', function() {
            const tooltip = document.createElement('div');
            tooltip.className = 'absolute z-10 bg-gray-800 text-white px-2 py-1 rounded text-xs whitespace-nowrap';
            tooltip.textContent = this.getAttribute('data-tooltip');
            this.appendChild(tooltip);
            
            // Position tooltip
            const rect = this.getBoundingClientRect();
            tooltip.style.top = `${rect.top - 30}px`;
            tooltip.style.left = `${rect.left + rect.width/2 - tooltip.offsetWidth/2}px`;
            
            this.addEventListener('mouseleave', function() {
                tooltip.remove();
            });
        });
    });
    
    // Smooth scrolling for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            
            const targetId = this.getAttribute('href');
            if (targetId === '#') return;
            
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                targetElement.scrollIntoView({
                    behavior: 'smooth'
                });
            }
        });
    });
    
    // Random floating animation delay for game cards
    document.querySelectorAll('.floating-card').forEach((card, index) => {
        card.style.animationDelay = `${index * 0.2}s`;
    });
});