{"id":3638,"date":"2024-06-27T12:58:46","date_gmt":"2024-06-27T10:58:46","guid":{"rendered":"https:\/\/hicad-help.com\/?page_id=3638"},"modified":"2024-06-27T13:15:08","modified_gmt":"2024-06-27T11:15:08","slug":"games","status":"publish","type":"page","link":"https:\/\/hicad-help.com\/en\/games\/","title":{"rendered":"Games"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"de\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Vereinfachtes Tetris<\/title>\n    <style>\n        body {\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            height: 100vh;\n            margin: 0;\n            background-color: #003366;\n            font-family: Arial, sans-serif;\n            color: #FFFFFF;\n        }\n        #gameContainer {\n            text-align: center;\n        }\n        #gameCanvas {\n            border: 2px solid #FFFFFF;\n            background-color: rgba(0, 51, 102, 0.8);\n        }\n        #scoreInfo {\n            margin-top: 20px;\n            font-size: 18px;\n        }\n        #startButton {\n            margin-top: 20px;\n            padding: 10px 20px;\n            font-size: 18px;\n            background-color: #33FF99;\n            color: #003366;\n            border: none;\n            cursor: pointer;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div id=\"gameContainer\">\n        <canvas id=\"gameCanvas\" width=\"300\" height=\"600\"><\/canvas>\n        <div id=\"scoreInfo\">Punkte: <span id=\"score\">0<\/span><\/div>\n        <button id=\"startButton\">Spiel starten<\/button>\n    <\/div>\n\n    <script>\n    const canvas = document.getElementById('gameCanvas');\n    const ctx = canvas.getContext('2d');\n    const scoreElement = document.getElementById('score');\n    const startButton = document.getElementById('startButton');\n\n    const ROWS = 20;\n    const COLS = 10;\n    const BLOCK_SIZE = 30;\n    const COLORS = ['#FF9933', '#33FF99', '#9933FF', '#FF3366', '#FFFF66', '#66FFFF', '#FF6633'];\n\n    let board = Array(ROWS).fill().map(() => Array(COLS).fill(0));\n    let score = 0;\n    let currentPiece = null;\n    let gameActive = false;\n\n    \/\/ F\u00fcgen Sie diesen Code am Ende des <script>-Tags hinzu\n\nconst pieces = [\n    [[1, 1, 1, 1]],   \/\/ I\n    [[1, 1], [1, 1]], \/\/ O\n    [[1, 1, 1], [0, 1, 0]], \/\/ T\n    [[1, 1, 1], [1, 0, 0]], \/\/ L\n    [[1, 1, 1], [0, 0, 1]], \/\/ J\n    [[0, 1, 1], [1, 1, 0]], \/\/ S\n    [[1, 1, 0], [0, 1, 1]]  \/\/ Z\n];\n\nfunction createPiece() {\n    const piece = pieces[Math.floor(Math.random() * pieces.length)];\n    return {\n        shape: piece,\n        pos: {x: Math.floor(COLS \/ 2) - Math.floor(piece[0].length \/ 2), y: 0},\n        color: COLORS[Math.floor(Math.random() * COLORS.length)]\n    };\n}\n\nfunction drawBoard() {\n    board.forEach((row, y) => {\n        row.forEach((value, x) => {\n            if (value) {\n                ctx.fillStyle = COLORS[value - 1];\n                ctx.fillRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);\n                ctx.strokeStyle = '#FFFFFF';\n                ctx.strokeRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);\n            }\n        });\n    });\n}\n\nfunction drawPiece() {\n    currentPiece.shape.forEach((row, y) => {\n        row.forEach((value, x) => {\n            if (value) {\n                ctx.fillStyle = currentPiece.color;\n                ctx.fillRect((currentPiece.pos.x + x) * BLOCK_SIZE, (currentPiece.pos.y + y) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);\n                ctx.strokeStyle = '#FFFFFF';\n                ctx.strokeRect((currentPiece.pos.x + x) * BLOCK_SIZE, (currentPiece.pos.y + y) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);\n            }\n        });\n    });\n}\n\nfunction merge() {\n    currentPiece.shape.forEach((row, y) => {\n        row.forEach((value, x) => {\n            if (value) {\n                board[y + currentPiece.pos.y][x + currentPiece.pos.x] = COLORS.indexOf(currentPiece.color) + 1;\n            }\n        });\n    });\n}\n\nfunction collide() {\n    return currentPiece.shape.some((row, y) => \n        row.some((value, x) => \n            value && (\n                board[y + currentPiece.pos.y] === undefined ||\n                board[y + currentPiece.pos.y][x + currentPiece.pos.x] === undefined ||\n                board[y + currentPiece.pos.y][x + currentPiece.pos.x] !== 0\n            )\n        )\n    );\n}\n\nfunction rotate() {\n    const rotated = currentPiece.shape[0].map((_, i) => \n        currentPiece.shape.map(row => row[i]).reverse()\n    );\n    const previousShape = currentPiece.shape;\n    currentPiece.shape = rotated;\n    if (collide()) {\n        currentPiece.shape = previousShape;\n    }\n}\n\nfunction clearLines() {\n    let linesCleared = 0;\n    outer: for (let y = board.length - 1; y >= 0; y--) {\n        for (let x = 0; x < board[y].length; x++) {\n            if (board[y][x] === 0) {\n                continue outer;\n            }\n        }\n        const row = board.splice(y, 1)[0].fill(0);\n        board.unshift(row);\n        linesCleared++;\n        y++;\n    }\n    if (linesCleared > 0) {\n        score += linesCleared * 100;\n        scoreElement.textContent = score;\n    }\n}\n    <\/script>\n\n\/\/ F\u00fcgen Sie diesen Code am Ende des <script>-Tags hinzu\n\nlet dropCounter = 0;\nlet dropInterval = 1000;\nlet lastTime = 0;\n\nfunction update(time = 0) {\n    if (!gameActive) return;\n\n    const deltaTime = time - lastTime;\n    lastTime = time;\n\n    dropCounter += deltaTime;\n    if (dropCounter > dropInterval) {\n        drop();\n    }\n\n    draw();\n    requestAnimationFrame(update);\n}\n\nfunction draw() {\n    ctx.clearRect(0, 0, canvas.width, canvas.height);\n    drawBoard();\n    drawPiece();\n}\n\nfunction drop() {\n    currentPiece.pos.y++;\n    if (collide()) {\n        currentPiece.pos.y--;\n        merge();\n        clearLines();\n        currentPiece = createPiece();\n        if (collide()) {\n            gameOver();\n        }\n    }\n    dropCounter = 0;\n}\n\nfunction moveHorizontally(direction) {\n    currentPiece.pos.x += direction;\n    if (collide()) {\n        currentPiece.pos.x -= direction;\n    }\n}\n\nfunction gameOver() {\n    gameActive = false;\n    ctx.fillStyle = 'rgba(0, 0, 0, 0.75)';\n    ctx.fillRect(0, 0, canvas.width, canvas.height);\n    ctx.fillStyle = '#FFFFFF';\n    ctx.font = '30px Arial';\n    ctx.textAlign = 'center';\n    ctx.fillText('Game Over', canvas.width \/ 2, canvas.height \/ 2);\n    startButton.style.display = 'block';\n    startButton.textContent = 'Neues Spiel';\n}\n\nfunction startGame() {\n    board = Array(ROWS).fill().map(() => Array(COLS).fill(0));\n    score = 0;\n    scoreElement.textContent = score;\n    currentPiece = createPiece();\n    gameActive = true;\n    startButton.style.display = 'none';\n    update();\n}\n\ndocument.addEventListener('keydown', event => {\n    if (!gameActive) return;\n\n    if (event.keyCode === 37) {\n        moveHorizontally(-1);\n    } else if (event.keyCode === 39) {\n        moveHorizontally(1);\n    } else if (event.keyCode === 40) {\n        drop();\n    } else if (event.keyCode === 38) {\n        rotate();\n    }\n});\n\nstartButton.addEventListener('click', startGame);\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Vereinfachtes Tetris Punkte: 0 Spiel starten \/\/ F\u00fcgen Sie diesen Code am Ende des -Tags hinzu let dropCounter = 0; let dropInterval = 1000; let lastTime = 0; function update(time = 0) { if (!gameActive) return; const deltaTime = time &#8211; lastTime; lastTime = time; dropCounter += deltaTime; if (dropCounter > dropInterval) { drop(); } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"pmpro_default_level":"","footnotes":""},"class_list":["post-3638","page","type-page","status-publish","hentry","pmpro-has-access","post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Games - hicad-help.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hicad-help.com\/en\/games\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Games - hicad-help.com\" \/>\n<meta property=\"og:description\" content=\"Vereinfachtes Tetris Punkte: 0 Spiel starten \/\/ F\u00fcgen Sie diesen Code am Ende des -Tags hinzu let dropCounter = 0; let dropInterval = 1000; let lastTime = 0; function update(time = 0) { if (!gameActive) return; const deltaTime = time - lastTime; lastTime = time; dropCounter += deltaTime; if (dropCounter &gt; dropInterval) { drop(); } [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hicad-help.com\/en\/games\/\" \/>\n<meta property=\"og:site_name\" content=\"hicad-help.com\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-27T11:15:08+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/games\\\/\",\"url\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/games\\\/\",\"name\":\"Games - hicad-help.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/#website\"},\"datePublished\":\"2024-06-27T10:58:46+00:00\",\"dateModified\":\"2024-06-27T11:15:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/games\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/games\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/games\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Games\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/#website\",\"url\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/\",\"name\":\"hicad-help.com\",\"description\":\"Hilfeseite f\u00fcr HiCAD\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/hicad-help.com\\\/de_de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Games - hicad-help.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hicad-help.com\/en\/games\/","og_locale":"en_US","og_type":"article","og_title":"Games - hicad-help.com","og_description":"Vereinfachtes Tetris Punkte: 0 Spiel starten \/\/ F\u00fcgen Sie diesen Code am Ende des -Tags hinzu let dropCounter = 0; let dropInterval = 1000; let lastTime = 0; function update(time = 0) { if (!gameActive) return; const deltaTime = time - lastTime; lastTime = time; dropCounter += deltaTime; if (dropCounter > dropInterval) { drop(); } [&hellip;]","og_url":"https:\/\/hicad-help.com\/en\/games\/","og_site_name":"hicad-help.com","article_modified_time":"2024-06-27T11:15:08+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/hicad-help.com\/de_de\/games\/","url":"https:\/\/hicad-help.com\/de_de\/games\/","name":"Games - hicad-help.com","isPartOf":{"@id":"https:\/\/hicad-help.com\/de_de\/#website"},"datePublished":"2024-06-27T10:58:46+00:00","dateModified":"2024-06-27T11:15:08+00:00","breadcrumb":{"@id":"https:\/\/hicad-help.com\/de_de\/games\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hicad-help.com\/de_de\/games\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/hicad-help.com\/de_de\/games\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/hicad-help.com\/de_de\/"},{"@type":"ListItem","position":2,"name":"Games"}]},{"@type":"WebSite","@id":"https:\/\/hicad-help.com\/de_de\/#website","url":"https:\/\/hicad-help.com\/de_de\/","name":"hicad-help.com","description":"Help page for HiCAD","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hicad-help.com\/de_de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/pages\/3638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/comments?post=3638"}],"version-history":[{"count":0,"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/pages\/3638\/revisions"}],"wp:attachment":[{"href":"https:\/\/hicad-help.com\/en\/wp-json\/wp\/v2\/media?parent=3638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}