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 Professional Discussion / I Need Help With Data Commands

Author
Message
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 3rd Jan 2005 04:19 Edited at: 3rd Jan 2005 06:51
I have never really used "Data, Restore, Read" commands before, so i need some help, because im making a game with them...
what im doing is making my levels represented by data, like this:

where # = wall, @ = coin, etc...
what i need to know is how to do that.

so i need to know how to read the data, then how to make it into a segment of wall from #
tahnks to all who help

NukeSoft
http://www.geocities.com/nukesoft0
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 3rd Jan 2005 09:09
i know its a somewhat dumb question, but will someone please help me out?

NukeSoft
http://www.geocities.com/nukesoft0
Baggers
21
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 3rd Jan 2005 09:58 Edited at: 3rd Jan 2005 09:58
Ok first I apolagise for not commenting this code, i am rather tired now and i just wanted to make sure you had a start before i bugger off to bed. Right now as youll see i have split your level text into induvidual characters and store them in a 2D array, you can find whats in the array by checking the co-ordinates. ie if you want to know whats at point (3,4) you can look in the array at point room$(3,4), in this demo i print all the points to the screen (the level looks skewif as characters are different lengths)
Im sorry this isnt more helpful..maybe someone more awake can translate this post and remark the code for you...but as for me im going to sleep soon...but first..more statistics revision !
GoodNight
Baggers


wmf
20
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 3rd Jan 2005 12:21
if you use numbers instead of characters I think it is a little bit easier. this code will help a little. you'll notice the wall is upside down so you have to make the data statements upside down.this is nothing fancy, it is just to demonstrate. there is also an array but it isn't used.you may need it tho.
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 3rd Jan 2005 22:57 Edited at: 4th Jan 2005 00:33
`Edited out
`Edited out
`Edited out
`Edited Out
`Edited Out

` 12th Edit

sorry, i kept posting problems i had, then fixing them, i should probably wait a while before i post, anyway, thanks, i think i can work out my game from here.

NukeSoft
http://www.geocities.com/nukesoft0
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 04:38 Edited at: 4th Jan 2005 05:19
ok, what is this code for:


`Edit
i get an error message when i set it to make more than just one of the objects, like, it can do the walls if it is just walls, it can do ladders if it is just ladders, but when i do both of them, i get a message saying that the object already exists, i already changed it so that the walls object number starts at 200, and the ladders object number starts at 400, but it loops through the for-next loop and keeps making objects until the wall object number overlaps the ladder object number... any suggestions? i tried making a variable that had to be equal to one for it to create the level, and when the level was created, the variable was set to 0, but i couldnt get it to work...

NukeSoft
http://www.geocities.com/nukesoft0
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 4th Jan 2005 05:06 Edited at: 4th Jan 2005 05:07
Looks like the way he is doing it is to create objects, draw them and then delete them, then redo all that again..

I made a primitive "2D" terrain generator at my website that uses SOMETHING like what you want to do..

[EDIT]
Here is the link

wmf
20
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 4th Jan 2005 05:31
I was only trying to make a wall to show that it would be upside down from the data statements. I had a problem getting anything to show so I started adding more and more code, then i found my mistake in the first if statement. I had 'if room = wall1' instead of 'if room = 1'. it was late and I was p----d off so i posted without making some corrections. it still showed how to use data, i hope.
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 06:20
oh, guys, i think i fixed the problem, ill get back on in a minute and post my code for u to test.

NukeSoft
http://www.geocities.com/nukesoft0
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 07:46
ok, i fixed all of my above problems, the objects flickered alot when i start the game because of how it deletes then recreates (which i htink is a good idea ) so i got rid of the "sync" command right after the delete so they dont flicker like that, the object numbers overlapping eachother is fixed now, so i think im ready to build my game with it, but i want you guys to check it one final time, here u go:



NukeSoft
http://www.geocities.com/nukesoft0
wmf
20
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 4th Jan 2005 12:28
lookin' good
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 19:25
thanks wmf for the feedback, and thanks again for helping me out, baggers, yours worked, in fact, i could have easily used urs, but wmfs was less work to convert to what i wanted, thanks though.
so then i guess ill go do the rest then.

NukeSoft
http://www.geocities.com/nukesoft0
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 19:47 Edited at: 4th Jan 2005 19:50
oh, hate to say this, but theres one problem, i need to find a way around the:

for o = 1 to 350
if object exist(o) then delete object o
next 0

because that DRASTICALLY slows it down, i put a main character in to move around, and it moved like this:

(started here) (jumped to here after a second)



`Edit
Ok, i have an idea, perhaps i could implement, clone object? is that faster than make object?

`Edit
Or i could just (for once) take a minute to think about it, and use a levelstart command... which i just did, and works perfectly, ok, then, im ready now (hopefully)

NukeSoft
http://www.geocities.com/nukesoft0
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 4th Jan 2005 19:55
oh boy! next i need to know about how to make a gravity engine, i can post a new thread if ud like, or if u r willing to help we could just keep this one?

NukeSoft
http://www.geocities.com/nukesoft0
re faze
20
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 5th Jan 2005 06:43
it would be real nice to have data and read statments work for external files.
Shadowed Lightning
20
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 7th Jan 2005 06:36 Edited at: 7th Jan 2005 11:23
ok, i mainly have everything fixed, but i really need a gravity engine, so would someone like to explain to me and/or help me write a simple one?

NukeSoft
http://www.geocities.com/nukesoft0

Login to post a reply

Server time is: 2025-06-10 05:54:51
Your offset time is: 2025-06-10 05:54:51