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.

2D All the way! / Help with my tile engine(Easier way?)

Author
Message
Eponick
19
Years of Service
User Offline
Joined: 18th Mar 2003
Location:
Posted: 19th Mar 2003 03:31 Edited at: 19th Mar 2003 03:32
I was wondering if there was an easier way to store mass arrays without like 70 lines of code?

Currently I have:


for the map array.

I know in C++ i could just:



And I was wondering if DBPro had some similar way to do this?

indi
20
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Mar 2003 04:03
you can use a data statement but this is tidier to randomly fill the data or to flush to the data to any amount u want which is by removing the rnd() command and inserting the number you want to flush the array to.

dont forget arrayspace zero is still a valid space and can be used for switches later if u want.

sometimes its just neater to skip them as there is no zero location for media.




Eponick
19
Years of Service
User Offline
Joined: 18th Mar 2003
Location:
Posted: 19th Mar 2003 04:06
But im not wanting it to be random..

indi
20
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Mar 2003 04:33
like i said in this line

Map(x,y)=rnd(100)+1

the rnd(100)+1 generates a random number into the spaces

u could change this suit your needs

Map(x,y)=0

makes all the spaces zero hence a flushing mechanism

or even something a little more complex
Map(x,y)=2+(x * 10)

Eponick
19
Years of Service
User Offline
Joined: 18th Mar 2003
Location:
Posted: 19th Mar 2003 04:59
Wouldnt that make them all the same tile though?

indi
20
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 19th Mar 2003 05:07
yes it will.

your going to need these assets when u want to be able to perform a clearing or resetting of the data.

its up to u to fill your data how ever u want.

focus on filling the data with zeros to start with or a start number that represents your null space in your map data.

after this u need to address how your going to fil the data.
Are u going to make a mouse driven feature that allows the user to enter a number into a tile location or are u going to build the map from dynamic preprogrammed rules like if theres a grass tile then thats where trees could randomly be plotted.

going back to your first post have a look at the data statement command with the read command if u want to establish it that way,The principles I showed you are still applicable for features and problems you will encounter

data "0000123405540320100000"

Login to post a reply

Server time is: 2023-01-27 01:32:02
Your offset time is: 2023-01-27 01:32:02