Class Element
Description
Elements are visual components on layers other than main. They can be manipulated by programming through the Element class at runtime. Used in concert with Layer, this functionality provided a powerful way of controlling the paralax scrolling and other multi-layer game visual effects.Members
- int x
- int y
- bool show
- int imageSet
- int imageNo
- int id
Element:hide
- in void
- out void
Element:move
- in int aim
- out bool
UP DOWN LEFT RIGHT
Element:moveBy
- in int tx
- in int ty
- out void
local layer = getLayer( "fw"); for i=1, layer:getSize() do local t = rand () % 8; local e = layer:getElement( i - 1); if (e.y > BUFFERHEI) then e:moveTo(rand() % BUFFERLEN, (rand() % BUFFERHEI) - BUFFERHEI); else if (t == 0) then e:moveBy(1, 0); end if (t == 7) then e:moveBy(-1, 0); end e:moveBy(0, 4); end end
Element:moveTo
- in int x
- in int y
- out void
e:moveTo(100, 100)
Element:setImage
- in int imageSet
- in int imageNo
- out void
Element:show
- in void
- out void