Image

Type     [gd]

class (base class :)

Inheritance

Image ➝ Display ➝ Object

Overview

  Creates and displays an image on the screen from a file or ImageSheet object. The local origin is at the center of the image. Initial anchor point is the center of the image also.

  Image objects can use the methods defined in Display class.

See also [bg]

Display, ImageSheet


Syntax


from png file:


    local p = Image(fileURL)


  • fileURL (type : string )  The full path and name of the image file.




from ImageSheet object:


    local p = Image(object_ImageSheet, id_frame)


  • object_ImageSheet : object of ImageSheet

  • id_frame (type : num ) : frame index of ImageSheet object





Examples


local img = Image('moon.png')



local sht = ImageSheet('cat.png',512,256,8)

local m = Image(sht,1)



-- set initial x,y as 100,200

local img = Image('moon.png'):setXY(100,200) 



-- set initial x,y as 100,200

-- set initial rotational speed as 2 at the same time

local img = Image(‘moon.png’):setXY(100,200):setDrot(2)



local g = Group()

local img = Image('moon.png')


-- remove image after 5 seconds


img:removeAfter(5000)



-- remove if x>1000


function img:update(e)

    return x>1000

end


댓글 없음:

댓글 쓰기