Calculating distance between you and mouse click

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
xboxown
001 Subscriber
 
Joined: Sun Jun 03, 2012 2:28 am

Calculating distance between you and mouse click

Postby xboxown » Wed May 25, 2016 10:52 pm

Hello,

I have the script down below:



The if statement works but the logic put is still need improvement. If I use cursor.xofz(0) and cursor.yofz(0) instead of itemxcoordinate and itemycoordinate I need to have the cursor at a certain position in order for it work even if the hero is right beside the item. That means if hero right next to the item and the cursor is selected at the furthest point of the item it treat it as far. Which is an issue. But it avoid the issue of having to drop an item behind a war or across the world. When itemxcoordinate and itemycoordinate is the x,y coordinate of the item (actor) and when I click it..it works 100%. I can click anywhere on the item it works. But when I pick the item and drop it...i can drop it behind walls, inside houses or anywhere else. So the question I want to use cursor.xofz(0) in order for it work 100% but I want it when I click any pixel of the item and the hero is right beside the item it does not treat the item as far. How do I fix that?

Thanks in advance.
Image
Check out my blog at http://gamemakermagazine.com

Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron