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 really need help with what is probably just maths.....

Author
Message
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 22nd Aug 2003 00:47
Here is the entirety of my isometric tile engine:



You can find the 2 tile images here:

http://www.tinywars.dsl.pipex.com/images/tiles.zip

I need to write some code that will determine what tile is clicked. I then will replace the 'unselected' tile with the 'selected' tile image. I am finding it really hard to achieve. As you can see in my code in the MouseHandler() function, I added an IF MOUSECLICK() = 1...THEN statement but I can't figure out what to put in it!!!

Can anyone help me out at all as it's taken me the best part of a week to get this far!!

FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 22nd Aug 2003 14:22
Anyone able to help?

OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Aug 2003 14:29
One way would be to get the mouse X & Y positions and divide by the width and height of a tile (this assumes all tiles will be the same width and height).

From this you can get the X & Y position of the tile your interested in, and from that you can directly access an array/memeory and see what sort of tile your looking at.


spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 22nd Aug 2003 15:02
OK, here's my attempt and it works pretty well!

The programmer formerly known as sonic
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 23rd Aug 2003 00:44
Thanks spooky....that is excellent, a great help. I just need to try to figure it out now!!!!

I may be back to ask more questions

spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 23rd Aug 2003 00:50
Admittedly it is not the fastest way of doing things but at least it works!

There probably is a way to do it properly with some clever maths but my feeble brain can't see the answer yet.

The programmer formerly known as sonic

Login to post a reply

Server time is: 2026-07-23 15:49:26
Your offset time is: 2026-07-23 15:49:26