Learn creative coding writing simple programs

111. Drive 100 cars: an array of objects

Second episode about OOP (Object Oriented Programming), in which we create an array of objects.
In the past we have created arrays of simple types, like int or float, and we have also created two instances of Car. Here we are going to combine both things: we are going to create instances of Car, but instead of making one or two we will create 100, and store all those cars inside one array.
Of course these rectangular "cars" don't look very spectacular, but in coming episodes we will create arrays of particles that decide in which direction to go. I hope then you start seeing how you can use arrays of objects.

Tags: oop, array, object

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus