|
|
|
// TODO: SAVE ON CLICK
|
|
|
|
|
|
|
|
var left, right, genLight, score
|
|
|
|
var el1 = [], el2 = [], scrVals = []
|
|
|
|
|
|
|
|
function preload() {
|
|
|
|
// left = loadSVG('../svgs/leftHand.svg')
|
|
|
|
// right = loadSVG('../svgs/rightHand.svg')
|
|
|
|
|
|
|
|
genLight = loadFont("fonts/Gen-Light.otf");
|
|
|
|
|
|
|
|
score = loadStrings('../score/score.txt')
|
|
|
|
|
|
|
|
for (var i = 0; i < 8; i++) {
|
|
|
|
el1.push( loadSVG('../svgs/el.' + int(random(1, 12)) + '.svg') )
|
|
|
|
el2.push( loadSVG('../svgs/el.' + int(random(1, 12)) + '.svg') )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
createCanvas(800, 1200, SVG)
|
|
|
|
|
|
|
|
textFont(genLight)
|
|
|
|
|
|
|
|
// frameRate(1)
|
|
|
|
noLoop()
|
|
|
|
|
|
|
|
fill(220)
|
|
|
|
textSize(150)
|
|
|
|
textAlign('right')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function draw() {
|
|
|
|
background('#151515')
|
|
|
|
fill("#DDDDDD")
|
|
|
|
|
|
|
|
for (var i = 0; i < score.length; i++) {
|
|
|
|
var line = split(score[i].slice(0, -1), ' ')
|
|
|
|
text(line.join(" "), 90, 150 + (i*90), 710)
|
|
|
|
scrVals.push(line)
|
|
|
|
}
|
|
|
|
|
|
|
|
stroke('#FFCC00')
|
|
|
|
fill('#FFCC00')
|
|
|
|
|
|
|
|
// left.attribute('fill', 'none')
|
|
|
|
// right.attribute('fill', 'none')
|
|
|
|
// left.attribute('stroke', '#FFCC00')
|
|
|
|
// right.attribute('stroke', '#FFCC00')
|
|
|
|
|
|
|
|
// image(right, 0, 0, 600, 600)
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < el1.length; i++) {
|
|
|
|
var r = random(5)
|
|
|
|
var rVal = int(scrVals[int(random(scrVals.length))][int(random(7))])
|
|
|
|
var coin = int(random(2))
|
|
|
|
rVal = map(rVal, 0, 127, 0, width)
|
|
|
|
|
|
|
|
el1[i].attribute('fill', 'none')
|
|
|
|
el2[i].attribute('fill', 'none')
|
|
|
|
el1[i].attribute('stroke', '#FFCC00')
|
|
|
|
el2[i].attribute('stroke', '#FFCC00')
|
|
|
|
|
|
|
|
image(el1[i], 120 + rVal, (height/el1.length)*(i)+30, 75 + r, 75 + r)
|
|
|
|
image(el2[i], 15, (height/el1.length)*(i)+30, 75, 75)
|
|
|
|
|
|
|
|
if (coin) {
|
|
|
|
var coin2 = int(random(2))
|
|
|
|
if (coin2) {
|
|
|
|
ellipse(120 + rVal, (height/el1.length)*(i)+45, 30 + r, 30 + r)
|
|
|
|
} else {
|
|
|
|
ellipse(51, (height/el1.length)*(i)+55, 30, 30)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function saveMe() {
|
|
|
|
save()
|
|
|
|
}
|