-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
75 lines (71 loc) · 2.68 KB
/
script.js
File metadata and controls
75 lines (71 loc) · 2.68 KB
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
const heroes = [
{
firstName: "Jan",
lastName: "Kowalski",
age: 30,
weight: 75,
image: "https://github.com/mplik/database/blob/main/images/1._pokemon.png?raw=true", // Przykładowe zdjęcie
description: "Bohater, który walczy o sprawiedliwość."
},
{
firstName: "Anna",
lastName: "Nowak",
age: 25,
weight: 60,
image: "https://github.com/mplik/database/blob/main/images/2._pokemon.png?raw=true", // Przykładowe zdjęcie
description: "Twarda i niezłomna obrończyni."
},
{
firstName: "Piotr",
lastName: "Zalewski",
age: 28,
weight: 80,
image: "https://github.com/mplik/database/blob/main/images/3._pokemon.png?raw=true", // Przykładowe zdjęcie
description: "Mistrz sztuk walki."
},
{
firstName: "Katarzyna",
lastName: "Wiśniewska",
age: 22,
weight: 55,
image: "https://github.com/mplik/database/blob/main/images/4._pokemon.png?raw=true", // Przykładowe zdjęcie
description: "Niezwykła strateg i lider."
},
{
firstName: "Worek",
lastName: "Śmiechu",
age: 30,
weight: 25,
image: "https://github.com/mplik/database/blob/main/images/5._pokemon.png?raw=true", // Przykładowe zdjęcie
description: "Mistrz w kręceniu hula-hoop."
},
{
firstName: "Juoi",
lastName: "Sticki",
age: 55,
weight: 45,
image: "https://github.com/mplik/database/blob/main/images/20250604_070048_0000.png?raw=true", // Przykładowe zdjęcie
description: "Mistrz w kręceniu hula-hoop."
},
{
firstName: "Yo",
lastName: "Sis",
age: 18,
weight: 45,
image: "https://github.com/mplik/database/blob/main/images/little_star.png?raw=true", // Przykładowe zdjęcie
description: "Mała gwiazdka o dużym sercu."
}
];
let currentHeroIndex = 0;
function updateHero() {
const hero = heroes[currentHeroIndex];
document.getElementById('hero-name').innerText = `${hero.firstName} ${hero.lastName}`;
document.getElementById('hero-age').innerText = `Wiek: ${hero.age}`;
document.getElementById('hero-weight').innerText = `Waga: ${hero.weight} kg`;
document.getElementById('hero-description').innerText = hero.description;
document.getElementById('hero-image').src = hero.image; // Ustawia zdjęcie
currentHeroIndex = (currentHeroIndex + 1) % heroes.length; // Przechodzi do następnego bohatera
}
document.getElementById('change-hero').addEventListener('click', updateHero);
// Inicjalizacja pierwszego bohatera
updateHero();