-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathindex.html
More file actions
306 lines (278 loc) · 15.6 KB
/
index.html
File metadata and controls
306 lines (278 loc) · 15.6 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-9TMX5EGXEJ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-9TMX5EGXEJ');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unity Jigsaw Puzzle Tutorial</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="shortcut icon" href="FinalGame/TemplateData/favicon.ico">
<link rel="stylesheet" href="FinalGame/TemplateData/style.css">
<style>
/* Custom smooth scrolling */
html { scroll-behavior: smooth; }
/* Custom Overrides to fix Unity Layout within Tailwind */
body {
overflow: auto !important;
}
#unity-container {
position: relative !important;
width: 960px !important;
height: 600px !important;
transform: none !important;
left: auto !important;
top: auto !important;
margin: 2rem auto 0 auto;
}
#unity-canvas {
width: 100% !important;
height: 100% !important;
background: #231F20;
border-radius: 0.5rem;
}
</style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans antialiased">
<nav class="bg-white shadow-sm sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<span class="text-xl font-bold text-blue-600">Jigsaw<span class="text-gray-900">Tutorial</span></span>
</div>
<div class="flex items-center space-x-4">
<a href="https://github.com/shamim-akhtar/jigsaw-puzzle/tree/main" target="_blank" class="text-gray-500 hover:text-gray-900 transition">
<i class="fab fa-github text-xl"></i> Source Code
</a>
<a href="https://www.youtube.com/watch?v=9mSwbMiV3lU" target="_blank" class="text-red-500 hover:text-red-700 transition">
<i class="fab fa-youtube text-xl"></i> Watch on YouTube
</a>
</div>
</div>
</div>
</nav>
<header class="bg-white border-b border-gray-200">
<div class="max-w-7xl mx-auto py-16 px-4 sm:px-6 lg:px-8 text-center">
<h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl">
Build a Jigsaw Puzzle Game <br>
<span class="text-blue-600">in Unity with C#</span>
</h1>
<p class="mt-4 max-w-2xl mx-auto text-xl text-gray-500">
Go in-depth and learn how to master Bézier curves, procedural generation, and game logic to build a complete Jigsaw game from scratch.
</p>
<div class="mt-8 flex justify-center gap-4 mb-12">
<a href="#sections" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Start Learning
</a>
<a href="https://faramira.com/downloads/jigsaw/assets_to_dowmload.zip" class="inline-flex items-center px-6 py-3 border border-gray-300 shadow-sm text-base font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
<i class="fas fa-download mr-2"></i> Download Assets
</a>
</div>
<div class="flex justify-center w-full">
<div id="unity-container" class="unity-desktop shadow-2xl rounded-lg overflow-hidden">
<canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-logo-title-footer"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">JigsawPuzzleGame</div>
</div>
</div>
</div>
<div class="max-w-4xl mx-auto mt-8 bg-green-50 border-l-4 border-green-500 p-6 rounded-r-lg shadow-sm text-left">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-play-circle text-green-500 text-xl"></i>
</div>
<div class="ml-3">
<p class="text-sm text-green-800 font-medium">
Click the <strong>Play</strong> button to solve the Jigsaw Puzzle.
Once you complete it, click Play again to play the next Jigsaw Puzzle with more tiles.
</p>
</div>
</div>
</div>
</div>
</header>
<section class="py-12 bg-gray-50">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
<h2 class="text-3xl font-extrabold text-gray-900 mb-8 text-center">Learning Objectives</h2>
<div class="bg-white overflow-hidden shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<ul class="space-y-4">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Understand the theory and math behind <strong>Bézier curves</strong>.</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Implement Bézier curves programmatically and visually within Unity.</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Apply Bézier curves to mathematically "cut" an image.</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Implement the <strong>Flood Fill algorithm</strong> to manipulate pixels within defined areas.</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Create jigsaw tiles dynamically from any source image.</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
<span>Develop problem-solving skills through debugging and C# logic implementation.</span>
</li>
</ul>
</div>
</div>
</div>
</section>
<section id="sections" class="py-16 bg-white">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<h2 class="text-3xl font-extrabold text-gray-900 mb-12 text-center">Tutorial Structure</h2>
<div class="grid gap-8 lg:grid-cols-2">
<div class="relative flex flex-col bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-lg transition-shadow duration-300">
<div class="p-6 flex-1">
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-xl font-bold mb-4">1</div>
<h3 class="text-xl font-bold text-gray-900">Implement Bézier Curve using C#</h3>
<p class="mt-2 text-gray-500">
We start with the mathematical foundation. Learn the formula for cubic Bézier curves and write the C# script to visualize them in the Unity Editor.
</p>
</div>
<div class="bg-gray-50 px-6 py-4 rounded-b-lg border-t border-gray-100">
<a href="Section1/index.html" class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none">
View Section 1 / Demo
</a>
</div>
</div>
<div class="relative flex flex-col bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-lg transition-shadow duration-300">
<div class="p-6 flex-1">
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-xl font-bold mb-4">2</div>
<h3 class="text-xl font-bold text-gray-900">Create a Jigsaw Tile from Image</h3>
<p class="mt-2 text-gray-500">
Move from lines to shapes. We will use the curves we created to slice an existing texture into a single puzzle piece shape.
</p>
</div>
<div class="bg-gray-50 px-6 py-4 rounded-b-lg border-t border-gray-100">
<a href="Section2/index.html" class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none">
View Section 2 / Demo
</a>
</div>
</div>
<div class="relative flex flex-col bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-lg transition-shadow duration-300">
<div class="p-6 flex-1">
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-xl font-bold mb-4">3</div>
<h3 class="text-xl font-bold text-gray-900">Create a Jigsaw Board from Image</h3>
<p class="mt-2 text-gray-500">
Scaling up. We will apply the logic to the entire image, generating a full grid of interlocking puzzle pieces programmatically.
</p>
</div>
<div class="bg-gray-50 px-6 py-4 rounded-b-lg border-t border-gray-100">
<a href="Section3/index.html" class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none">
View Section 3 / Demo
</a>
</div>
</div>
<div class="relative flex flex-col bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-lg transition-shadow duration-300">
<div class="p-6 flex-1">
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-xl font-bold mb-4">4</div>
<h3 class="text-xl font-bold text-gray-900">Create a Jigsaw Puzzle Game</h3>
<p class="mt-2 text-gray-500">
The final step. We add game logic: shuffling pieces, snapping them into place, detecting win conditions, and UI polish.
</p>
</div>
<div class="bg-gray-50 px-6 py-4 rounded-b-lg border-t border-gray-100">
<a href="Section4/index.html" class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none">
View Section 4 / Demo
</a>
</div>
</div>
</div>
</div>
</section>
<footer class="bg-gray-800">
<div class="max-w-7xl mx-auto py-12 px-4 overflow-hidden sm:px-6 lg:px-8">
<p class="mt-8 text-center text-base text-gray-400">
© 2026 Unity Jigsaw Tutorial. Created for educational purposes by Shamim Akhtar.
</p>
</div>
</footer>
<script>
var canvas = document.querySelector("#unity-canvas");
function unityShowBanner(msg, type) {
var warningBanner = document.querySelector("#unity-warning");
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
}
// Pointing to FinalGame/Build since this file is in the Root
var buildUrl = "FinalGame/Build";
var loaderUrl = buildUrl + "/Game.loader.js";
var config = {
arguments: [],
dataUrl: buildUrl + "/Game.data",
frameworkUrl: buildUrl + "/Game.framework.js",
codeUrl: buildUrl + "/Game.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "JigsawPuzzleGame",
productVersion: "1.0",
showBanner: unityShowBanner,
};
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
document.querySelector("#unity-container").className = "unity-mobile";
canvas.className = "unity-mobile";
} else {
canvas.style.width = "960px";
canvas.style.height = "600px";
}
document.querySelector("#unity-loading-bar").style.display = "block";
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
document.querySelector("#unity-progress-bar-full").style.width = 100 * progress + "%";
}).then((unityInstance) => {
document.querySelector("#unity-loading-bar").style.display = "none";
document.querySelector("#unity-fullscreen-button").onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
</body>
</html>