-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (105 loc) · 2.92 KB
/
index.html
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
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kulhad Raja - Text-Based Game</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4e8c1;
color: #5a3e36;
text-align: center;
margin: 0;
padding: 20px;
}
h1 {
font-size: 2.5rem;
margin-bottom: 20px;
}
.game-container {
max-width: 600px;
margin: 0 auto;
background-color: #d7b89c;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.score-display {
font-size: 1.5rem;
margin-bottom: 20px;
}
.actions {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
button {
padding: 10px 20px;
font-size: 1rem;
background-color: #8b5e3c;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #6b4a32;
}
.story-area {
margin-top: 20px;
font-size: 1.2rem;
line-height: 1.5;
background-color: #f0d9c2;
padding: 15px;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>Kulhad Raja</h1>
<div class="game-container">
<div class="score-display">
Score: <span id="score">0</span>
</div>
<div class="actions">
<button id="action1">Collect Kulhads</button>
<button id="action2">Build Kingdom</button>
<button id="action3">Trade Resources</button>
</div>
<div class="story-area" id="story">
Welcome to the kingdom of Kulhad Raja! Start by collecting kulhads and building your empire.
</div>
</div>
<script>
// Basic JavaScript for interactivity
let score = 0;
const scoreDisplay = document.getElementById('score');
const storyArea = document.getElementById('story');
document.getElementById('action1').addEventListener('click', () => {
score += 10;
scoreDisplay.textContent = score;
storyArea.textContent = "You collected 10 kulhads! Your kingdom grows stronger.";
});
document.getElementById('action2').addEventListener('click', () => {
if (score >= 20) {
score -= 20;
scoreDisplay.textContent = score;
storyArea.textContent = "You built a new structure in your kingdom! The people are happy.";
} else {
storyArea.textContent = "Not enough kulhads to build. Collect more!";
}
});
document.getElementById('action3').addEventListener('click', () => {
if (score >= 15) {
score -= 25;
scoreDisplay.textContent = score;
storyArea.textContent = "You traded resources and gained valuable items for your kingdom!";
} else {
storyArea.textContent = "Not enough kulhads to trade. Collect more!";
}
});
</script>
</body>
</html>