{"version":"https://jsonfeed.org/version/1.1","title":"Channel Title","home_page_url":"https://redink-pages-dev.pages.dev","feed_url":"https://redink-pages-dev.pages.dev/json/","description":"<style>\ncanvas {\n    border:1px solid #d3d3d3;\n    background-color: #f1f1f1;\n}\n</style>\n</head>\n<body onload=\"startGame()\">\n<script>\n\nvar myGamePiece;\nvar myObstacles = [];\nvar myScore;\n\nfunction startGame() {\n    myGamePiece = new component(30, 30, \"red\", 10, 120);\n    myGamePiece.gravity = 0.05;\n    myScore = new component(\"30px\", \"Consolas\", \"black\", 280, 40, \"text\");\n    myGameArea.start();\n}\n\nvar myGameArea = {\n    canvas : document.createElement(\"canvas\"),\n    start : function() {\n        this.canvas.width = 480;\n        this.canvas.height = 270;\n        this.context = this.canvas.getContext(\"2d\");\n        document.body.insertBefore(this.canvas, document.body.childNodes[0]);\n        this.frameNo = 0;\n        this.interval = setInterval(updateGameArea, 20);\n        },\n    clear : function() {\n        this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n    }\n}\n\nfunction component(width, height, color, x, y, type) {\n    this.type = type;\n    this.score = 0;\n    this.width = width;\n    this.height = height;\n    this.speedX = 0;\n    this.speedY = 0;    \n    this.x = x;\n    this.y = y;\n    this.gravity = 0;\n    this.gravitySpeed = 0;\n    this.update = function() {\n        ctx = myGameArea.context;\n        if (this.type == \"text\") {\n            ctx.font = this.width + \" \" + this.height;\n            ctx.fillStyle = color;\n            ctx.fillText(this.text, this.x, this.y);\n        } else {\n            ctx.fillStyle = color;\n            ctx.fillRect(this.x, this.y, this.width, this.height);\n        }\n    }\n    this.newPos = function() {\n        this.gravitySpeed += this.gravity;\n        this.x += this.speedX;\n        this.y += this.speedY + this.gravitySpeed;\n        this.hitBottom();\n    }\n    this.hitBottom = function() {\n        var rockbottom = myGameArea.canvas.height - this.height;\n        if (this.y > rockbottom) {\n            this.y = rockbottom;\n            this.gravitySpeed = 0;\n        }\n    }\n    this.crashWith = function(otherobj) {\n        var myleft = this.x;\n        var myright = this.x + (this.width);\n        var mytop = this.y;\n        var mybottom = this.y + (this.height);\n        var otherleft = otherobj.x;\n        var otherright = otherobj.x + (otherobj.width);\n        var othertop = otherobj.y;\n        var otherbottom = otherobj.y + (otherobj.height);\n        var crash = true;\n        if ((mybottom < othertop) || (mytop > otherbottom) || (myright < otherleft) || (myleft > otherright)) {\n            crash = false;\n        }\n        return crash;\n    }\n}\n\nfunction updateGameArea() {\n    var x, height, gap, minHeight, maxHeight, minGap, maxGap;\n    for (i = 0; i < myObstacles.length; i += 1) {\n        if (myGamePiece.crashWith(myObstacles[i])) {\n            return;\n        } \n    }\n    myGameArea.clear();\n    myGameArea.frameNo += 1;\n    if (myGameArea.frameNo == 1 || everyinterval(150)) {\n        x = myGameArea.canvas.width;\n        minHeight = 20;\n        maxHeight = 200;\n        height = Math.floor(Math.random()*(maxHeight-minHeight+1)+minHeight);\n        minGap = 50;\n        maxGap = 200;\n        gap = Math.floor(Math.random()*(maxGap-minGap+1)+minGap);\n        myObstacles.push(new component(10, height, \"green\", x, 0));\n        myObstacles.push(new component(10, x - height - gap, \"green\", x, height + gap));\n    }\n    for (i = 0; i < myObstacles.length; i += 1) {\n        myObstacles[i].x += -1;\n        myObstacles[i].update();\n    }\n    myScore.text=\"SCORE: \" + myGameArea.frameNo;\n    myScore.update();\n    myGamePiece.newPos();\n    myGamePiece.update();\n}\n\nfunction everyinterval(n) {\n    if ((myGameArea.frameNo / n) % 1 == 0) {return true;}\n    return false;\n}\n\nfunction accelerate(n) {\n    myGamePiece.gravity = n;\n}\n</script>\n<br>\n<button onmousedown=\"accelerate(-0.2)\" onmouseup=\"accelerate(0.05)\">ACCELERATE</button>\n<p>Use the ACCELERATE button to stay in the air</p>\n<p>How long can you stay alive?</p>","icon":"https://walbima.site/redink-pages-dev/production/images/channel-5033a4c716dfa7b1dae2b4cea5e423f9.jpg","favicon":"https://redink-pages-dev.pages.dev/assets/default/favicon.png","authors":[{"name":"Publisher Name"}],"language":"en-us","items":[],"_microfeed":{"microfeed_version":"0.1.2","base_url":"https://redink-pages-dev.pages.dev","categories":[{"name":"Science","categories":[{"name":"Social Sciences"}]}],"subscribe_methods":[{"name":"RSS","type":"rss","url":"https://redink-pages-dev.pages.dev/rss/","image":"https://redink-pages-dev.pages.dev/assets/brands/subscribe/rss.png","enabled":true,"editable":false,"id":"Cl1lbLORGmn"},{"name":"JSON","type":"json","url":"https://redink-pages-dev.pages.dev/json/","image":"https://redink-pages-dev.pages.dev/assets/brands/subscribe/json.png","enabled":true,"editable":false,"id":"X6fgKq5cf0x"}],"description_text":"\nACCELERATE\n\nUse the ACCELERATE button to stay in the air\n\nHow long can you stay alive?","copyright":"©2024","itunes:type":"episodic","items_sort_order":"newest_first"}}