Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Use this function to perform your initial setup
- function setup()
- displayMode(FULLSCREEN)
- boxheight =3D 50
- boxwidth =3D 50
- ballX =3D 400
- ballY =3D 400
- ballZ =3D 74
- updown =3D -4
- leftright =3D -4
- frontback =3D 4
- offset =3D 75
- diameter =3D 20
- -- sc =3D 1
- rot =3D 0
- end
- -- This function gets called once every frame
- function draw()
- -- This sets a dark background color
- background(46, 46, 186, 255)
- orientation()
- -- This sets the line thickness
- stroke(64, 43, 75, 255)
- strokeWidth(5)
- -- Do your drawing here
- for loop =3D 0, boxeshigh do
- endX =3D startX + barwidth
- endY =3D startY + loop*boxheight
- line(startX, endY, endX, endY)
- end
- line(startX-50, startY-50, endX+50, startY-50)
- line(startX-100, startY-100, endX+100, startY-100)
- line(startX-150, startY-150, endX+150, startY-150)
- boxadjd =3D ((barwidth + 300)/boxeswide)
- for loop =3D 0, boxeswide do
- newX =3D startX + loop*boxwidth
- lowerX =3D startX + loop*boxadjd - 150
- endY =3D startY + barheight
- line(newX, startY, newX, endY)
- line(newX, startY, lowerX, startY-150 )
- end
- endY =3D startY
- endX =3D startX + barwidth
- motion()
- strokeWidth(2)
- stroke(113, 62, 67, 255)
- fill(231, 10, 10, 255)
- ellipse(ballX,ballY,200,200)
- for loop =3D 1, 10 do
- lp =3D 11-loop
- ewidth =3D lp*(30-lp)
- ellipse(ballX,ballY,ewidth,200)
- end
- strokeWidth(2)
- noFill()
- for loop =3D 1, 10 do
- lp =3D 11-loop
- ewidth =3D lp*(30-lp)
- ellipse(ballX,ballY,200,ewidth)
- end
- strokeWidth(4)
- end
- function orientation()
- if WIDTH > 1000 then
- startX =3D 162
- startY =3D 268
- barwidth =3D WIDTH - 2*162
- barheight =3D HEIGHT - 368
- else
- startX =3D 134
- startY =3D 324
- barwidth =3D WIDTH - 2*134
- barheight =3D HEIGHT - 474
- end
- boxeshigh =3D barheight/boxheight
- boxeswide =3D barwidth/boxwidth
- end
- function motion()
- rot =3D rot + 1
- if rot > 90 then rot =3D 0 end
- if WIDTH < 1000 then
- if ballY > 750 + ballZ then
- sound(SOUND_HIT, 1234)
- updown =3D -4 =
- elseif ballY < 450 - ballZ then
- sound(SOUND_HIT, 1234)
- updown =3D 4
- end
- if ballX > 520 + ballZ then
- sound(SOUND_HIT, 1234)
- leftright =3D -4
- elseif ballX < 220 - ballZ then
- sound(SOUND_HIT, 1234)
- leftright =3D 4
- end
- if ballZ > 150 then
- sound(SOUND_HIT, 1234)
- frontback =3D - 1
- elseif ballZ < 0 then
- sound(SOUND_HIT, 1234)
- frontback =3D 1
- end
- elseif WIDTH >1000 then
- if ballY > 520 + ballZ then
- sound(SOUND_HIT, 1234)
- updown =3D -4 =
- elseif ballY < 350 - ballZ then
- sound(SOUND_HIT, 1234)
- updown =3D 4
- end
- if ballX > 800 + ballZ then
- sound(SOUND_HIT, 1234)
- leftright =3D -4
- elseif ballX < 200 - ballZ then
- sound(SOUND_HIT, 1234)
- leftright =3D 4
- end
- if ballZ > 150 then
- sound(SOUND_HIT, 1234)
- frontback =3D - 1
- elseif ballZ < 0 then
- sound(SOUND_HIT, 1234)
- frontback =3D 1
- end
- end
- ballY =3D ballY + updown
- ballX =3D ballX + leftright
- ballZ =3D ballZ + frontback
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement