5. The KODERUNNERS Community
Creative Coding 101 - Abhik Biswas
Philosophers have wasted their lives
(and tons of papers and ink) trying to
answer this question.
14. The KODERUNNERS Community
Creative Coding 101 - Abhik Biswas
A Game Engine is a
Software FrameWork
designed for creation
and development of
video games.
15. The KODERUNNERS Community
Creative Coding 101 - Abhik Biswas
Well, technically you don't need a
Game Engine to create a game.
Games like Tic-Tac-Toe and Hangman can be made by
writing simple logical programs and can be played using
raw text or pixels.
17. The KODERUNNERS Community
Creative Coding 101 - Abhik Biswas
A Game Engine Covers all the Aspects of Game
Development including Graphics, Physics,
Simulation, Programming, AI, Sound etc.
24. The KODERUNNERS Community
Introduction to Processing
Processing is a free to use and open source graphics engine (creative coding framework) created
by Casey Reas and Ben Fry.
It is basically a Java dialect designed specifically for generating visual art, animation and any kind
of graphic application
We would be using Processing as our primary graphics engine.
Creative Coding 101 - Abhik Biswas
25. The KODERUNNERS Community
Why Processing?
Prototyping is done in the form of a sketch
Visual feedback feeds the curiosity that is inherent in new programmers
It has its own IDE (very easy)
Faster learning than OpenGL + GLUT or other alternatives
Powerful, very powerful. It allows to develop from very simple to very complex
applications
Scalable. It is possible to combine processing with pure Java and with Java
libraries. A pure Java application can use processing libraries as well..
Creative Coding 101 - Abhik Biswas ; Aritra Dey
27. The KODERUNNERS Community
Cartesian Plotting in Processing
Think about graph paper
How would you draw a line between (0, 0) and
(5,5)?
Creative Coding 101 - Abhik Biswas ; Aritra Dey
28. The KODERUNNERS Community
EX : 01 Draw a Line in Processing
line(10, 10, 90, 90);
This is your first program
Type it in and click on the Triangle (Play button) in the
top menu or select Sketch -> Run
Creative Coding 101 - Abhik Biswas ; Aritra Dey
29. The KODERUNNERS Community
line(10, 10, 90, 90);
X and Y coordinates of
the first point
X and Y coordinates of
the second point
Creative Coding 101 - Abhik Biswas ; Aritra Dey
31. The KODERUNNERS Community
EX : 01 Cartesian Map in Processing
On a computer screen, the origin (0, 0)
is always at the top left location of the
screen
Creative Coding 101 - Abhik Biswas ; Aritra Dey
32. The KODERUNNERS Community
Basic Shapes
Points, Rectangles, Triangles, Quadrilaterals etc.
Eg: point (10,10) represents a point at (10,10)
Creative Coding 101 - Abhik Biswas
33. The KODERUNNERS Community
rectangle(20, 20, 50, 50);
X and Y coordinates of
the first point
Length and Width of the
rectangle
Creative Coding 101 - Abhik Biswas ; Aritra Dey
34. The KODERUNNERS Community
quad(38,31,86,20,69,63,30,76);
X and Y
coordinates of
the 1st point
X and Y
coordinates of
the 2nd point
X and Y
coordinates of
the 3rd point
X and Y
coordinates of
the 4th point
Creative Coding 101 - Abhik Biswas ; Aritra Dey
36. The KODERUNNERS Community
Ellipses and Circles
Ellipse can be represented by specifying the
1. The coordinates of the center of the ellipse
2. The radius of the ellipse in the X-direction
3. The radius of the ellipse in the Y-direction
ellipse(xc, yc, xrad, yrad);
A circle is an ellipse with the same value for the x-radius and y-radius
Creative Coding 101 - Abhik Biswas ; Aritra Dey
37. The KODERUNNERS Community
Representing Colors
Colors in Processing are represented as a combination of Red,
Green and Blue values
0 = no contribution of a particular color
255 = maximum contribution of a particular color
Pure Red = 255, 0, 0
Pure Green = 0, 255, 0
Creative Coding 101 - Abhik Biswas ; Aritra Dey
38. The KODERUNNERS Community
Experiment with Colors
// Set fill color to Red
fill(255, 0, 0);
rect(5, 5, 70, 30);
// Set fill color to Green
fill(0, 255, 0);
ellipse(20, 60, 25, 35);
// Set fill color to a shade of Green
fill(0, 127, 0);
triangle(50, 50, 70, 70, 90, 30);
Red, Green, Blue combinations
Black = 0, 0, 0
Yellow = 255, 255, 0
Orange = 255, 102, 0
Brown = 165, 42, 42
Fuchsia = 255, 0, 255
Olive = 128, 128, 0
White = 255, 255, 255
Creative Coding 101 - Abhik Biswas ; Aritra Dey
39. The KODERUNNERS Community
Opacity / Transparency
Opacity/Transparency also defined separately in the fill function
0 = completely transparent
255 = completely opaque
Creative Coding 101 - Abhik Biswas ; Aritra Dey
43. The KODERUNNERS Community
Stroke Color
stroke(color);
*Could be a single value
(to specify gray scale)
*Could be 3 values for RGB
Creative Coding 101 - Abhik Biswas ; Aritra Dey