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.

FIG-31.16<br />

The MOVE OBJECT<br />

Statement<br />

Activity 31.5<br />

Write a program (object3D02.dbpro) to create the following objects, and then<br />

position each as specified:<br />

Object Number Object Type Dimensions Final Position<br />

1 CUBE 4 9,0,0<br />

2 BOX 10,15,5 -60,0,100<br />

3 SPHERE 7 -30,-40,50<br />

4 CYLINDER 12 25,0,120<br />

5 CONE 12 0,25,100<br />

Add a WAIT KEY statement between each move.<br />

The screen should appear as shown below.<br />

The MOVE OBJECT Statement<br />

The MOVE OBJECT statement can be used to move an object a specified distance<br />

from its current location.<br />

There are four possible directions available: RIGHT, LEFT, UP and DOWN. The<br />

statement has the format shown in FIG-31.16.<br />

In the diagram:<br />

Screen at Start Screen at End<br />

{ }<br />

UP<br />

DOWN<br />

MOVE OBJECT objno , dist<br />

LEFT<br />

RIGHT<br />

UP, DOWN, LEFT, RIGHT<br />

<strong>On</strong>e of these keywords must be used to indicate in<br />

which direction the object is to be moved.<br />

objno is an integer value giving the ID of the object to be<br />

moved.<br />

764 <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!