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.15<br />

The Result of Moving the<br />

Cube to (9,0,0)<br />

LISTING-31.2<br />

Moving the Cube<br />

y-axis<br />

LISTING-31.2 is a modification of the previous listing which moves the cube to<br />

position (9,0,0) after the user presses a key. The new lines have been highlighted.<br />

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

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

COLOR BACKDROP 0<br />

BACKDROP ON<br />

REM *** Make the cube **<br />

MAKE OBJECT CUBE 1, 10<br />

REM *** Move cube to (9,0,0) after key press ***<br />

WAIT KEY<br />

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

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

WAIT KEY<br />

END<br />

Activity 31.4<br />

Modify your previous program to match that given in LISTING-31.2.<br />

Add the lines<br />

The centre of the cube<br />

is at (9,0,0)<br />

z-axis<br />

x-axis<br />

REM *** Move the cube backwards ***<br />

WAIT KEY<br />

POSITION OBJECT 1, 9,0,30<br />

so that the object is moved for a second time.<br />

Notice that, in its final position, the cube looks smaller since it has now moved<br />

further away from our viewing position.<br />

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

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

Saved successfully!

Ooh no, something went wrong!