Skip to content

Commit

Permalink
v1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-code authored Mar 28, 2022
2 parents 134bb1b + 1caa866 commit 30fb6bc
Show file tree
Hide file tree
Showing 33 changed files with 38,501 additions and 255 deletions.
11 changes: 10 additions & 1 deletion dist/admin/add-project/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
</svg>
</a>
<a href="../games/index.html" class="app-sidebar-link" style="display: block;padding: 8px;">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-joystick" viewBox="0 0 24 24">
<path d="M10 2a2 2 0 0 1-1.5 1.937v5.087c.863.083 1.5.377 1.5.726 0 .414-.895.75-2 .75s-2-.336-2-.75c0-.35.637-.643 1.5-.726V3.937A2 2 0 1 1 10 2z"/>
<path d="M0 9.665v1.717a1 1 0 0 0 .553.894l6.553 3.277a2 2 0 0 0 1.788 0l6.553-3.277a1 1 0 0 0 .553-.894V9.665c0-.1-.06-.19-.152-.23L9.5 6.715v.993l5.227 2.178a.125.125 0 0 1 .001.23l-5.94 2.546a2 2 0 0 1-1.576 0l-5.94-2.546a.125.125 0 0 1 .001-.23L6.5 7.708l-.013-.988L.152 9.435a.25.25 0 0 0-.152.23z"/>
</svg>
</a>
<a href="../settings/index.html" class="app-sidebar-link">
<svg class="link-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="feather feather-settings" viewBox="0 0 24 24">
<defs />
Expand All @@ -110,7 +116,7 @@
</header>
<div class="main-layout">
<div class="result">
<iframe data-tab="html" src="./"></iframe>
<iframe data-tab="html" src="./results/index.html"></iframe>
</div>

<div class="splitter" data-splitter="yes"></div>
Expand All @@ -128,6 +134,9 @@
<!--the world is your oyster-->
<!--add your HTML here & watch the magic happen!-->
<!-- still under development -->
&lt;div class="test"&gt;
&lt;h1&gt;Test&lt;/h1&gt;
&lt;/div&gt;
</textarea>

</div>
Expand Down
2 changes: 2 additions & 0 deletions dist/admin/add-project/results/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
<link rel="stylesheet" href="./styles.css" />
</head>
<body>
<div class="test">
<h1>Test</h1>
</div>
</body>
<script src="./script.js"></script>
</html>
1 change: 1 addition & 0 deletions dist/admin/add-project/results/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var test = '';
Binary file added dist/admin/games/assets/baseball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/admin/games/assets/codepen-lifesim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/admin/games/assets/derby.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/admin/games/assets/kill-king.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/admin/games/assets/lighthouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions dist/admin/games/baseball/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Baseball - Home Run </title>
<link rel="stylesheet" href="./style.css">
<link href="https://straight-code.github.io/assets/straight-code.png" rel="shortcut icon" />
</head>
<body>
<!-- partial:index.partial.html -->
<!-- I apologize for the janky gameplay on mobile Safari-->
<div id='game_console'>
<div id='ballpark'>
<div id='scoreboard'></div>
<div id='pitcher'></div>
<div id='batter' class=''></div>
<div id='ball' style='left: 43%; top: 58.5%;'></div>
</div>
<div id='homeruns'>0</div>
<div id='outs'>0</div>
<div id='start_screen'><span>T</span><span>A</span><span>P</span> <span>T</span><span>O</span> <span>P</span><span>L</span><span>A</span><span>Y</span>
<p>Tap to throw pitch<br>Tap again to swing</p>
</div>
</div>

<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap" rel="stylesheet">

<audio src="http://contentservice.mc.reyrey.net/audio_v1.0.0/?id=d1f9b7da-033e-5f86-94e6-4500351eb570" id='back_sound' preload loop></audio>
<audio src="http://contentservice.mc.reyrey.net/audio_v1.0.0/?id=4b11ab1d-fdba-569d-b932-1974bde0671a" id='bat_hit' preload></audio>
<audio src="http://contentservice.mc.reyrey.net/audio_v1.0.0/?id=b916d76b-e068-55e0-bfae-5833b9c3004f" id='clapping' preload></audio>
<!-- partial -->
<script src="./script.js"></script>

