Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * 𝗚𝗹𝗶𝗱𝗲𝗿 𝗙𝗿𝗲𝗲𝗱𝗼𝗺 𝟮 *
- * *
- * The original Glider Freedom was made by EliK. *
- * https://www.openprocessing.org/sketch/850008 *
- * *
- * * *
- * *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
- p5.disableFriendlyErrors = true;
- var lives
- var coins2
- var coinget
- var heatres
- var livecount
- var startspeed
- var coincost
- var spacego
- var fast
- var travb
- var sonic
- var light
- var fst
- var fst2
- var stt
- var sss
- var ttt
- var stu
- var drag
- var tf
- var tf2
- var airbrake
- var fuel
- var fuelget
- var moonget
- var fm
- var livesm
- var coins2m
- var coingetm
- var heatresm
- var livecountm
- var startspeedm
- var coincostm
- var dragm
- var airbrakem
- var fuelm
- var fuelgetm
- var sandget
- var img
- function preload() {
- img = loadImage("thumbnail.png")
- rawJSON = loadJSON("https://www.openprocessing.org/api/sketch/909114/true");
- }
- function setup() {
- createCanvas(windowWidth, windowHeight);
- tx = width / 2
- ty = height / 2
- lives = getItem('lives');
- coins2 = getItem('coins2');
- coinget = getItem('coinget');
- heatres = getItem('heatres');
- livecount = getItem('livecount');
- startspeed = getItem('startspeed');
- coincost = getItem('coincost');
- spacego = getItem('spacego');
- fast = getItem('fast');
- travb = getItem('travb');
- sonic = getItem('sonic');
- light = getItem('light');
- fst = getItem('fst');
- fst2 = getItem('fst2');
- stt = getItem('stt');
- sss = getItem('sss');
- ttt = getItem('ttt');
- stu = getItem('stu');
- drag = getItem('drag');
- tf = getItem('tf');
- tf2 = getItem('tf2');
- airbrake = getItem('airbrake');
- fuel = getItem('fuel');
- fuelget = getItem('fuelget');
- moonget = getItem('moonget');
- fm = getItem('fm');
- livesm = getItem('livesm')
- coins2m = getItem('coins2m')
- coingetm = getItem('coingetm')
- heatresm = getItem('heatresm')
- livecountm = getItem('livecountm')
- startspeedm = getItem('startspeedm')
- coincostm = getItem('coincostm')
- dragm = getItem('dragm')
- airbrakem = getItem('airbrakem')
- fuelm = getItem('fuelm')
- fuelgetm = getItem('fuelgetm')
- sandget = getItem('sandget')
- frameRate(60)
- background(87, 171, 255);
- textAlign(CENTER)
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- clouds.push(new Cloud())
- coins.push(new Coin())
- coins.push(new Coin())
- rocks.push(new Rock())
- pixelDensity(1)
- }
- var x = 100
- var y = -2000
- var yy = 170
- var yspeed = 100
- var xspeed = 0
- var r = 0
- var home = -1
- var tx = 0
- var ty = 0
- var burntime = 0
- var clouds = []
- var coins = []
- var rocks = []
- var trav = 0
- var reset2 = 0
- var hst = 0
- var lst = 0
- var deathmess = 0
- var cst = 0
- var sst = 0
- var f = 300
- var fs = 300
- var bf = 0
- var ss = 300
- var textfill = 0
- var ar = 0
- var ast = 0
- var fgh = 0
- var fpsl = 60
- var moon = 0
- var sand = 0
- var store = 0
- var t = 0
- function draw() {
- if (windowWidth <= 1200 || windowHeight <= 530) {
- scale(0.75, 0.75)
- translate(200, 0)
- mouseX = mouseX * 1.3333333333333333333333333333333333333333333333 - 200
- mouseY = mouseY * 1.3333333333333333333333333333333333333333333333
- }
- t++
- // fuel++
- // fuelm++
- if (t > 5 * frameRate()) {
- storeAll();
- t = 0
- }
- cursor(ARROW)
- if (lives == null) {
- lives = 1
- }
- if (coins2 == null) {
- coins2 = 5
- }
- if (coinget == null) {
- coinget = 1
- }
- if (heatres == null) {
- heatres = 20
- }
- if (livecount == null) {
- livecount = 1
- }
- if (startspeed == null) {
- startspeed = 5
- }
- if (coincost == null) {
- coincost = 10
- }
- if (fst == null) {
- fst = 0
- }
- if (fst2 == null) {
- fst2 = 0
- }
- if (stt == null) {
- stt = 0
- }
- if (sss == null) {
- sss = 0
- }
- if (ttt == null) {
- ttt = 0
- }
- if (drag == null) {
- drag = 10
- }
- if (tf == null) {
- tf = 300
- }
- if (tf2 == null) {
- tf2 = 300
- }
- if (airbrake == null) {
- airbrake = 0
- }
- if (fuel == null) {
- fuel = 0
- }
- if (fuelget == null) {
- fuelget = 0
- }
- if (moonget == null) {
- moonget = 0
- }
- if (fm == null) {
- fm = 300
- }
- if (livesm == null) {
- livesm = 1
- }
- if (coins2m == null) {
- coins2m = 5
- }
- if (coingetm == null) {
- coingetm = 1
- }
- if (heatresm == null) {
- heatresm = 20
- }
- if (livecountm == null) {
- livecountm = 1
- }
- if (startspeedm == null) {
- startspeedm = 5
- }
- if (coincostm == null) {
- coincostm = 10
- }
- if (dragm == null) {
- dragm = 10
- }
- if (airbrakem == null) {
- airbrakem = 0
- }
- if (fuelm == null) {
- fuelm = 0
- }
- if (fuelgetm == null) {
- fuelgetm = 0
- }
- if (spacego == null) {
- spacego = 0
- }
- if (fast == null) {
- fast = 0
- }
- if (travb == null) {
- travb = 0
- }
- if (sonic == null) {
- sonic = 0
- }
- if (light == null) {
- light = 0;
- }
- if (sandget == null) {
- sandget = 0
- }
- if (home == -1) {
- background(999)
- if (yy >= 200) {
- yy = 200
- }
- if (yy <= -400) {
- yy = -400
- }
- // rect(200,100,1000,500)
- text("The original Glider Freedom was made by EliK.\n\
- https://www.openprocessing.org/sketch/850008 (link is also in the code)\n\
- Go check it out!\n\n\
- -------------------------------------------------Instructions-------------------------------------------------\n\n\
- Left and right arrow keys to rotate. Collect coins at the bottom.\n\
- Get higher than 150 feet to get to space. You go slower in space.\n\
- Don't get hit by asteroids!\n\
- Get higher than 1000 feet to unlock moon.\n\
- Scroll to continue\n\
- Get higher than 1500 feet on moon to get sandbox.\n\n\
- --------------------------------------------------What's new?--------------------------------------------------\n\n\
- The main improvement from Glider Freedom is the FPS.\n\
- If you play Glider Freedom for more than 5 or so minutes the FPS drops significantly\n\
- making very hard to play.\n\
- On Glider Freedom 2 this is fixed and your FPS should be around 50-60.\n\
- The second big improvement is that this uses getItem() so save your progress so \n\
- if you reload it you will still have your progress.\n\
- The physics have NOT been inproved\n\
- It is also fullscreen making it look better.\n\
- There are many other small improvements too.\
- ", (width / 2), yy)
- text("OK!", (width / 2), yy + 750 + 40)
- push()
- noStroke()
- fill(87, 171, 255)
- rect(0, 0, width, height / 10)
- rect(0, height - height / 10, width, height / 10)
- rect(0, 0, 200, height)
- rect(width - 200, 0, 200, height)
- pop()
- textSize(25)
- if (mouseX > (width / 2) - 30 && mouseY > yy + 730 + 40 && mouseX < (width / 2) + 30 && mouseY < yy + 760 + 40) {
- cursor(HAND)
- } else {
- cursor(ARROW)
- }
- if (mouseX > (width / 2) - 30 && mouseY > yy + 730 + 40 && mouseX < (width / 2) + 30 && mouseY < yy + 760 + 40 && mouseIsPressed) {
- mouseX = 0;
- home = 1;
- cursor(ARROW)
- }
- } else
- if (home == 1) {
- background(999);
- textSize(50)
- fill(0)
- textAlign(CENTER, CENTER)
- text("𝐆𝐥𝐢𝐝𝐞𝐫 𝐅𝐫𝐞𝐞𝐝𝐨𝐦 𝟐!", width / 2, 100);
- textSize(25)
- if (deathmess != 0) {
- text(deathmess + "", width / 2, 170)
- }
- textAlign(LEFT, TOP)
- textSize(35)
- if (butt(width / 2 - 50, 250 - 50, 100, 40)) {
- home = 0;
- if (moon == 0) {
- yspeed = startspeed * 10
- }
- if (moon == 1) {
- yspeed = startspeedm * 10
- }
- deathmess = 0;
- fuel = fuelget;
- fuelm = fuelgetm
- }
- text("Play", width / 2 - 40, 252 - 50)
- lives = livecount;
- if (butt(width / 2 - 85, 350 - 50, 170, 40)) {
- home = 2;
- mouseX = 0
- }
- text("Upgrades", width / 2 - 85, 352 - 50)
- if (butt(width / 2 - 95, 450 - 50, 190, 40)) {
- home = 4;
- mouseX = 0
- }
- text("Challenges", width / 2 - 90, 452 - 50)
- if (moon == 1) {
- if (butt(width / 2 - 70, 550 - 50, 110, 40)) {}
- } else {
- if (cbutt(width / 2 - 70, 550 - 50, 110, 40) && moonget == 1) {
- moon = 1;
- }
- }
- text("Moon", width / 2 - 70, 550 - 50)
- if (moon == 0) {
- if (butt(width / 2 - 120 - 70, 550 - 50, 100, 40)) {}
- } else {
- if (cbutt(width / 2 - 120 - 70, 550 - 50, 100, 40)) {
- moon = 0;
- }
- }
- text("Earth", width / 2 - 120 - 70, 550 - 50)
- text("Level:", width / 2 - 300, 550 - 50)
- if (sand == 1) {
- if (butt(width / 2 + 50, 550 - 50, 100, 40)) {}
- } else {
- if (cbutt(width / 2 + 50, 550 - 50, 100, 40) && sandget == 1) {
- sand2();
- }
- }
- text("Sandbox", width / 2 + 50, 550 - 50)
- if (butt(width / 2 + 300, 400, 170, 40)) {
- home = 3;
- mouseX = 0
- }
- text("Reset all", width / 2 + 300, 450 - 50)
- if (butt(width / 2 - 400, 400, 170, 40)) {
- fullscreen(!fullscreen());
- if (fullscreen()) {
- createCanvas(windowWidth, windowHeight)
- } else {
- createCanvas(displayWidth, displayHeight)
- }
- mouseX = 0
- }
- text("Fullscreen", width / 2 - 400, 400)
- } else {
- if (home == 2) {
- background(999);
- textSize(50)
- textAlign(CENTER, CENTER)
- text("𝐔𝐩𝐠𝐫𝐚𝐝𝐞𝐬!", width / 2, 100);
- textAlign(LEFT, TOP)
- textSize(25)
- // coins2m=1
- if (moon == 0) {
- text("Coins: " + coins2, 250, 90)
- if (butt(width / 2 - 400, 200, 220, 120) && hst == 0 && coins2 >= 5) {
- heatres += 5;
- coins2 -= 5;
- hst = 1;
- }
- if (!butt(width / 2 - 400, 200, 220, 120)) {
- hst = 0
- }
- textSize(25)
- text("Heat shield = " + heatres, width / 2 - 400, 210)
- text("Cost: 5\nClick to buy", width / 2 - 400, 240)
- if (butt(width / 2 - 150, 200, 220, 120) && lst == 0 && coins2 >= 30) {
- livecount++;
- coins2 -= 30;
- lst = 1;
- }
- if (!butt(width / 2 - 150, 200, 220, 120)) {
- lst = 0
- }
- textSize(25)
- text("lives = " + livecount, width / 2 - 150, 210)
- text("Cost: 30\nClick to buy", width / 2 - 150, 240)
- if (butt(width / 2 + 100, 200, 220, 120) && cst == 0 && coins2 >= coincost) {
- coinget += 1;
- coins2 -= coincost;
- coincost += 4;
- cst = 1;
- }
- if (!butt(width / 2 + 100, 200, 220, 120)) {
- cst = 0
- }
- textSize(25)
- text("Coins + " + coinget, width / 2 + 100, 210)
- text("Cost: " + coincost + "\nClick to buy", width / 2 + 100, 240)
- if (butt(width / 2 + 350, 200, 220, 120) && sst == 0 && coins2 >= 3) {
- startspeed += 1;
- coins2 -= 3;
- sst = 1;
- }
- if (!butt(width / 2 + 350, 200, 220, 120)) {
- sst = 0
- }
- textSize(25)
- text("Starting speed = " + startspeed, width / 2 + 350, 210)
- text("Cost: 3\nClick to buy", width / 2 + 350, 240)
- if (butt(width / 2 + -650, 200, 220, 120) && ar == 0 && coins2 >= 10 && drag > 1) {
- drag -= 1;
- coins2 -= 10;
- ar = 1;
- }
- if (!butt(width / 2 + -650, 200, 220, 120)) {
- ar = 0
- }
- textSize(25)
- text("Air resistance = " + drag, width / 2 - 650, 210)
- text("Cost: 10\nClick to buy", width / 2 - 650, 240)
- if (butt(width / 2 - 0, 200 + 150, 220, 120) && fgh == 0 && coins2 >= 15 && fuelget < 60) {
- fuelget++;
- coins2 -= 15;
- fgh = 1;
- }
- if (!butt(width / 2 - 0, 200 + 150, 220, 120)) {
- fgh = 0
- }
- textSize(25)
- text("Rocket fuel = " + fuelget, width / 2 - 0, 210 + 150)
- text("Cost: 15\nClick to buy", width / 2 - 0, 240 + 150)
- if (butt(width / 2 + -250, 400 - 50, 220, 120) && ast == 0 && coins2 >= 75 && airbrake == 0) {
- airbrake = 1;
- coins2 -= 75;
- ast = 1;
- }
- if (!butt(width / 2 + -250, 400 - 50, 220, 120)) {
- ast = 0
- }
- textSize(25)
- text("Air brake", width / 2 - 250, 410 - 50)
- if (airbrake == 0) {
- text("Cost: 75\nClick to buy", width / 2 - 250, 440 - 50)
- } else {
- text("Purchased", width / 2 - 250, 440 - 50)
- }
- }
- if (moon == 1) {
- text("Coins: " + coins2m, 250, 90)
- if (butt(width / 2 - 400, 200, 220, 120) && hst == 0 && coins2m >= 5 * 2) {
- heatresm += 5;
- coins2m -= 5 * 2;
- hst = 1;
- }
- if (!butt(width / 2 - 400, 200, 220, 120)) {
- hst = 0
- }
- textSize(25)
- text("Heat shield = " + heatresm, width / 2 - 400, 210)
- text("Cost: 10\nClick to buy", width / 2 - 400, 240)
- if (butt(width / 2 - 150, 200, 220, 120) && lst == 0 && coins2m >= 30 * 2) {
- livecountm++;
- coins2m -= 30 * 2;
- lst = 1;
- }
- if (!butt(width / 2 - 150, 200, 220, 120)) {
- lst = 0
- }
- textSize(25)
- text("lives = " + livecountm, width / 2 - 150, 210)
- text("Cost: 60\nClick to buy", width / 2 - 150, 240)
- if (butt(width / 2 + 100, 200, 220, 120) && cst == 0 && coins2m >= coincostm * 2) {
- coingetm += 1;
- coins2m -= coincostm * 2;
- coincostm += 4;
- cst = 1;
- }
- if (!butt(width / 2 + 100, 200, 220, 120)) {
- cst = 0
- }
- textSize(25)
- text("Coins + " + coingetm, width / 2 + 100, 210)
- text("Cost: " + coincostm * 2 + "\nClick to buy", width / 2 + 100, 240)
- if (butt(width / 2 + 350, 200, 220, 120) && sst == 0 && coins2m >= 3 * 2) {
- startspeedm += 1;
- coins2m -= 3 * 2;
- sst = 1;
- }
- if (!butt(width / 2 + 350, 200, 220, 120)) {
- sst = 0
- }
- textSize(25)
- text("Starting speed = " + startspeedm, width / 2 + 350, 210)
- text("Cost: 6\nClick to buy", width / 2 + 350, 240)
- if (butt(width / 2 + -650, 200, 220, 120) && ar == 0 && coins2m >= 10 * 2 && dragm > 1) {
- dragm -= 1;
- coins2m -= 10 * 2;
- ar = 1;
- }
- if (!butt(width / 2 + -650, 200, 220, 120)) {
- ar = 0
- }
- textSize(25)
- text("Air resistance = " + dragm, width / 2 - 650, 210)
- text("Cost: 20\nClick to buy", width / 2 - 650, 240)
- if (butt(width / 2 - 0, 200 + 150, 220, 120) && fgh == 0 && coins2m >= 15 * 2 && fuelgetm < 60) {
- fuelgetm++;
- coins2m -= 15 * 2;
- fgh = 1;
- }
- if (!butt(width / 2 - 0, 200 + 150, 220, 120)) {
- fgh = 0
- }
- textSize(25)
- text("Rocket fuel = " + fuelgetm, width / 2 - 0, 210 + 150)
- text("Cost: 30\nClick to buy", width / 2 - 0, 240 + 150)
- if (butt(width / 2 + -250, 400 - 50, 220, 120) && ast == 0 && coins2m >= 75 * 2 && airbrakem == 0) {
- airbrakem = 1;
- coins2m -= 75 * 2;
- ast = 1;
- }
- if (!butt(width / 2 + -250, 400 - 50, 220, 120)) {
- ast = 0
- }
- textSize(25)
- text("Air brake", width / 2 - 250, 410 - 50)
- if (airbrakem == 0) {
- text("Cost: 150\nClick to buy", width / 2 - 250, 440 - 50)
- } else {
- text("Purchased", width / 2 - 250, 440 - 50)
- }
- }
- if (butt(width / 2, 500, 100, 30)) {
- home = 1;
- mouseX = 0
- }
- textSize(25)
- text("Go back", width / 2, 500)
- textSize(35)
- } else {
- if (home == 3) {
- push()
- fill(999)
- rect(width / 2 - 200, height / 2 - 100, 400, 200)
- pop()
- textSize(25)
- text("This will reset EVERYTHING\nyou did so far. Is this OK?", width / 2 - 190, height / 2 - 90)
- textSize(30)
- if (butt(width / 2 - 150, height / 2 + 50, 120, 40)) {
- home = 1;
- mouseX = 0
- }
- text("Cancel", width / 2 - 140, height / 2 + 60)
- if (butt(width / 2, height / 2 + 50, 80, 40)) {
- resetAll();
- home = 1;
- mouseX = 0
- }
- text("Yes", width / 2 + 10, height / 2 + 60)
- } else {
- if (home == 4) {
- textSize(30)
- background(999)
- push()
- textAlign(CENTER)
- if (fast == 1) {
- text("Go faster than 100 MPH + 50 coins ✓", width / 2, 150)
- } else {
- text("Go faster than 100 MPH + 50 coins ", width / 2, 150)
- }
- if (spacego == 1) {
- text("Go to space + 30 coins ✓", width / 2, 100)
- } else {
- text("Go to space + 30 coins ", width / 2, 100)
- }
- if (travb == 1) {
- text("Travel 6000 feet + 50 coins ✓", width / 2, 200)
- } else {
- text("Travel 6000 feet + 50 coins ", width / 2, 200)
- }
- if (sonic == 1) {
- text("Go supersonic! faster than 767 Mph + 500 coins ✓", width / 2, 250)
- } else {
- text("Go supersonic! faster than 767 Mph + 500 coins ", width / 2, 250)
- }
- text("Light Speed? Faster than 670,616,629 Mph! + 100,000 coins!", width / 2, 300)
- pop()
- if (butt(width / 2 - 50, 350, 100, 30)) {
- home = 1;
- mouseX = 0
- }
- textSize(25)
- text("Go back", width / 2 - 50, 350)
- } else {
- /*if (home==5) {
- push()
- textAlign(LEFT,TOP)
- fill(999)
- rect(width/2-400,height/2-100,800,200)
- textSize(25)
- fill(0)
- text("your screen is smaller than 1300 X 530 ("+windowWidth+" "+windowHeight+"\nThis means that you may not be able to see all the buttons\nyou can go to glider freedom 2 for smaller screens:(coming soom)\n(link is also in the code)",width/2-350,height/2-90)
- textSize(30)
- if (butt(width/2-150,height/2+50,70,40)) {home=1;mouseX=0}
- text ("OK",width/2-140,height/2+60)
- pop()
- }else{
- */
- textSize(15)
- if (round(-y / 2 / 35.7) < 150) {
- background(87, 171, 255);
- textfill = 0
- } else {
- background(87, 171, 255);
- background(0, 0, 0, round(-y / 2 / 35.7) * 5 - 750);
- bf += 5;
- textfill = 255
- }
- if (moon == 1) {
- background(0);
- textfill = 255
- }
- if (moon == 1 && round(-y / 2 / 35.7) < 1500) {
- sandget = 1;
- }
- fill(textfill)
- //text(store,30,30)
- if (yspeed > 50) {
- yspeed -= drag / 100
- }
- if (yspeed > 50) {
- if (round(-y / 2 / 35.7) >= 150 || moon == 1) {
- yspeed -= drag * 10 / 100
- }
- }
- // text("You are "+-round(y/2/35.7)+" feet above the ground",200,25);
- for (var i = 0; i < clouds.length; i++) {
- clouds[i].move();
- }
- for (var j = 0; j < coins.length; j++) {
- coins[j].move();
- }
- for (var l = 0; l < rocks.length; l++) {
- rocks[l].move();
- }
- if (keyIsDown(32) && airbrake == 1 && yspeed > 5 && moon == 0) {
- yspeed -= 7
- }
- if (keyIsDown(32) && airbrakem == 1 && yspeed > 5 && moon == 1) {
- yspeed -= 7
- }
- if (keyIsDown(82)) {
- home = 1;
- reset()
- }
- textAlign(CENTER, CENTER)
- push()
- fill(255, 0, 0)
- if (moon == 0) {
- rect(width / 2 - 60, height - 40, fuel * 2, 30)
- }
- if (moon == 1) {
- rect(width / 2 - 60, height - 40, fuelm * 2, 30)
- }
- pop()
- textSize(20)
- text("Rocket Fuel", width / 2, height - 60)
- push()
- noFill()
- stroke(textfill)
- strokeWeight(2)
- rect(width / 2 - 65, height - 45, 130, 40)
- pop()
- trav -= yspeed / 10
- textSize(20);
- text("You traveled " + round(trav * -1 / 35.7) + " feet", width / 2, 75);
- if (moon == 0) {
- if (coins2 == 1) {
- text(coins2 + " Coin", width / 2, 100);
- } else {
- text(coins2 + " Coins", width / 2, 100);
- }
- }
- if (moon == 1) {
- if (coins2m == 1) {
- text(coins2m + " Coin", width / 2, 100);
- } else {
- text(coins2m + " Coins", width / 2, 100);
- }
- }
- if (moon == 0) {
- text(lives + " lives", width / 2, 125);
- }
- if (moon == 1) {
- text(livesm + " lives", width / 2, 125);
- }
- text("You are " + round(-y / 2 / 35.7) + " feet above the ground", width / 2, 25);
- text("" + round(yspeed / 20) + " Miles per hour", width / 2, 50);
- //text(int(moonget),width/2,150);
- if (round(-y / 2 / 35.7) >= 1000 && moon == 0) {
- moonget = 1;
- push();
- fill(textfill, textfill, textfill, fm);
- fm--;
- text("You got 1000 feet high! moon unlocked", width / 2, 300);
- pop()
- }
- push()
- fill(9999)
- translate(tx, ty)
- if (keyIsDown(37)) {
- r -= 0.03 * 60 / frameRate()
- }
- if (keyIsDown(39)) {
- r += 0.03 * 60 / frameRate()
- }
- y += (r * yspeed / 20)
- rotate(r)
- yspeed += r * yspeed / 50 //*60/frameRate()
- yspeed += r / 10
- if (r < 0) {
- y += r * yspeed / 10;
- yspeed += r * yspeed / 100
- }
- push()
- fill(255, 0, 0)
- noStroke()
- if (keyIsDown(38) && fuel > 0 && moon == 0) {
- yspeed += 7;
- fuel -= 0.2;
- ellipse(-17, 0, 35, 15)
- }
- if (keyIsDown(38) && fuelm > 0 && moon == 1) {
- yspeed += 7;
- fuelm -= 0.2;
- ellipse(-17, 0, 35, 15)
- }
- pop()
- fill(255)
- y += 2
- strokeWeight(2)
- triangle(-10, -10, -10, 10, 20, 0);
- if (moon == 0) {
- if (yspeed / 20 >= heatres) {
- push();
- noStroke();
- fill(255, 140, 0);
- ellipse(-17, 0, 35, 15);
- tx = random(width / 2 - 2, width / 2 + 2);
- ty = random(height / 2 - 2, height / 2 + 2);
- burntime++;
- pop()
- } else {
- tx = width / 2
- ty = height / 2
- }
- } else {
- if (yspeed / 20 >= heatresm) {
- push();
- noStroke();
- fill(255, 140, 0);
- ellipse(-17, 0, 35, 15);
- tx = random(width / 2 - 2, width / 2 + 2);
- ty = random(height / 2 - 2, height / 2 + 2);
- burntime++;
- pop()
- } else {
- tx = width / 2
- ty = height / 2
- }
- }
- if (yspeed / 20 >= heatresm && moon == 1) {
- push();
- noStroke();
- fill(255, 140, 0);
- ellipse(-17, 0, 35, 15);
- tx = random(width / 2 - 2, width / 2 + 2);
- ty = random(height / 2 - 2, height / 2 + 2);
- burntime++;
- pop()
- }
- if (burntime >= 100 && moon == 0) {
- lives--;
- burntime = 0;
- deathmess = "You went too fast and burned up!"
- }
- if (burntime >= 100 && moon == 1) {
- livesm--;
- burntime = 0;
- deathmess = "You went too fast and burned up!"
- }
- if (lives <= 0 && moon == 0) {
- home = 1;
- burntime = 0;
- lives = livecount;
- reset();
- }
- if (livesm <= 0 && moon == 1) {
- home = 1;
- burntimem = 0;
- livesm = livecountm;
- reset();
- }
- pop()
- if (round(frameRate()) < fpsl) {
- fpsl = round(frameRate())
- }
- text("FPS: " + round(frameRate()), 50, 20)
- textSize(30)
- if (round(yspeed / 20) >= 100) {
- fast = 1;
- }
- if (round(yspeed / 20) >= 767) {
- sonic = 1;
- }
- if (fast == 1 && fst < 300) {
- push();
- fill(textfill, textfill, textfill, f);
- f -= 3;
- text("Challenge complete go faster than 100 MPH coins + 50", width / 2, 200)
- pop();
- fst++;
- }
- if (fast == 1 && fst2 == 0) {
- coins2 += 50;
- fst2 = 1;
- }
- if (sonic == 1 && tf2 >= 0) {
- push();
- fill(textfill, textfill, textfill, tf2);
- tf2 -= 3;
- text("Challenge complete go super sonic coins + 500", width / 2, 200)
- pop();
- }
- if (sonic == 1 && stu == 0) {
- coins2 += 500;
- stu = 1;
- }
- ground(-y + height / 2 - 35)
- if (round(y / 2 / 35.7) >= 0) {
- home = 1;
- reset();
- burntime = 0;
- deathmess = "You hit the ground!"
- }
- if (round(-y / 2 / 35.7) >= 150) {
- spacego = 1;
- }
- if (spacego == 1 && stt < 300) {
- push();
- fill(textfill, textfill, textfill, fs);
- fs -= 3;
- text("Challenge complete go to space coins + 30", width / 2, 200);
- stt++
- pop();
- stt++;
- }
- if (sss == 0 && spacego == 1) {
- coins2 += 30;
- sss = 1;
- }
- if (travb == 1 && tf > 0) {
- push();
- fill(textfill, textfill, textfill, tf);
- tf -= 3;
- text("Challenge complete travel 6000 feet coins + 50", width / 2, 200);
- pop();
- }
- if (ttt == 0 && travb == 1) {
- coins2 += 50;
- ttt = 1;
- }
- if (round(trav * -1 / 35.7) >= 6000) {
- travb = 1;
- }
- }
- }
- }
- }
- /*
- imageMode(CENTER)
- img.resize(height,0)
- image(img,width/2,height/2)*/
- push()
- textSize(20)
- textAlign(CENTER, CENTER);
- if (mouseY > height - 50) {
- fill(999)
- rect(0, height - 50, width, 50)
- fill(0)
- text("?️ " + rawJSON.sketch.numberOfViews + " ♡" + rawJSON.sketch.hearts.length + " ?" + rawJSON.sketch.comments.length, width / 2, height - 20)
- }
- pop()
- }
- function ground(y2) {
- push()
- noStroke()
- if (moon == 0) {
- fill(9, 255, 0)
- } else {
- fill(170)
- }
- rect(0, y2, 2000, 2000)
- pop()
- }
- function Cloud() {
- this.x = random(width)
- this.y = 0
- this.r = random(-1500, -500)
- this.up = 0;
- this.st = 0;
- this.t = 0;
- this.t2 = 0;
- this.t3 = 0;
- this.move = function() {
- if (reset2 == 1) {
- this.t++;
- if (this.t <= 5) {
- this.x = random(width)
- this.y = 0
- this.r = random(-1500, -500)
- this.up = 0;
- this.st = 0;
- this.t2 = 0;
- }
- if (this.t > 5) {
- reset2 = 1
- }
- }
- this.t2++
- this.t3++
- if (this.t3 > 30 * frameRate()) {
- this.st = 0
- }
- if (round(-y / 2 / 35.7) < 170 && moon == 0) {
- cloudDraw(this.x, this.y)
- } else {
- push();
- strokeWeight(0);
- fill(999);
- ellipse(this.x, this.y, 10, 10);
- pop()
- }
- this.x -= yspeed / 10
- this.y = -y + this.r + this.up
- if (this.x < -150) {
- this.x = random(width + 150, width + 300)
- }
- if (this.st == 0) {
- this.st = 1
- if (this.y > height + 150) {
- this.up -= random(height + 200, height + 400)
- }
- if (this.y < -150) {
- this.up += random(height + 100, height + 300)
- }
- } else {}
- if (this.y > height + 150 || this.y < -150) {} else {
- this.st = 0
- }
- if (this.y > height + 1500 && this.st2 == 0) {
- this.y = height / 2
- this.x = width / 2
- this.st2 = 1
- }
- if (this.y < -1500 && this.st2 == 0) {
- this.y = height / 2
- this.x = width / 2
- this.st2 = 1
- }
- if (this.x < -1500 && this.st2 == 0) {
- this.y = height / 2
- this.x = width / 2
- this.st2 = 1
- }
- }
- }
- function cloudDraw(x2, y2) {
- push()
- fill(999);
- noStroke()
- // sky/clouds/ sun
- ellipse(x2 + 45, y2 + 97, 60, 60)
- ellipse(x2 + 72, y2 + 78, 60, 60)
- ellipse(x2 + 72, y2 + 94, 60, 60)
- ellipse(x2 + 40, y2 + 80, 60, 60)
- pop()
- }
- function Coin() {
- this.x = random(width)
- this.y = 500
- this.up = 0
- this.st = 0
- this.move = function() {
- this.x -= yspeed / 10
- this.y = -y + this.up
- if (this.x < -150) {
- this.x = random(width + 150, width + 300);
- this.up = random(-700, 200);
- this.st = 0
- }
- // if (this.y>height-100) {this.up+=random(-200,200)}
- push()
- fill(255, 242, 0)
- if (this.st == 0) {
- ellipse(this.x, this.y, 50, 50)
- if (this.x > width / 2 - 30 && this.x < width / 2 + 30 && this.y > height / 2 - 30 && this.y < height / 2 + 30 && moon == 0) {
- coins2 += coinget;
- this.st = 1
- }
- if (this.x > width / 2 - 30 && this.x < width / 2 + 30 && this.y > height / 2 - 30 && this.y < height / 2 + 30 && moon == 1) {
- coins2m += coingetm;
- this.st = 1
- }
- }
- pop()
- }
- }
- function Rock() {
- this.x = random(width)
- this.y = 0
- this.r = random(-1500, -500)
- this.up = 0;
- this.st = 0;
- this.t = 0;
- this.t2 = 0;
- this.st2 = 0
- this.move = function() {
- this.t2++
- if (round(-y / 2 / 35.7) > 170 || moon == 1) {
- push()
- fill(255, 0, 0)
- ellipse(this.x, this.y, 40, 40)
- if (this.x > width / 2 - 20 && this.x < width / 2 + 20 && this.y > height / 2 - 20 && this.y < height / 2 + 20 && this.st2 == 0 && moon == 0) {
- lives--;
- this.st2 = 1;
- deathmess = "you got hit by an asteroid!"
- }
- if (lives < 1 && this.x > width / 2 - 20 && this.x < width / 2 + 20 && this.y > height / 2 - 20 && this.y < height / 2 + 2 && moon == 0) {
- deathmess = "you got hit by an asteroid!";
- reset();
- home = 1
- }
- if (this.x > width / 2 - 20 && this.x < width / 2 + 20 && this.y > height / 2 - 20 && this.y < height / 2 + 20 && this.st2 == 0 && moon == 1) {
- livesm--;
- this.st2 = 1;
- deathmess = "you got hit by an asteroid!"
- }
- if (lives < 1 && this.x > width / 2 - 20 && this.x < width / 2 + 20 && this.y > height / 2 - 20 && this.y < height / 2 + 2 && moon == 1) {
- deathmess = "you got hit by an asteroid!";
- reset();
- home = 1
- }
- if (this.x > width / 2 - 20 && this.x < width / 2 + 20 && this.y > height / 2 - 20 && this.y < height / 2 + 20) {} else {
- this.st2 = 0
- }
- pop()
- }
- this.x -= yspeed / 10
- this.y = -y + this.r + this.up
- if (this.x < -150) {
- this.x = random(width + 150, width + 300)
- }
- if (this.st == 0) {
- this.st = 1
- if (this.y > height + 150) {
- this.up -= random(height + 200, height + 400)
- }
- if (this.y < -150) {
- this.up += random(height + 100, height + 300)
- }
- } else {}
- if (this.y > height + 150 || this.y < -150) {} else {
- this.st = 0
- }
- if (this.st2 == 0) {
- }
- }
- }
- function butt(xx, yy, ww, hh) {
- push()
- strokeWeight(2)
- stroke(0)
- fill(999)
- rect(xx, yy, ww, hh)
- pop()
- if ((mouseX > xx && mouseX < xx + ww && (mouseY > yy && mouseY < yy + hh))) {
- cursor(HAND)
- }
- if ((mouseX > xx && mouseX < xx + ww && (mouseY > yy && mouseY < yy + hh && mouseIsPressed))) {
- return true;
- }
- }
- function cbutt(xx, yy, ww, hh) {
- push()
- noStroke()
- noFill()
- rect(xx, yy, ww, hh)
- pop()
- if ((mouseX > xx && mouseX < xx + ww && (mouseY > yy && mouseY < yy + hh))) {
- cursor(HAND)
- }
- if ((mouseX > xx && mouseX < xx + ww && (mouseY > yy && mouseY < yy + hh && mouseIsPressed))) {
- return true;
- }
- }
- function reset() {
- x = 100
- y = -2000
- yspeed = 100
- xspeed = 0
- r = 0
- reset2 = 1
- trav = 0
- }
- function resetAll() {
- lives = null
- coins2 = null
- coinget = null
- heatres = null
- livecount = null
- startspeed = null
- coincost = null
- spacego = null
- fast = null
- travb = null
- sonic = null
- light = null
- fst = null
- fst2 = null
- stt = null
- sss = null
- ttt = null
- stu = null
- drag = null
- tf = null
- tf2 = null
- airbrake = null
- fuel = null
- fuelget = null
- moonget = null
- fm = null
- livesm = null
- coins2m = null
- coingetm = null
- heatresm = null
- livecountm = null
- startspeedm = null
- coincostm = null
- dragm = null
- airbrakem = null
- fuelm = null
- fuelgetm = null
- }
- function storeAll() {
- storeItem('lives', lives)
- storeItem('coins2', coins2)
- storeItem('coinget', coinget)
- storeItem('heatres', heatres)
- storeItem('livecount', livecount)
- storeItem('startspeed', startspeed)
- storeItem('coincost', coincost)
- storeItem('spacego', spacego)
- storeItem('fast', fast)
- storeItem('travb', travb)
- storeItem('sonic', sonic)
- storeItem('light', light)
- storeItem('fst', fst)
- storeItem('fst2', fst2)
- storeItem('stt', stt)
- storeItem('sss', sss)
- storeItem('ttt', ttt)
- storeItem('stu', stu)
- storeItem('drag', drag)
- storeItem('tf', tf)
- storeItem('tf2', tf2)
- storeItem('airbrake', airbrake)
- storeItem('fuel', fuel)
- storeItem('fuelget', fuelget)
- storeItem('moonget', moonget)
- storeItem('fm', fm)
- storeItem('livesm', livesm)
- storeItem('coins2m', coins2m)
- storeItem('coingetm', coingetm)
- storeItem('heatresm', heatresm)
- storeItem('livecountm', livecountm)
- storeItem('startspeedm', startspeedm)
- storeItem('coincostm', coincostm)
- storeItem('dragm', dragm)
- storeItem('airbrakem', airbrakem)
- storeItem('fuelm', fuelm)
- storeItem('fuelgetm', fuelgetm)
- store++
- }
- function sand2() {
- // coins2=999999999
- // coinget=999999999
- // heatres=999999999
- // livecount=999999999
- // drag=-5
- // fuel=999999999
- // fuelget=999999999
- // coins2m=999999999
- // coingetm=999999999
- // heatresm=999999999
- // livecountm=999999999
- // dragm=-5
- // fuelm=999999999
- // fuelgetm=999999999
- }
- function mouseWheel(event) {
- yy -= event.delta
- return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement