Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / my first program (complete n00b needs your help)

Author
Message
Ryuer
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 21st Oct 2003 02:21 Edited at: 21st Oct 2003 02:37
Ryuer
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 21st Oct 2003 02:25 Edited at: 21st Oct 2003 02:31
rem *********************************************************************
rem * First Program *
rem * *
rem * On 20-10-03 *
rem * *
rem *********************************************************************

rem load background texture

texture backdrop 1

rem set background colour
backdrop on
color backdrop 0
set ambient light 20

rem hide the mouse pointer
hide mouse

rem turn on sync to keep refresh rate up
sync on
sync rate 100

rem make a simple cube
make object cube 1,0.05


rem make another cube (number 2)
make object cube 2,0.05

rem and another
make object cube 3,0.05

rem colour the cubes
color object 1,RGB(2,213,21)
color object 2,rgb(2,213,21)
color object 3,rgb(2,213,21)

rem position cube number 2
position object 2,0.05,0.05,0.05

rem position cube number 3
position object 3,-0.05,-0.05,-0.05

rem make some variables for the X, Y and Z axis
c=2
b=2
a=2

rem this code will increase the rotation of the object each time it is read
rem which in this case is 1800 times
for t=0 To 1800
inc a
inc b
inc c
rotate object 1,a,b,c

rem set cube 2 and cube 3 to point at cube 1 and stay focused
set object to object orientation 2,1
set object to object orientation 3,1

rem check VARIABLES A, B and C haven`t gone past 358 (These are rotation
rem variables, and 360 degrees is full turn, beacause we have used increments
rem of 2 these variables need to be limited to 358) On reaching 358
rem the cube has done a complete rotation therefore returns to 0 and starts
rem again
if a>358 then a=0
if b>358 then b=0
if c>358 then c=0

rem call SYNC for csreen refresh
sync
next t
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 21st Oct 2003 02:26
cool...pretty good for a first program

my first program was really pathetic



"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 21st Oct 2003 02:27
sorry...posted at the same time....

i see what i can do

"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
Ryuer
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 21st Oct 2003 02:34 Edited at: 21st Oct 2003 02:36
Doh seems i deleted my post

Anyhoo basically i need help to rotate the 2 outer cubes around the center cube.

also any advice to shorten or speed up my code would be much appreciated.

I hope to make a tech demo when i understand a bit more of DB so any snippets or advice would be most welcome

If my REMS are wrong plz point me in the right direction

This code took me about 3 hrs to do... just tried a few things while browsing the manual
Ryuer
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 23rd Oct 2003 23:33
Bumping
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 24th Oct 2003 00:39
if you position the cubes in the center of the middle cube, then rotate then say 1 degree, then move them backwards a fixed distance, then sync the screen, they will look to be revolving around the cube, just a quick example (may need tweaking/fixing..in a hurry)

sync on:sync rate 0
make object cube 1,2
make object cube 2,1
make object cube 3,1
position camera 5,5,5
point camera 0,0,0
do
position object 2,0,0,0
position object 3,0,0,0
turn object left 2,1
turn object right 3,1
move object 2,4
move object 3,3
sync
loop

cheers.

Mentor.
Ryuer
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 24th Oct 2003 01:29
nice one mentor thanks alot

will learn from that

Login to post a reply

Server time is: 2024-11-25 15:03:38
Your offset time is: 2024-11-25 15:03:38