Top Banner
Programming codes
15
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 2: Programming codes

IntroductionEllipse(20, 20, 20, 20);1)0------)400 across2)0------)400 wide3)Figure move right left4)Figure move up down

Do not forget to put; after each code

Page 3: Programming codes

figures

Ellipse-circle rect=-rectangleLine-line

-first two numbers(50,50,50,50) are located in the middle of the (circle)

-first two numbers(50,50,50,50)are located at the top left corner (rectangle)

Page 4: Programming codes

lineLine(89,98,87,68);First two numbers (89,98,87,68) are where

the line should startSecond two numbers (89,98,87,68) is where

the line should end

X acrossY down

Page 5: Programming codes

How program will work

Ellipse(45,65,76,86);Rectangle(100,100,100,100);Line(90,90,90,90);

First program will draw ellipse than rectangle

If rectangle is bigger than ellipse than it will cover it in program

Page 6: Programming codes

Pixels and backgroundAll of numbers in figures are pixels

Background can go from 0-255Firs number is amount of red in colour Second number is amount of green in colourThird number is amount of blue in colourIf you will put background last it will cover all

page

Page 7: Programming codes

Stroke Stroke(50,50,50);Stroke-outlining of figure noStroke(); If you don’t write anything stroke will be in

you programIf for example you have many circles that

have background white than if you do no ‘stroke’ it will colour all of your work with wite

Page 8: Programming codes

fillFill(20,20,20);It will colour certain areaIf you have two circles and you put fill on top

of one it will fill both ,but if you will put fill on top of second circle you could colour it with different colours.

Page 9: Programming codes

Variablesvar hello=50;First var hello=50; variableSecond var hello=50; getsThird var hello=50; 50

Variable is a place holder for something elseYou can call a variable anything just do not

make spaces between name

Page 10: Programming codes

Variablesvar hi=20;Ellipse (50, 50,hi,hi);If you would make changes to (var hi=20;)

then it will make changes for two number in the ellipse because it is holding two places Ellipse (50, 50,hi,hi);

Page 11: Programming codes

+ - variablesIf I want to change possession of face we

need to drag out objects, so here how you do it.

var hi=50Ellipse(400,200,100,50);Ellipse(hi+350, hi+150, hi+50,hi);

Var x=200Ellipse(x+200,x,x-100,x-150);Make this for everything you have.

Page 12: Programming codes

Testing variables Var x=198; var x=123;X=300; var x=300;X=200; var x=200;

Here we made here we made a second group one group called x called x We only need to write one ‘var’ per variable

If we make a new variable computer would use a brand new one ,so first variable will not be in the app

Page 13: Programming codes

ExplanationIf y changed its value before x=y it will

change the answer

If y changed its value after x=y it doesn’t make a difference

10 Var x= 10;

10 Var y=20;

20 X= y;

20 Y=7;

Page 14: Programming codes

Change size of variableVar facesize=300;Face=facesize/7;Var eyesize=facesize/6;

Problem; the size of the face are smaller but they are not in the right position

Solve;Ellipse(x-facesize/6,y,facesize/7,40);

Page 15: Programming codes

EndThis is the end of part 1. Thank you for

watching this!

For more information: gotohttp://markprograming.wordpress.com/

For questions contact me at: [email protected]

Don’t Miss my presentations!