13.01.2013 Views

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

Hands On DarkBASIC Pro - Digital Skills

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

LISTING-31.7<br />

Resizing an Object<br />

REM *** Set display resolution ***<br />

SET DISPLAY MODE 1280,1024,32<br />

REM *** Make and position the sphere **<br />

MAKE OBJECT SPHERE 1, 20<br />

POSITION OBJECT 1, 0,0,200<br />

REM *** Resize sphere ***<br />

SCALE OBJECT 1, 200.0,100.0,50.0<br />

REM *** Rotate shape ***<br />

DO<br />

TURN OBJECT RIGHT 1, 1.0<br />

LOOP<br />

REM *** End program ***<br />

WAIT KEY<br />

END<br />

Activity 31.17<br />

Type in and test the program in LISTING-31.6 (object3D09.dbpro).<br />

Modify the program so that a cone is used in place of the sphere.<br />

Showing and Hiding Objects<br />

FIG-31.39<br />

The HIDE OBJECT<br />

Statement<br />

FIG-31.40<br />

The SHOW OBJECT<br />

Statement<br />

Any 3D object is immediately visible from the moment it is created (assuming it’s<br />

within view), but it is possible to hide an object using the HIDE OBJECT statement,<br />

making it reappear later using the SHOW OBJECT command.<br />

The HIDE OBJECT Statement<br />

An object can be made invisible using the HIDE OBJECT statement which has the<br />

format shown in FIG-31.39.<br />

In the diagram:<br />

objno is the integer value previously assigned to the<br />

3D object which is to be hidden.<br />

The SHOW OBJECT Statement<br />

An object which has been previously hidden can be made to reappear using the<br />

SHOW OBJECT statement which has the format shown in FIG-31.40.<br />

In the diagram:<br />

HIDE<br />

SHOW<br />

OBJECT objno<br />

OBJECT objno<br />

objno is the integer value previously assigned to the<br />

hidden 3D object which is to reappear.<br />

776 <strong>DarkBASIC</strong> <strong>Pro</strong>: 3D Primitives

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!