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.

DarkBASIC Discussion / It doesent work

Author
Message
o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 2nd Jun 2004 16:27
Why doesent it work.
The cubes are always on a other place, or is it the camera???

Plz help me

zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 2nd Jun 2004 17:56 Edited at: 2nd Jun 2004 17:57
make object cube 1,20
make object cube 2,20
rem You are not seeding your random number functions. So, they
rem will repeat the same values. Is this oversight or design?

position object 1,rnd(500),0,rnd(500)
position object 2,rnd(500),0,rnd(500)

position camera -100,200,-100
point camera 250,0,250

if file exist("data.abc") then delete file "data.abc"
open to write 1,"data.abc"

make memblock 1,1024
rem Coordinates are floats and not integer word values.
write memblock word 1,1,object position x(1)
write memblock word 1,5,object position y(1)
write memblock word 1,9,object position z(1)
write memblock word 1,13,object position x(2)
write memblock word 1,17,object position y(2)
write memblock word 1,21,object position z(2)
write memblock float 1,25,camera position x()
write memblock float 1,29,camera position y()
write memblock float 1,33,camera position z()

History did not begin with PONG. -- Greg Costikyan

Game Beavers
o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 3rd Jun 2004 10:05 Edited at: 3rd Jun 2004 10:08
Even if i try to make floats of it.
It doesent work.

The second time the cubes are standing in another position then the first time.



Rem first time
make object cube 1,20
make object cube 2,20
position object 1,rnd(500),0,rnd(500)
position object 2,rnd(500),0,rnd(500)

position camera -100,200,-100
point camera 250,0,250

if file exist("data.abc") then delete file "data.abc"
open to write 1,"data.abc"

make memblock 1,1024
write memblock word 1,1,object position x(1)
write memblock word 1,5,object position y(1)
write memblock word 1,9,object position z(1)
write memblock word 1,13,object position x(2)
write memblock word 1,17,object position y(2)
write memblock word 1,21,object position z(2)
write memblock float 1,25,camera position x()
write memblock float 1,29,camera position y()
write memblock float 1,33,camera position z()

write memblock 1,1

suspend for key


Rem Second time
delete memblock 1
delete object 1
delete object 2
close file 1

open to read 1,"data.abc"
read memblock 1,1

make object cube 1,20
make object cube 2,20
position object 1,memblock word(1,1),memblock word(1,5),memblock word(1,9)
position object 2,memblock word(1,13),memblock word(1,17),memblock word(1,21)
position camera memblock float(1,25),memblock float(1,29),memblock float(1,33)

suspend for key
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jun 2004 17:10
It would help if you told us what you're trying to do exactly.

"eureka" - Archimedes
o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 3rd Jun 2004 22:40
I just want to save te positions of some objects to i file.
And load them back at a other moment.

I want to make a multiplayer game with 'sending memblocks'.
BadMonkey91
21
Years of Service
User Offline
Joined: 13th Jan 2004
Location:
Posted: 3rd Jun 2004 22:55
what do you mean by seeding? I have a problem with rnd() numbers.
They come up with sequential values, when exported.

o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 4th Jun 2004 10:01
Yeah what do you mean by seeding.
I dont work much with rnd numbers.
EXPLAIN
DeepBlue
22
Years of Service
User Offline
Joined: 17th May 2003
Location: A little box in the UK
Posted: 4th Jun 2004 10:54 Edited at: 4th Jun 2004 10:59
Here ya go

Following modified & works, main problem is that you had the autocam on. Also tidied the code a little & put comments in where required.



Twynklet
o0 Static 0o
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location: Belgium
Posted: 4th Jun 2004 19:37
Thanks finnaly what i need.

Thanks,Thanks,Thanks,...

Login to post a reply

Server time is: 2025-05-23 22:50:46
Your offset time is: 2025-05-23 22:50:46