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-32.15<br />

(continued)<br />

Drawing the Castle<br />

FUNCTION DrawTrees()<br />

REM *** Create trees ***<br />

FOR c = tree1 TO tree1 + 30<br />

MAKE OBJECT PLAIN c,25,35<br />

TEXTURE OBJECT c, tree<br />

SET OBJECT TRANSPARENCY c,1<br />

POSITION OBJECT c,-45,17,(c-6) * 17.5<br />

NEXT c<br />

ENDFUNCTION<br />

The function DrawInternalColumns() adds randomly placed columns within the<br />

castle. This will allow our player to have obstacles to navigate without having to<br />

go to a great deal of trouble designing an exact layout for the castle's interior.<br />

The DrawTrees() function draws a set of trees by texturing a set of planes with a<br />

tree image.<br />

Activity 32.27<br />

Type in and test the program given above (castle01.dbpro).<br />

Activity 32.28<br />

Remove the main section from the program, leaving only the constants and<br />

functions. Save this as castle.dbpro.<br />

Activity 32.29<br />

Create a program (gallows.dbpro) containing a function, DrawGallows(), that<br />

produces a 3D gallows similar to that in the sketch below. Use any appropriate<br />

textures.<br />

The gallows platform should be centred on (-125,7.5,0) and be 15 units high,<br />

and 50 units in width and depth. Place the gallows on a 300 by 300 cobbled<br />

plane.<br />

In the main section of the program include the lines<br />

POSITION CAMERA 0,8,-100<br />

POINT CAMERA -150,10,0<br />

after the call to the DrawGallows() function. This will ensure that the camera<br />

is pointing at the gallows.<br />

<strong>DarkBASIC</strong> <strong>Pro</strong>: Texturing 827

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

Saved successfully!

Ooh no, something went wrong!