</body>
</html>
133 changes: 133 additions & 0 deletions dist/admin/games/baseball/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
const gc = document.querySelector('#game_console')
const ss = document.querySelector('#start_screen')
const ball = document.querySelector('#ball')
const batter = document.querySelector('#batter')
const pitcher = document.querySelector('#pitcher')
const bp = document.querySelector('#ballpark')
const homers = document.querySelector('#homeruns')
const outss = document.querySelector('#outs')
const sb = document.querySelector('#scoreboard')
const backingTrack = document.querySelector('#back_sound')
const hitBall = document.querySelector('#bat_hit')
const clapping = document.querySelector('#clapping')

var thrown = false;
const hr = [6,7,8,14,15,16,22,23,24]
var homeruns = 0
var outs = 0

var b_loc = ball.getBoundingClientRect()
var x = b_loc.x
const start_x = b_loc.x
var y = b_loc.y
const start_y = b_loc.y


function throwPitch() {
if(thrown){
bp.removeEventListener('click', throwPitch)
batter.classList.add('swing')
var bp_loc = bp.getBoundingClientRect()
var b_loc = ball.getBoundingClientRect()
var dist = Math.round(Math.hypot(0, (bp_loc.y + bp_loc.height) - (b_loc.y + (b_loc.height*.5))))
// console.log(dist)

if(dist <= 30) {
hitBall.play()
ball.style.transition = '2s'
ball.classList.add('hit_ball')
bp.classList.add('alt_bp')

if(hr.includes(dist)) {
clapping.play()
homeruns++
homers.innerHTML = homeruns
sb.innerHTML = 'HOME<br>RUN'
gc.classList.add('hr_sparkle')
if([22,23,24].includes(dist)) {
ball.style.left = (30 - dist) / 4 * 100 + '%'
ball.style.top = '-600px'
}
if([14,15,16].includes(dist)) {
ball.style.left = '800px'
ball.style.top = '-400px'
}
if([6,7,8].includes(dist)) {
ball.style.left = '1000px'
ball.style.top = 100 - (dist / 4 * 100) + '%'
}
} else {
if(dist >= 17) {
ball.style.left = ((30 - dist) * 11.11) + 1 + '%'
ball.style.top = Math.random() < .5 ? -Math.random()*100 + '%' : -Math.random()*100 + '%';
}
if(dist <= 13) {
ball.style.left = Math.random()*150 + 50 + '%'
ball.style.top = 99 - (dist * 11.11) + '%'
}
}
if(!hr.includes(dist)) {
outs++
outss.innerHTML = outs
sb.innerHTML = 'OUT'
}
}

setTimeout(function(){
if(outs == 3) {
ss.style.display = 'block'
bp.classList.remove('alt_bp')
ball.classList.remove('hit_ball')
ball.style.transition = ''
ball.style.left = '43%'
ball.style.top = '58.5%'
batter.classList.remove('swing')
gc.classList.remove('hr_sparkle')
} else {
thrown = false
bp.addEventListener('click', throwPitch)
bp.classList.remove('alt_bp')
ball.classList.remove('hit_ball')
ball.style.transition = ''
ball.style.left = '43%'
ball.style.top = '58.5%'
batter.classList.remove('swing')
gc.classList.remove('hr_sparkle')
}
}, 2500)
}

if(!thrown) {
thrown = true
var speed = Math.random() + 1.25
ball.style.transition = speed + 's'
ball.style.left = '-58px'
ball.style.top = 'calc(100% + 50px)'
clapping.pause()
clapping.currentTime = 0
}
// console.log(speed)
}

ss.addEventListener('click', function(){
ss.style.display = 'none'
bp.addEventListener('click', throwPitch)
homeruns = 0
outs = 0
outss.innerHTML = outs
homers.innerHTML = homeruns
thrown = false
back_sound.volume = .025
back_sound.play()
})

function updateBall() {
if(thrown) {
x--
y++
ball.style.left = x + 'px'
ball.style.top = y + 'px'
}

setTimeout(updateBall,1000/10)
}
Loading

0 comments on commit 30fb6bc

Please sign in to comment.