11 Pages
Unlock Document

Simon Fraser University
Computing Science
CMPT 166
Toby Donaldson

void setupsizex y void draw Shape functionsellipselocationX locationY width heightrect locationX locationY width heightBe careful when drawing ellipse and rect near corners radiustriangle x1 y1 x2 y2 x3 y3mouseXx1 mouseYy1 etcline x1 y1 x2 y2point x1 y1 Color functionsName of colorcolorr g b coder g b alphatransparencybackground name of color given color variable declaredfill name of color given color variable declarednoFill stroke name of color given color variable declaredstrokeWeight numberUsed with other functionsmap x low current high current low target high targetEg fillmapmouseXmouseY 0 500500 0 255State all color functions before shapes Image functionsPImage namenameloadImageimagenamepngimage name of image x y Etcsmooth frameRate number changes number of times drawis called Making things movefloat xfloat yynumberstarting location of objectynumbermoves object downynumbermoves object up Detecting edgesif ynumber ynumberor dydyNotations for if statements greater than or equal less than or equal equal not equalorand Velocity variablesfloat dxfloat dy Specific variablesfloat Widthfloat Heightfloat diamdiam Width or Heightnumber Testing to see if point is inside shapeboolean pointInCirclefloat x float y x y is any pointfloat a float b a b is the circles centerfloat r r is the circles radiusif distx y a br return trueelse return falseboolean pointInRectfloat a float bpointfloat x float yrectangles upperleft cornerfloat w float hwidth and height if axaxwbybyh return trueelse return falsevoid mousePressed if pointInCirclemouseX mouseY x y diam2 if ballcolororange ballcolorcolor255 0 0 else ballcolororange
More Less

Related notes for CMPT 166

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.