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 / Texture Single Matrix Tile

Author
Message
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 31st Dec 2003 00:12
i'm really REALLY bad at matricies, so bear with me...PLEASE.

i have tilex and tilez = the tile positions of object 1 ("mouse" pointer of sorts) and i want it so it will texture the tile that you are in with image 1 when you click the mouse. how do i do that?
i have tried:


again, im really bad with matricies...

Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 31st Dec 2003 02:42
I'm making a matrix editor, DarkWorld Editor, and I've had some problems like this one

The basics are simple

The mouse should be in the matrix and you should change the tile, example (the texture-numbers are saved in a array, so I could save them in a MVS file):




Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 31st Dec 2003 03:30
sorry, im an idiot, but i dont quite understand what you are doing...and obj1 in my code, is the mouse pointer, so:


if that help you explain what i need to do
what i need it to do is:
if you click on a tile, texture that tile with image 1.
and as i stated above i REALLY suck with Matricies, i dont understand anything with them other than make matrix 1 and position matrix 1.
thanks

Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 31st Dec 2003 03:39 Edited at: 31st Dec 2003 03:42
their should be nothing wrong with your code, try this:




Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 31st Dec 2003 04:24
dont i have to prepare matrix or somthing like that?

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 31st Dec 2003 04:49
Indeed you do, you need to use the Prepare Matrix Texture command to get the image as a matrix texture, otherwise, when you try to use it as a texture, it won't recognise it.

An in your code, you don't really need all that. Try:


Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 31st Dec 2003 05:22 Edited at: 31st Dec 2003 05:41
Quote: "you need to use the Prepare Matrix Texture command to get the image as a matrix texture"


how?

okey, what i did was (ouside of loop)

for b = 1 to 18
prepare matrix texture 1, 18, 1, 1
next b

and what it did was just texture the matrix with image 17

now i put prepare matrix texture 1, 1, 1, 1 inside of that last code you gave me JT and when i click on the matrix, the whole thing is filled with image 1

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 31st Dec 2003 05:42
and heres how i make the matrix

xsize# and ysize# are numbers from user input

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 31st Dec 2003 07:21
Quote: " i want it so it will texture the tile that you are in with image 1 when you click the mouse."

Quote: "now i put prepare matrix texture 1, 1, 1, 1 inside of that last code you gave me JT and when i click on the matrix, the whole thing is filled with image 1"


So, we're getting close then...

For the Prepare Matirx Texture command, what you need to do is first load an image into DB, then, use that image number as the image flage for the Prepare Matrix Texture command.

In that loaded image, you should have all your matrix textures. ie;


But, you can have alot more than 4 textures in the one image... you just have to make sure they're all in a grid.

Then when you use Prepare Matrix Texture, say that the above grid makes up image 1, that would mean you would use

Prepare Matrix Texture 1,1,2,2

The first "1" being the matrix number, the second "1" being the image number and the following "2's" being how many tiles across and down you have in the image itself.

Thus, you have effectively divided the Image 1 into 4 texture tiles.

Therefore, when using Set Matrix Tile, you need to use the tile number to specify what tile you will use to texture that tile.

Set Matrix Tile 1,tilex,tilez,1

In this, the first "1" is the matrix number, the "tilex" is which tile on the x-axis of the matrix will be textured, and the same for the "tilez", finally, the last "1" is the texture tile you wish to use. And in this case, I have used tile 1, which, in the above grid of the imgage 1, is Texture 1 ( ie, the upper-left texture ).

Therefore, the code you need would be somwthign along the lines of:


And Voila, that should texture the clicked tile.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 1st Jan 2004 22:13
awsome!
Quote: "In that loaded image, you should have all your matrix textures."

Dang it! when i first started, i took all the images out of the same image...oh well, thats easy to change

JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 2nd Jan 2004 00:28
ALRIGHT!! it works now! thanx JT

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 2nd Jan 2004 05:02
K, glad to have helped...

Btw, what's this for? a level editor of sorts?


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 2nd Jan 2004 08:41
yeah, look in the WIP section, i just posted a VERY early stage download (if the link worked, posted it in a hurry). it's going to be something really small...really to teach me more, im going to use it for my game i am currently planning on paper.

Login to post a reply

Server time is: 2025-06-07 02:46:45
Your offset time is: 2025-06-07 02:46:45