deleteShape()

Purpose

Delete a shape drawn using drawShape()

Description

Fully removes all traces of the supplied shape. This also renders the handle assigned to the shape as void

Syntax

deleteShape( shape )

Arguments

shape Handle which stores the shape to delete

Example

w = gwidth()
h = gheight()
radius = 100

shape1 = createCircle( w / 3, h / 2, radius, 360 )
shape2 = createCircle( w - w / 3, h / 2, radius, 360 )
shape3 = 0

join = false
dist = 0

loop
    clear( grey )
    j = controls( 0 )

    if !join then
        shape1Location = getShapeLocation( shape1 )
        shape2Location = getShapeLocation( shape2 )
        dist = distance( shape1Location, shape2Location )
    endif

    if dist < radius * 2 and !join then
        shape3 = joinShapes( shape1, shape2 )
        deleteShape( shape1 )
        deleteShape( shape2 )
        join = true
    endif

    if join then
        moveShape( shape3, { j.lx, -j.ly } * 6 )
        drawShape( shape3 )
    else
        moveShape( shape1, { j.lx, -j.ly } * 6 )
        drawShape( shape1 )
        drawShape( shape2 )
    endif

    update()
repeat

Associated Commands

copyShape(), createBox(), createCircle(), createCurve(), createLine(), createLineStrip(), createPoly(), createStar(), createTriangle(), drawShape(), getShapeBounds(), getShapeLocation(), getShapeRotation(), getShapeScale(), getShapeTint(), getVertex(), getVertexColour(), getVertexLineColour(), getVertexLineThickness(), joinShapes(), moveShape(), numVerts(), rotateShape(), scaleShape(), setShapeColour(), setShapeLineStyle(), setShapeRotation(), setShapeScale(), setShapeScaleModeLocal(), setShapeTint(), setVertex(), setVertexColour(), setVertexLineStyle()