Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-26-2011, 06:20 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
1. onMouseDown: Determine the tile the mouse is currently over and use it as your top-left reference point.
2. onMouseDragged: Determine the tile the mouse is currently over and use it as your bottom-right reference point.
3. onMouseUp: Do whatever with your selection.

I believe:

tile_x = mouse_x - (mouse_x % tile_width);
tile_y = mouse_y - (mouse_y % tile_height);

Will get you the top-left x and y of the tile your mouse is currently over.

% is for modulus which basically gives you the remainder from dividing a number. I.e: 20 % 16 equals 4.
__________________
Quote:
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.