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.

Code Snippets / Public source simple 3d screensaver

Author
Message
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 17:52
Hey I'm a professional Assembler and here is my first program in DBPRO. Epidemicz help with the understanding of object movement in DBPRO. There are some redundancies and the code could be a little neater, but format will come with time since this is new to me.
This is free to all to use, change, or to learn from if its possible to understand my mess.
Rem * Title : Terri
Rem * Author : Ronald Ajtaji
rem ===============================================
rem Screen Save by Ajtaji Software
rem ===============================================
rem This program is for my Wife
rem -----------------------------------------------
`set window on
sync rate 60:backdrop off:randomize timer():set display mode 800,600,16
hide mouse:sync on
set directional light 0,0,0,5:position light 0,0,0,-20
color light 0,192,192,192:set light range 0,340
set ambient light 10:block=1:mp=0:i=1
rem Load music and images
`load music "i_shot_the_sheriff_3.mid",1
`load music "jammin.mid",2
`load music "somuchtroubleintheworld.mid",3
`load music "nowoman.mid",4
`load music "sheriff.mid",5
musikloaded=5:`This is how many songs you have loaded
musik=3:`This is what song you wish to start with
`load image "teresa.jpg",1
`load image "image-02.jpg",2
`load image "image-91.jpg",3
`load image "image-127.jpg",4
`load image "image-14.jpg",5
`load image "image-16.jpg",6
`load image "image-20.jpg",7
`load image "image-43.jpg",8
`load image "image-64.jpg",9
`load image "image-69.jpg",10
`load image "image-125.jpg",11
`load image "image-126.jpg",12
`load image "image-130.jpg",13
`load image "image-173.jpg",14
`load image "image-191.jpg",15
`load image "image-192.jpg",16
`load image "image-193.jpg",17
`load image "image-194.jpg",18
`load image "image-203.jpg",19
`load image "image-205.jpg",20
`load image "image-212.jpg",21
`load image "image-226.jpg",22
`load image "image-265.jpg",23
imageloaded=23:`This is how many images you have loaded
make object cube 201,-500:position object 201,0,0,150:`The room
zz=1:px1=-15:py1=-2:pz1=10:px2=0:py2=-2:pz2=10:px3=15:py3=-2:pz3=10:`Object coordinates
make object cube 1,8
make object cube 2,8
make object cube 3,8
position camera 0,2,-20
rem load textures into video memory
for texture=1 to imageloaded
texture object 1,imageloaded
next texture
gosub positionobjects
rem Texture Object with image
play music musik
do
c1=0:c2=0:c3=0
gosub textureblocks
gosub randomscroll
loop1:
for cnt1=1 to 360
gosub checkmusik
gosub direction
rem Rotate Obj
gosub rotateobjects
gosub scroll
sync
next cnt1
for cube=1 to 3
gosub randomscroll
gosub special
next cube
loop
rem Scroll the background
scroll:
x=x+b
y=y+c
rotate object 201,x,y,380
return
rem Get random direction for background scroll
randomscroll:
d=rnd(2)
e=rnd(2)
if d>1 then b=1 else b=-1
if e>1 then c=1 else c=-1
return
rem Texture the background and Blocks
textureblocks:
texture object 201,block
texture object 1,block
texture object 2,block+1
texture object 3,block+2
`sync
if block 0 then position object 1,object position x(1)+0.1,object position y(1),object position z(1)-0.1: c1=1 else c1=0
sync
if cnt=720 then cnt=1:di=2 else cnt=cnt+1
if di2 then goto cube1 else di=0
cube1a:
gosub scroll
z1=object position z(1)
if di=0 and z1pz1 then position object 1,object position x(1)-0.2,object position y(1),object position z(1)+0.2:c1=1 else c1=0:di=2
gosub direction
gosub rotateobjects
gosub checkmusik
sync
if di2 then goto cube1a else di=0:c1=0
return
cube2:
rem for loopr=1 to 10
gosub direction
gosub rotateobjects
gosub checkmusik
gosub scroll
rem next loopr
z1=object position Z(2)
if di=0 and z10 then position object 2,object position x(2),object position y(2),object position z(2)-0.1: c2=1 else c2=0
sync
if cnt=720 then cnt=1:di=2 else cnt=cnt+1
if di2 then goto cube2 else di=0
cube2a:
gosub scroll
z1=object position z(2)
if di=0 and z1pz2 then position object 2,object position x(2),object position y(2),object position z(2)+0.2:c2=1 else c2=0:di=2
gosub direction
gosub rotateobjects
gosub checkmusik
sync
if di2 then goto cube2a else di=0:c2=0
return
cube3:
rem for loopr=1 to 10
gosub direction
gosub rotateobjects
gosub checkmusik
gosub scroll
rem next loopr
z1=object position Z(3)
if di=0 and z10 then position object 3,object position x(3)-0.1,object position y(3),object position z(3)-0.1: c3=1 else c3=0
sync
if cnt=720 then cnt=1:di=2 else cnt=cnt+1
if di2 then goto cube3 else di=0
cube3a:
gosub scroll
gosub checkmusik
z1=object position z(3)
if di=0 and z1pz3 then position object 3,object position x(3)+0.2,object position y(3),object position z(3)+0.2:c3=1 else c3=0:di=2
gosub direction
gosub rotateobjects
sync
if di2 then goto cube3a else di=0:c3=0
return
playnextsong:
if musik360 then direction=-1 else if i=1 or i
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 17:54
um could someone please tell me how to use the code button on this board so I can post this correctly.
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 18:09
I got it, gooing to post 1st half then second.
Screen save v0.01
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 18:10
Here is the second half:
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 18:11
Any comments are welcome, but bear in mind this is my first project and started Feb 2, 2003. I'm learning.
trager
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United Kingdom
Posted: 12th Feb 2003 19:15
I dont know what version of Db you have but mine has problems with rems after a colon you may want remvoe them
simple I know but you may wanna do it anyway.

I havent actually run it yet as I dont have any /mid files at hand what does it do?
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 19:20
This code only funtions with DBPRO. Didn't know about the rems. Just trying to explain my mess. Works with my compiler.
trager
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United Kingdom
Posted: 12th Feb 2003 19:20
ah I see now you have DB pro
TRS80Model1
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 12th Feb 2003 19:28
Its a picture shower which plays music. Nothing great.

Login to post a reply

Server time is: 2024-11-24 04:56:08
Your offset time is: 2024-11-24 04:56:08