π΄σ §σ ’σ ³σ £σ ΄σ Ώ Gaelic AR Adventure
Ready to play! Here’s how:
Quick Start Guide
1. Tap the button below
2. Allow camera access
3. Collect floating words!
Need Help?
If the game doesn’t start, find this file in your Downloads and tap “Open with Chrome”
If the game doesn’t start, find this file in your Downloads and tap “Open with Chrome”
π΄σ §σ ’σ ³σ £σ ΄σ Ώ Gaelic AR Adventure
Learn Scottish Gaelic through Augmented Reality!
Start Adventure
View Words
π΄σ §σ ’σ ³σ £σ ΄σ Ώ Gaelic AR
Collected: 0/5
Move around and tap floating words!
β Back
function startApp() {
document.getElementById(‘browserHelp’).style.display = ‘none’;
showScreen(‘welcomeScreen’);
}
const GAELIC_DATABASE = [
{ word: “madainn mhath”, translation: “good morning”, emoji: “βοΈ”, pronunciation: “MAH-teen vah” },
{ word: “tapadh leat”, translation: “thank you”, emoji: “π”, pronunciation: “TAH-pah let” },
{ word: “slΓ inte”, translation: “cheers”, emoji: “π»”, pronunciation: “SLAWN-chuh” },
{ word: “cΓΉ”, translation: “dog”, emoji: “π”, pronunciation: “koo” },
{ word: “cat”, translation: “cat”, emoji: “π”, pronunciation: “kaht” }
];
let collectedWords = [];
let currentGameWords = [];
function showScreen(screenId) {
document.getElementById(‘welcomeScreen’).style.display = ‘none’;
document.getElementById(‘gameScreen’).style.display = ‘none’;
document.getElementById(‘collectionScreen’).style.display = ‘none’;
document.getElementById(screenId).style.display = ‘flex’;
}
function startGame() {
currentGameWords = […GAELIC_DATABASE].sort(() => 0.5 – Math.random()).slice(0, 3);
collectedWords = [];
document.getElementById(‘count’).textContent = ‘0’;
initializeARScene();
showScreen(‘gameScreen’);
}
function initializeARScene() {
const scene = document.querySelector(‘a-scene’);
scene.querySelectorAll(‘[gaelic-word]’).forEach(word => word.remove());
currentGameWords.forEach((wordData) => {
const wordEntity = document.createElement(‘a-entity’);
wordEntity.setAttribute(‘gaelic-word’, `word:${wordData.word};translation:${wordData.translation};emoji:${wordData.emoji}`);
const text = document.createElement(‘a-text’);
text.setAttribute(‘value’, `${wordData.emoji}\n${wordData.word}\n${wordData.translation}`);
text.setAttribute(‘align’, ‘center’);
text.setAttribute(‘color’, ‘white’);
text.setAttribute(‘position’, ‘0 0.5 0’);
const bg = document.createElement(‘a-plane’);
bg.setAttribute(‘color’, ‘#0065FF’);
bg.setAttribute(‘height’, ‘0.8’);
bg.setAttribute(‘width’, ‘1.8’);
bg.setAttribute(‘position’, ‘0 0.3 0’);
wordEntity.appendChild(bg);
wordEntity.appendChild(text);
const x = (Math.random() – 0.5) * 3;
const y = Math.random() * 1 + 0.5;
const z = -1.5 – Math.random();
wordEntity.setAttribute(‘position’, `${x} ${y} ${z}`);
wordEntity.addEventListener(‘click’, function() {
if (!collectedWords.find(w => w.word === wordData.word)) {
collectedWords.push(wordData);
document.getElementById(‘count’).textContent = collectedWords.length;
document.getElementById(‘collectedWords’).innerHTML = collectedWords.map(word =>
`Word Collection
Progress: 0/10
${word.emoji} ${word.word}
`
).join(”);
this.parentNode.removeChild(this);
}
});
scene.appendChild(wordEntity);
});
}
function showCollection() {
document.getElementById(‘collectionCount’).textContent = collectedWords.length;
document.getElementById(‘totalCollection’).textContent = GAELIC_DATABASE.length;
document.getElementById(‘collectionGrid’).innerHTML = GAELIC_DATABASE.map(word => {
const isCollected = collectedWords.some(collected => collected.word === word.word);
return `${word.emoji}
${word.word}
${word.translation}
${isCollected ? ‘β Collected
‘ : ”}
Leave a Reply