Skip to content
tanema edited this page Oct 29, 2014 · 4 revisions

:setPosition(x, y)

sets the shadow body center at x, y

:move(x, y)

adds x and y to the current position of the shadow body

:getPosition()

returns: x, y

returns the position of the shadow body

:getWidth()

returns: width number

returns the bodies width

:getHeight()

returns: height number

returns the bodies height

:getImageWidth()

returns: width number

returns the width of the image if this is for an image shadow body

:getImageHeight()

returns: height number

returns the height of the image if this is for an image shadow body

:setDimension(width, height)

sets the width and height of the shadow body if rectangle

:setOffset(ox, oy)

sets the offset of the under shadow

:setImageOffset(ix, iy)

sets the offset of the image being drawn as a material

:setNormalOffset(nx, ny)

sets the offset of the normal map

:setGlowColor(red, green, blue)

set the glow color

:setGlowStrength(strength)

sets the glow strength 0 -> 1

:getRadius()

returns: radius number

gets the radius if a circle body

:setRadius(radius)

sets the radius if a circle body

:setPoints(...)

sets polygon points if a poly shadow body. accepted in the form of x1,y1,x2,y2...,xn,yn

:getPoints()

returns the data points if the body is a polygon body

:setShadow(hasShadow)

sets if the body casts a shadow or not

:setShine(hasShine)

sets if the body reflects the light

:setColor(red, green, blue)

sets the color of the shadow

:setAlpha(alpha)

set the alpha of the shadow

:setReflection(hasReflection)

set if the body has reflection

:setRefraction(hasRefraction)

set if the body has refraction

:setReflective(reflective)

set if the body has reflection

:setRefractive(refractive)

set if the body has refraction

:setImage(img)

set the image on the body

:setNormalMap(normal, width, height, nx, ny)

set the normal map on the body with offset nx, ny

:setNormalTileOffset(tx, ty)

set the normal map offset

:setHeightMap(heightMap, strength)

sets a normal map from a height map strength 0 -> 1

:generateNormalMapFlat(mode)

generate flat normal map from image mode = {'top', 'front', 'back', 'left', 'right'}

:generateNormalMapGradient(horizontalGradient, verticalGradient)

defaults: horizontalGradient = "gradient", verticalGradient = horizontalGradient gradients = {"gradient", "inverse"} generate normal map gradient from the img

:generateNormalMap(strength)

generates a normalmap from the bodies image strength 0 -> 1

:setMaterial(material)

set the material to be drawn

:setGlowMap(glow)

:getType()

get body type

:setShadowType(type, ...)

set shadow type circle: args = radius, offsetx, offsety rectangle: args = width, height, offsetX, offsetY, polygon: no args image: args = shadowX, shadowY, fadeStrength