attempted to make tic tac toe, ended with trippy shit

This commit is contained in:
alisolarflare 2017-07-01 04:06:17 -04:00
parent 5c30fe61c8
commit 82baaa86bd
4 changed files with 94 additions and 1 deletions

9
resources/frameworks/p5.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,11 @@ $("document").ready(function(){
.attr("href", "./questions.html")) .attr("href", "./questions.html"))
.append($("<a></a>") .append($("<a></a>")
.append("Spawn") .append("Spawn")
.attr("href", "./spawn.html")); .attr("href", "./spawn.html"))
.append($("<a></a>")
.append("TicTac")
.attr("href", "./tictac.html"));
console.log("update");
}); });

View file

@ -0,0 +1,61 @@
let ball = {
x: 0,
y: 100,
xs: 0,
ys: 0,
radius: 25
}
function setup(){
createCanvas(400, 400);
background(140, 40, 40);
}
function draw(){
ball.xs += 0.01;
ball.ys += 0.04;
ball.x += ball.xs;
ball.y += ball.ys;
//leftwall
if (ball.x < ball.radius){
ball.x = ball.radius;
ball.xs = abs(ball.xs);
console.warn("left");
}
//topwall
if(ball.y < ball.radius){
ball.y = ball.radius;
ball.ys = abs(ball.ys)
console.warn("top");
}
//rightwall
if(ball.x > 400 - ball.radius){
ball.x = 400 - ball.radius;
ball.xs = 0 - abs(ball.xs);
console.warn("right");
}
//bottomwall
if(ball.y > 400 - ball.radius){
ball.y = 400 - ball.radius;
ball.ys = 0 - abs(ball.ys);
console.warn("bottom");
}
drawball(ball.x, ball.y);
}
function drawball(x, y){
const shadowlen = 0;
const diameter = 50;
stroke(70, 0, 0);
//shadow
fill(70, 20, 20);
ellipse(x + shadowlen, y + shadowlen, diameter, diameter);
//Main ball
fill(240, 240, 255);
ellipse(x, y, diameter, diameter);
}

19
tictac.html Normal file
View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tic Tac Toe</title>
<!--resources-->
<script src="./resources/frameworks/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="./resources/frameworks/p5.min.js" type="text/javascript"></script>
<script src="./resources/nav.js"></script>
<!--scripts-->
<script src="./resources/tictac/tictac.js"></script>
</head>
<body>
<nav></nav>
<h1>Wacky Tic Tac Toe</h1>
</body>
</html>