Learn Programming - ZedLX

A Free Computer Programming Tutorial for Beginners

Images and Sprites [1/8]

Images and Sprites

The type imageLoader can be used to load an external image. An URL is the only argument of initializer for type imageLoader

The getter .isError from type imageLoader waits for the image to load. If the loading succeeds, it returns false. If it fails, it returns true.

The getter .url from type imageLoader returns the image URL (the one given in the initializer).

The type image represents images.

The functional getter .getImage from type imageLoader returns the image if the loading has suceeded.

The member function .draw from type image draws the image to the screen. The argument is of type point2D. This member function does not return a value, which makes it a procedure.

In this program, the argument of member function .draw is given by the initializer of type point2D.

To make the zombie not leave a trail, clear the screen on each iteration of the for loop.

Loading...