Interactivity & Control: Arrays

0 Comments
Arrays:

Arrays allow the storage of more than one value in a variable, whilst retaining a single reference.
An array is the equivalent of a box divided into partitions, each containing a single piece of data.
A array is a simple mechanism for storing and working with a set of related data.
Use an array when needing to store multiple values of the same data type.
Arrays can be one-dimensional or two-dimensional.

Our introduction to arrays:


This interaction was based on storing independent information about each object into an array, retaining the single reference. It involved the mouseX, mouseY and mousePressed features to define the information about the new object in the array slot. The mouseX and mouseY stored the starting x and y positions of the object. mousePressed created new objects according to where mouseX and mouseY were positioned. There are no limits to the length of this array, therefore an infinite amount of objects can be created, whilst retaining the single reference.


You may also like

No comments:

Powered by Blogger.