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! / Clicking on a Sprite

Author
Message
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 17th Oct 2007 23:30
I'm trying to make a game where there's a map of the world and you can move units from one territory to another [key word in this sentence; trying]. To do this I need to know when the mouse is over a certain territory, i have exactly 75 territories. I think I'm fairly good at DarkBASIC, but I'm really having some difficulties with this one. Question 1: is there an easy way to do this that I simply overlooked? *optimism* Question 2: is there anyway to do this? Question 3: should I simply give up the project and try doing it in another language? Any help is uber appreciated. Thanks!

There are 10 types of people in this world. Those who know binary and those who don't.
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 17th Oct 2007 23:48
hmm, if you find a perfect pixel collision, you could make a sprite be were ever the mouse is, and then if it hits the terretory, have your actions...


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
MonoCoder
18
Years of Service
User Offline
Joined: 4th Dec 2005
Location: england
Posted: 18th Oct 2007 00:14
If this "territory" of yours is square, you can try checking for clicks in the area from the top-left to the bottom-right ( mx > x1, < x2; my > y1, < y2 ).

If you need to know more, you'll have to be much more descriptive.

EBA; UI; Mario Land Ripoff.
It's positively packed with awesome.
wildbill
18
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 19th Oct 2007 00:42
A simple but very effective way is to have a very nice map that people are seeing (screen 0). Then have hidden bitmap with all the countries colored. Then use the point command to find the colors that correspond to that countries color code.

You can make this routine much faster by putting the hidden bitmap into a memblock and finding it there.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 19th Oct 2007 22:41
A full explanation of what WildBill is saying by TDK

http://forum.thegamecreators.com/?m=forum_view&t=106004&b=10

http://jamesmason01.googlepages.com/index.htm

Login to post a reply

Server time is: 2024-05-18 12:17:53
Your offset time is: 2024-05-18 12:17:53