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 / I know you'll think I'm stupid, but.......

Author
Message
Qualed Entertainment
19
Years of Service
User Offline
Joined: 17th Nov 2005
Location:
Posted: 21st Jun 2006 22:56
I'm in need of a save/load command for my Mini Cooper Racing game. Anyone that post is greatly appriseated (yes, i know i cant spell)
Thank you in advance,
~Qualed Entertainment

CEO of Qualed Entertainment
Join the Qualed Code Group: email me at [email protected]
NeX the Fairly Fast Ferret
20
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 21st Jun 2006 23:01
Tell me the variables you want saving.

<OMG></OMG>
NeX, you cant be serious - CattleRustler.
Qualed Entertainment
19
Years of Service
User Offline
Joined: 17th Nov 2005
Location:
Posted: 21st Jun 2006 23:03
well, i want to save the money, the car, and the level

CEO of Qualed Entertainment
Join the Qualed Code Group: email me at [email protected]
nojbox87
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: England
Posted: 22nd Jun 2006 00:08
look in the help file about saving things to disk. then just save the variables you want into this file.

I am a Christian and I know that God loves me. That is what makes my life so great!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Jun 2006 14:07
I know you have good intentions with this forum, so I wrote them down for you...

open to write filenr, filename$ - Creates a file to write data in.
open to read filenr, filename$ - Opens an existing file to extract data from.

close file filenr - closes the file you opened to write or read.

write byte filenr, var - will write a byte to a file
write file filenr, var - will write a longword to a file
write word filenr, var - will write a word to a file
write long filenr, var - will write a longword to a file
write float filenr, var# - will write a float to a file
write string filenr, var$ - will write a string to a file

read byte filenr, var - will read a byte from a file
read file filenr, var - will read a longword from a file
read word filenr, var - will read a word from a file
read long filenr, var - will read a longword from a file
read float filenr, var# - will read a float from a file
read string filenr, var$ - will read a string fom a file

For example:
To Save the data of a player:


And to extract that same data again:


At this point, LoadedPlayerName$ = PlayerName$, LoadedMoney = Money, LoadedSpeed# = Speed#, LoadedLevel = level.

Note: The data has to be loaded in the same order as you saved it. First writing a float and then a string, can only be loaded again by first reading a float and then a string and not vice versa.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
nojbox87
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: England
Posted: 23rd Jun 2006 20:36
Quote: "I know you have good intentions with this forum, so I wrote them down for you..."


sorry if i sounded insulting/critical i didnt meant to.

I am a Christian and I know that God loves me. That is what makes my life so great!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 24th Jun 2006 18:19 Edited at: 24th Jun 2006 18:19
nojbox87

I meant Qualed. Some ppl dont't want to look in the help files because they're too lazy.



It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Qualed Entertainment
19
Years of Service
User Offline
Joined: 17th Nov 2005
Location:
Posted: 26th Jun 2006 03:26
thanks nojbox87 and Sven B.

now, another question.
this time it deals with them menu of another game im making (its summer, im trying to keep busy)



ignore the game, its not done yet.
if you tested the code, you saw that the menu was flashing. also, im wondering if there is any way to rotate a collision box. *shrugs* it would make it alot easier if you could.

CEO of Qualed Entertainment
Join the Qualed Code Group: email me at [email protected]
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 26th Jun 2006 12:17
I remarked the codeline
load bitmap "title.bmp"
And it ran very smoothly...

I'd suggest you do this:
Before the loop
load image "title.bmp", 1

And in the loop, in the start:
paste image 1, 0, 0

Ofcourse, the image has to be the same size as the screen...

And about the rotate collision box thing.
You can do that by changing the last parameter of make object collision box. But you won't be able to use sliding collision when doing that.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Qualed Entertainment
19
Years of Service
User Offline
Joined: 17th Nov 2005
Location:
Posted: 26th Jun 2006 19:58
i figured out the collision box

i changed
make object collision box 15,-4,-200,-45,4,200,45,0

to
make object collision box 15,-45,-200,-4,45,200,4,0

and it worked.

thanks again Sven B

CEO of Qualed Entertainment
Join the Qualed Code Group: email me at [email protected]

Login to post a reply

Server time is: 2025-05-25 12:44:33
Your offset time is: 2025-05-25 12:44:33