Skip to content

Commit

Permalink
small fixes and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
twhlynch committed May 4, 2024
1 parent 760d3ed commit 9817703
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class Controls extends EventDispatcher {

function onDown() {

this.touchStartX = event.touches ? event.touches[ 0 ].clientX : event.clientX;
this.touchStartY = event.touches ? event.touches[ 0 ].clientY : event.clientY;
this.isActive = true;

}
Expand Down
7 changes: 5 additions & 2 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let clock = new THREE.Clock();
let isLoading = true;
let answer = undefined;
let score = 0;
let difficulty = 100;
let difficulty = 500;
let verifiedLevels = fetch("https://grab-tools.live/stats_data/all_verified.json").then(response => response.json());

let materialList = [
Expand Down Expand Up @@ -469,7 +469,10 @@ async function loadSearch() {
const query = document.getElementById("search").value;
document.getElementById("cards").innerHTML = "";
verifiedLevels.then(levels => {
let results = levels.filter(l => l.title.toLowerCase().replace(" ", "").includes(query.toLowerCase().replace(" ", "")));
let results = levels.filter(l => (
l.title.toLowerCase().replace(" ", "").includes(query.toLowerCase().replace(" ", "")) ||
(l?.creators || []).toString().toLowerCase().replace(" ", "").includes(query.toLowerCase().replace(" ", ""))
));
if (results.length > 0) {
for (let i = 0; i < Math.min(results.length, 100); i++) {
let card = document.createElement("div");
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<body>
<main id="viewport"></main>
<menu id="main-controls">
<span id="score">Score: 0</span>
<button id="randomButton">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3" />
Expand All @@ -54,7 +55,6 @@
<div id="cards">
</div>
</section>
<span id="score">Score: 0</span>
<div id="difficulty">
<button class="diff" id="100">Obvious</button>
<button class="diff difficulty" id="500">Easy</button>
Expand Down
27 changes: 14 additions & 13 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,39 @@ body {
#main-controls {
display: flex;
gap: 10px;
justify-content: center;
justify-content: space-between;
align-items: center;
flex-direction: row;
width: calc(100svw - 20px);
width: 100svw;
height: fit-content;
position: fixed;
top: 0;
right: 0;
padding: 20px;
padding: 0 5px;
z-index: 10;
border-bottom: 1px solid rgb(255, 255, 255);
background: rgba(0, 0, 0, 0.1);
color: rgb(255, 255, 255);
}
menu button {
width: 50px;
height: 50px;
width: 40px;
height: 40px;
margin: 0;
cursor: pointer;
padding: 12px 6px;
border: 1px solid rgb(255, 255, 255);
border-radius: 4px;
background: rgba(0, 0, 0, 0.1);
color: rgb(255, 255, 255);
padding: 0;
font: 13px sans-serif;
text-align: center;
opacity: 0.5;
outline: none;
border: none;
border-radius: 4px;
background: transparent;
color: rgb(255, 255, 255);
}
menu svg {
height: 24px;
width: 24px;
color: white;
}
#guessing {
display: grid;
Expand Down Expand Up @@ -167,9 +171,6 @@ menu svg {
gap: 10px;
padding: 10px;
margin: 0;
position: fixed;
top: 0;
left: 0;
color: white;
}
#difficulty {
Expand Down

0 comments on commit 9817703

Please sign in to comment.