![]() |
onImage(filename,x,y)
Returns true if the point you specified is on the image and false if it falls on one of the transparent regions. I guess there are multiple this could be implemented:
1) The coordinates are given relative to the top-left corner of the image so the image doesn't need to be shown to be checked. 2) Instead of 'filename', the function takes image index (as used in showimg) and subsequently interprets the x and y as level or screen coordinates (depending on the draw layer of the given image). Good for inventory systems - I can check if the player clicked on the apple rather than just checking against its bounding box. It opens up a few possibilities (systems like Ultima's, for example) and refines others. Let me know if the description wasn't clear enough. |
I like the idea. I could see it being very usefull.
Maybe even something that returns the ID or filename of the image the mouse is on would be even better? |
Quote:
|
Re: onImage(filename,x,y)
Quote:
|
It could be used for collision detection for other things too.
|
Re: Re: onImage(filename,x,y)
Quote:
|
good idea, making ranges is a pain -_-
|
Quote:
|
I was thinking while in the shower....
Wouldn't testimg(x,y) be not only more constant to the graal scripting language, but more practical? It would return the index of the image located at the given x and y position and you could test if it was true. edit: Sorry for double post :\ |
Quote:
|
Both testimg and isonimg would be good I think. The function isonimg would be more efficient if you want to only check a few things and don't want to care about overlapping images.
The functions testimg, testnpc etc. should be changed to give the index of the first object found, and also fill an array with the indexes of all objects found on the given position, sorted by the drawing order. (since the variables can be normal variables and arrays at the same time it might be useful, and it would be compatible with old scripts). |
Quote:
|
Stefan: I was wondering if you are going to implement this feature anytime soon. If you are I will wait to do this project I am ready to start on that with these new functions would make it a lot easier.
|
| All times are GMT +2. The time now is 10:35 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.