setVertex()
Purpose
Sets the screen position of a vertex (point) in a shape
Description
Used to change the on-screen position of a vertex in a shape drawn with drawShape()
Syntax
setVertex( shape, vertex, position )
Arguments
shape Handle which stores the shape in question
position Vector describing the desired x and y position of the supplied vertex
vertex Float index of the desired vertex (begins at 0, clockwise)
Example
gw = gWidth()
gh = gHeight()
shape = createBox( gw / 2, gh / 2, gw / 2, gh / 2 )
coords = []
col = {}
for i = 0 to 4 loop
col = { random( 1.0 ), random( 1.0 ), random( 1.0 ), 1 }
setVertexColour( shape, i, col )
coords[i] = getVertex( shape, i )
repeat
loop
clear()
j = controls( 0 )
coords[0] += { j.lx, -j.ly } * 10
coords[2] += { j.rx, -j.ry } * 10
setVertex( shape, 0, coords[0] )
setVertex( shape, 2, coords[2] )
drawShape( shape )
printAt( 0, 0, "Use the left control stick to adjust the position of Vertex 0" )
printAt( 0, 2, "Use the right control stick to adjust the position of Vertex 2" )
for i = 0 to 4 loop
if i == 0 or i == 3 then
drawText( coords[i].x - 40, coords[i].y - 20, 40, white, i )
else
drawText( coords[i].x + 20, coords[i].y - 20, 40, white, i )
endif
repeat
update()
repeat
Associated Commands
copyShape(), createBox(), createCircle(), createCurve(), createLine(), createLineStrip(), createPoly(), createStar(), createTriangle(), deleteShape(), drawShape(), getShapeBounds(), getShapeLocation(), getShapeRotation(), getShapeScale(), getShapeTint(), getVertex(), getVertexColour(), getVertexLineColour(), getVertexLineThickness(), joinShapes(), moveShape(), numVerts(), rotateShape(), scaleShape(), setShapeColour(), setShapeLineStyle(), setShapeRotation(), setShapeScale(), setShapeScaleModeLocal(), setShapeTint(), setVertexColour(), setVertexLineStyle()