Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Images and Sprites [4/8]

The type sprite is similar to the type image with a few extras: a sprite has its own size and center.

The initializer of type sprite accepts an image. The dimensions of the sprite are set to equal the dimensions of the image by default.

The member .size from type sprite contains the dimensions of the sprite. This member is both getter and setter; changing this member will change the size of the sprite. This member is of type vector2D.

The member function .draw from type sprite can accept 1, 2 or 3 arguments. The first argument is the position of the sprite. The other arguments will be explained on the next page.

The member .image from type sprite contains the original image.

Loading...