Created
March 7, 2019 03:39
-
-
Save thcrack/7a5e934b424ed31005f9af179bb74e9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float tailWidth = 40; | |
float bodyWidth = 160; | |
float headWidth = 40; | |
float wingHeight = 20; | |
float stripeWidth = 20; | |
float rocketAnimationPosition = 0; | |
float rocketXSpeed = 2; | |
float rocketYAngleSpeed = 2; | |
float rocketYAngle = 0; | |
float rocketYAmplitude = 40; | |
float rocketTopY = 20; | |
float jupiterX = 0, jupiterY = 100; | |
float jupiterSize = 0; | |
float jupiterMaxSize = 200; | |
PImage bg, jupiterImage; | |
void setup(){ | |
size(800,200); | |
bg = loadImage("cosmos.png"); | |
} | |
void draw(){ | |
background(bg); | |
float rocketX = 300; | |
float rocketY = rocketTopY - 60; | |
// R1: Draw Rocket | |
// BODY | |
noStroke(); | |
fill(255); | |
rect(rocketX - bodyWidth + 30, rocketY + 80, bodyWidth, 40); | |
// RED STRIPE ON THE BODY | |
fill(#AC3939); | |
rect(rocketX - 90, rocketY + 80, stripeWidth, 40); | |
// FRONT HEAD | |
fill(#AC3939); | |
arc(rocketX - headWidth + 70, rocketY + 100, headWidth * 2, 40, -HALF_PI, HALF_PI, OPEN); | |
// BACK FIRE | |
fill(#FFD62E); | |
arc(rocketX - bodyWidth - tailWidth + 30, rocketY + 100, 40, 40, HALF_PI, PI + HALF_PI, OPEN); | |
// TAIL QUAD | |
fill(#AC3939); | |
quad(rocketX - bodyWidth - tailWidth + 30, rocketY + 60, rocketX - bodyWidth - tailWidth + 30, rocketY + 140, rocketX - bodyWidth + 30, rocketY + 120, rocketX - bodyWidth + 30, rocketY + 80); | |
// WINDOW | |
fill(#cff4f9); | |
stroke(#B6D1DA); | |
strokeWeight(1); | |
ellipse(rocketX, rocketY + 100, 25, 25); | |
// LEFT WING | |
fill(#D0D0D0); | |
noStroke(); | |
//rect(rocketX - 120, rocketY + 60, 40, 20); | |
triangle(rocketX - 70, rocketY + 80, rocketX - 70, rocketY + 60, rocketX, rocketY + 80); | |
// RIGHT WING | |
//rect(rocketX - 120, rocketY + 120, 40, 20); | |
triangle(rocketX - 70, rocketY + 120, rocketX - 70, rocketY + 140, rocketX, rocketY + 120); | |
// R3: Rocket Animation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment