Skip to content

Instantly share code, notes, and snippets.

@themellowj
Created November 3, 2019 02:01
Show Gist options
  • Select an option

  • Save themellowj/18e952c9a02736b6fd2910c04c0423af to your computer and use it in GitHub Desktop.

Select an option

Save themellowj/18e952c9a02736b6fd2910c04c0423af to your computer and use it in GitHub Desktop.
Justin Scuffed Coding
from procgraphics import *
import procgraphics as pg
mtn_color = "brown"
t_color = "gray"
def mountain1(x,y,scale):
global mtn_color
#Mountain1
#x y will be the bottom left corner
#X Y is being added to other values to get
#to different points on the grid
#scale is only for numerial values
fill(101,67,33)
triangle(x, y, x+45*scale, y-85*scale, x+95*scale, y)
fill(mtn_color)
triangle(x+25*scale, y-50*scale, x+45*scale, y-85*scale, x+60*scale, y-60*scale)
#fill()
#triangle(x, y, x+45*scale, y-30*scale, x+95*scale, y)
#triangle(80, 130, 125, 45, 175, 130)
#Mountain2
#fill(101,67,33)
#triangle(200, 130, 245, 45, 300, 130)
#Mountain2
#fill(101,67,33)
#triangle(340, 130, 385, 45, 430, 130)
#yellow sun
def sun(x,y,scale):
fill(255, 255, 0)
ellipse(180,100,100,100)
#Cloud
def cloud(x,y,scale):
beginShape()
fill(255,255,255)
vertex(30, 20)
bezierVertex(80, 0, 80, 75, 30, 75)
bezierVertex(50, 80, 60, 25, 30, 20)
endShape()
def waterc(x,y,scale):
fill(20, 153, 253)
ellipse(150,300,200,100)
#def water(x,y,scale)
#quad(38, 31, 86, 20, 69, 63, 30, 76)
def setup():
global mtn_color
global t_color
mtn_color = "brown"
t_color = "gray"
windowwidth = 500 # the width of the window
windowheight = 500 # the height of the window
size(windowwidth,windowheight) # create the window
#blue background
fill(57, 82, 214)
quad(0,0, 0, 130, 500, 130, 500, 0)
#What to call
sun(180,90,1)
#Resizeable mountain
mountain1(80,130,1)
mountain1(200,130,1.5) #x y and scale
mountain1(320,130,.5)
cloud(50,60,1)
#Green Grass
fill(2, 181, 20)
rect(0, 130, 500, 500)
#water needs to be on top of grass
waterc(150,300,1)
tombstone(350,350,1)
tombstone(300,200,.59)
tombstone(410,200,.195)
tombstone(160,180,.29)
tombstone(250,100,.25)
tombstone(270,200,.1)
tombstone(100,205,.115)
#Horzion line
#Horzion = (0, 130, 500, 130)
#line(0, 130, 500, 130)
#tombstone
def tombstone(x,y,ts_scale):
global t_color
#global ts_scale
fill(t_color)
beginShape()
#curveVertex(400, 450)
curveVertex(x, y)
curveVertex(x, y)
#curveVertex(400,390)
curveVertex(x,y-60*ts_scale)
#curveVertex(446, 349)
curveVertex(x+46*ts_scale, y-101*ts_scale)
#curveVertex(492, 450)
curveVertex(x+92*scale,y-60*ts_scale)
curveVertex(x+92*ts_scale, y)
curveVertex(x+92*ts_scale,y)
endShape()
def draw():
global mtn_color
global t_color
global scale
global ts_scale
mountain1(80,130,1)
mountain1(200,130,1.5 ) #x y and scale
mountain1(320,130,.5)
if (pg.keyPressed): #When draw when Key is pressed
if (pg.key == 'b' or pg.key == 'B'):
#If B is pressed then the fill black
mtn_color = "blue"
else:
mtn_color = "blue"
tombstone(350,350,ts_scale)
if (pg.keyPressed):
if (pg.key == 'g' or pg.key == 'G'):
t_color = "white"
text("R.I.P", 350, 350)
fill("black")
else:
t_color = "gray"
fill("black")
if (pg.keyPressed):
if (pg.key == 's' or pg.key == 'S'):
ts_scale == ts_scale *.5
runLoop(setup,draw,)#keyPressedFunc = keyPressed)
#if not b is not pressed it will stay white
#ef tdraw():
#runLoop(setup,draw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment