-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c58cd2
commit 0e2a248
Showing
17 changed files
with
751 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!DOCTYPE | ||
html> | ||
<html | ||
lang="en"> | ||
<head> | ||
<meta | ||
charset="utf-8"> | ||
<title> | ||
handle | ||
</title> | ||
<meta | ||
name="viewport" | ||
content="width=device-width"/> | ||
<style> | ||
/* mobile */ | ||
canvas { | ||
border:1px solid #d3d3d3; | ||
background-color: #f1f1f1; | ||
|
||
} | ||
</style> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="./server/files/main.css"> | ||
</head> | ||
<body> | ||
<body onload="startGame()"> | ||
<script> | ||
|
||
var myGamePiece; | ||
|
||
function startGame() { | ||
myGamePiece = new component(30, 30, "red", 10, 120); | ||
myGameArea.start(); | ||
} | ||
|
||
var myGameArea = { | ||
canvas : document.createElement("canvas"), | ||
start : function() { | ||
this.canvas.width = 320; | ||
this.canvas.height = 200; | ||
this.context = this.canvas.getContext("2d"); | ||
document.body.insertBefore(this.canvas, document.body.childNodes[0]); | ||
this.interval = setInterval(updateGameArea, 20); | ||
}, | ||
clear : function() { | ||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); | ||
} | ||
} | ||
|
||
function component(width, height, color, x, y) { | ||
this.width = width; | ||
this.height = height; | ||
this.speedX = 0; | ||
this.speedY = 0; | ||
this.x = x; | ||
this.y = y; | ||
this.update = function() { | ||
ctx = myGameArea.context; | ||
ctx.fillStyle = color; | ||
ctx.fillRect(this.x, this.y, this.width, this.height); | ||
} | ||
this.newPos = function() { | ||
this.x += this.speedX; | ||
this.y += this.speedY; | ||
} | ||
} | ||
|
||
function updateGameArea() { | ||
myGameArea.clear(); | ||
myGamePiece.newPos(); | ||
myGamePiece.update(); | ||
} | ||
|
||
function moveup() { | ||
myGamePiece.speedY -= 1; | ||
} | ||
|
||
function movedown() { | ||
myGamePiece.speedY += 1; | ||
} | ||
|
||
function moveleft() { | ||
myGamePiece.speedX -= 1; | ||
} | ||
|
||
function moveright() { | ||
myGamePiece.speedX += 1; | ||
} | ||
</script> | ||
<a | ||
href="./index.html" | ||
class="handle"> | ||
start game | ||
</a> | ||
<div style="text-align:center;width:320px;"> | ||
<button onclick="moveup()">UP</button><br><br> | ||
<button onclick="moveleft()">LEFT</button> | ||
<button onclick="moveright()">RIGHT</button><br><br> | ||
<button onclick="movedown()">DOWN</button> | ||
</div> | ||
<center> | ||
<br> | ||
<br> | ||
<ul id="list"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
|
||
<title>Fetch text example</title> | ||
|
||
<link rel="stylesheet" href="style.css" /> | ||
</head> | ||
|
||
<body> | ||
<h1>Fetch text example</h1> | ||
<ul> | ||
<li><a data-page="page1">Page 1</a></li> | ||
<li><a data-page="page2">Page 2</a></li> | ||
<li><a data-page="page3">Page 3</a></li> | ||
</ul> | ||
<article></article> | ||
|
||
<script> | ||
const myArticle = document.querySelector("article"); | ||
const myLinks = document.querySelectorAll("ul a"); | ||
for (const link of myLinks) { | ||
link.onclick = (e) => { | ||
e.preventDefault(); | ||
const linkData = e.target.getAttribute("data-page"); | ||
getData(linkData); | ||
}; | ||
} | ||
|
||
function getData(pageId) { | ||
console.log(pageId); | ||
const myRequest = new Request(`${pageId}.txt`); | ||
|
||
fetch(myRequest) | ||
.then((response) => { | ||
if (!response.ok) { | ||
throw new Error(`HTTP error, status = ${response.status}`); | ||
} | ||
return response.text(); | ||
}) | ||
.then((text) => { | ||
myArticle.innerText = text; | ||
}) | ||
.catch((error) => { | ||
myArticle.innerText = `Error: ${error.message}`; | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Page 1: A desparate journey | ||
|
||
This is the first exciting part of our story! Once upon a time, a man was creeping into a dark forest, to try to find the woodcutter's cottage. Somewhere, an owl hooted. A feeling of lingering dread spread all over his body, but he pressed on regardless. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Page 2: Light at the end of the tunnel | ||
|
||
Brambles tugged at his clothes, and the rain lashed down, making our hero bruised and cold. when hope was all but lost, he noticed a dim light shining through the trees — this must be the woodcutter's cottage. This very sight spurred him to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Page 3: The end unseen? | ||
|
||
A kilometer or so more, and the cottage was now in sight — our hero could see lights shining in the windows, and a figure shuffling around within! This was the moment he was waiting for surely! He tiptoed up to the door, and carefully tried the handle. Fnding it unlocked, he burst open the door and shouted "your time has come, scoundrel..!" He was slightly disappointed to come face to face with a slightly scared dog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
html { | ||
font-family: sans-serif; | ||
} | ||
|
||
h1, | ||
h2 { | ||
text-align: center; | ||
} | ||
|
||
article { | ||
width: 300px; | ||
min-height: 480px; | ||
margin: 0 auto; | ||
padding: 10px; | ||
background-image: repeating-linear-gradient( | ||
to bottom, | ||
transparent 1px, | ||
transparent 20px, | ||
rgb(0, 0, 150) 21px | ||
), | ||
linear-gradient(to bottom right, white, #ccc); | ||
border-radius: 20px; | ||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.7); | ||
line-height: 1.5; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding-left: 0; | ||
width: 480px; | ||
margin: 0 auto; | ||
padding-bottom: 30px; | ||
} | ||
|
||
li { | ||
float: left; | ||
width: 33%; | ||
} | ||
|
||
ul li a { | ||
display: block; | ||
text-align: center; | ||
color: blue; | ||
text-decoration: underline; | ||
cursor: pointer; | ||
} | ||
|
||
ul li a:hover, | ||
ul li a:focus { | ||
text-decoration: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 LeoMoon Studios | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.