Where every number stands for a different type of terrain (not hardcoded, of course).
Now, my question is: Given a paoint X(x/y) on the map (a mouse coordinate, to be precise), how can I check which tile I am in?
Since it's not standard rectacular, a normal division by height and width won't work, so my attempt was to first do the normal division to know where about i am, seperate the most likely tile into four triangles, use the formula y=kx+d for linear functions and get the max for my y coordinate this way...
Unfortunately, that's too slow...
Any ideas on how to do it?
Last edited by Electroman; Nov 14th, 2004 at 05:37 PM.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by nareth noteme he sayd NOT a rectangular so that is wrong.. lemme find a tutorial for you.
Well if it's not recrangular (implied by the array) then how are we to know what would be correct (considering that we don't know the actual shape)??
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by NoteMe That was not NoteMe.......SLH has hijacked my avatar..
Mwhahahaha!!
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by nareth isometric he mentioned it in the title
Ah.
Surely he can just pretty much use the code he's already got to display the matrix on the screen, just 'reverse' the formula...
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
To convert between rectangular and isometric coordinates you just need to do a matrix transformation, you multiply the coordinate with a matrix of which columns are the vectors of how many times each step on rectangular will translate to isometric
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
here's the basic idea behind isometric projection, you multiply the vector from right with a transformation matrix with the rectangular coordinates to get the isometric coordinates.
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by kedaman hahaha @SLH, nice puppet bashing
Credit where credit's due. It was Electroman that did the avatar.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Posted by SLH Credit where credit's due. It was Electroman that did the avatar.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Nice one Electroman btw whats that av in yours suppose to be doing
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posted by kedaman Nice one Electroman btw whats that av in yours suppose to be doing
Opps I missed the second half of your post some how......Its SLH's old avatar (the one with the smilie jumping out the toilet) but I turned it upside down and added water falling out the toilet .
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.