Book Image

Processing 2: Creative Coding Hotshot

By : Nikolaus Gradwohl
Book Image

Processing 2: Creative Coding Hotshot

By: Nikolaus Gradwohl

Overview of this book

Processing makes it convenient for developers, artists, and designers to create their own projects easily and efficiently. Processing offers you a platform for expressing your ideas and engaging audiences in new ways. This book teaches you everything you need to know to explore new frontiers in animation and interactivity with the help of Processing."Processing 2: Creative Coding Hotshot' will present you with nine exciting projects that will take you beyond the basics and show you how you can make your programs see, hear, and even feel! With these projects, you will also learn how to build your own hardware controllers and integrate devices such as a Kinect senor board in your Processing sketches.Processing is an exciting programming environment for programmers and visual artists alike that makes it easier to create interactive programs.Through nine complete projects, "Processing 2: Creative Coding Hotshot' will help you explore the exciting possibilities that this open source language provides. The topics we will cover range from creating robot - actors performing Shakespeare's "Romeo and Juliet", to generating objects for 3D printing, and you will learn how to run your processing sketches nearly anywhere from a desktop computer to a browser or a mobile device.
Table of Contents (16 chapters)
Processing 2: Creative Coding Hotshot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mission Accomplished


For this mission, we created a moon-lander simulation game and made it run in the browser using the Processing's JavaScript mode and on Android devices using the Android mode.

In the first task, Drawing a sprite, we created the graphics for the game starting with a background grid to make the game look like it's drawn on a mathematics notebook. We then added a moon landscape and a landing platform. The rocket has to be able to move and rotate, so we used the pushMatrix() and popMatrix() methods to separate the translating and rotation operations we want to perform on the image form the rest of the drawing code.

In the second task, Initiating the landing sequence, we implemented the physics and the controls for our game. We started by adding a vector for the moon's gravity and one for the rocket's speed. For every frame, the gravity influences the speed of the ship, which in turn influences the rocket's position.

Then we implemented a keyPressed() method and enabled the...