Mouse hotspot not working

Started by JpSoft, Wed 11/06/2008 16:40:29

Previous topic - Next topic

JpSoft

Checking the pixel-perfect detection for the eye-bird module, i found something already was there but i was not able to detect.

My game uses only 2 cursor modes: i changed the first one (usually walk to) to pointer and the second to attack. Everything works fine until now and i dont detect troubles since the script is defined to only cycle between this two modes. Both cursor sprites are 16x16 pixels and had the hotspot at 0,0 position.

Now, checking carefully where the cursor is clicking i found that the click is not in the top-left corner of the cursor; it makes click around pixel 3,3, and not 0,0 as i defined in the settings of the cursor mode. I tried changing it to 1,1 or even 8,8, but it ALWAYS makes click at 3,3 position. It works terrible for vertical sliders and even for small buttons.

Well, another project we are creating is a remake of SQ1, point and click and with digital audio. Im not working on this, but i contacted my friend to know how he fixed this trouble, but he also have the same trouble: the cursor makes click 2-3 pixels down and to the right than the settings for the cursor mode. (my game and this one are developed under AGS 3.0.)

Finally, i checked paul quest (created using AGS 2.72) and here the cursor looks like is working fine, but im not very sure since the source code of the game  is 8000 kms from me and im not absolutely sure i set the cursor hotspot to 0,0..

Is this a bug? Im missing something?

Any help is appreciated.

Jp

JpSoft

#1
Looking carefully at the mouse click, i checked that it works ALWAYS properly when click on objects, characters and hotspots, but some troubles become when click in some GUIs. Maybe its something about alpha channels? Anyone hear something about this in the past? I checked the forums but looks like I'm the first one with this issue.

The only thing i have clear until now is: if the GUI have a backgroundgraphic with alpha channel or with a single transparency, mouse click dont work properly, but if it is completely solid the mouse cursor works perfect.

Jp

EDIT I forgot to mention that if i change the alpha channeled image of the gui background for a solid one, then the click works perfect. Looks like itonly works bad when there are transparencys-translucencys ::)

JpSoft

Ok, i solved it, so i post here if anyone else have this same trouble.

First, as i said in the first post, my game only uses 2 cursor modes: mode 0 (usually Walk to, but i renamed it to Puntero) and mode 1 (usually Look at, but i renamed it to Atacar). Since eModeAtacar is only available during the game (where i dont have troubles) i will explain the issue with mode 0.

First at all, there is nothing with transparencys; Mode 0 works bad in some rooms and ok in others, ALWAYS with GUI controls, even with the same GUI showed in different rooms. Diference between this rooms? Only one: The cursor works OK in scrolling rooms, but wrong in the ones which not (yes, that is absolutely sure, dont ask me why  ???). There is another difference, but im not sure this is an absolute true: scrolling rooms have always number 100+, but i dont test with a scrolling room with a lower number (since my game dont have one)

I tried everything with the configuration of the mode 0; standardmode true or false, hotspot 0,0 or even out of the image borders, but it always make click at 2,2 position. Finally, i decide try another way and i created a new cursor mode: BINGO.

I taked eModePointer (since is the one AGS shows in some cases by default), changed it to be identical to eModePuntero (the only diferences are the number and the name) and it works perfect ALWAYS. Both modes uses the same sprite, with hotspot set to 0,0, standardmode=false.I even included a button to switch between this 2 modes at run time and you can see how the mouse-image moves when you click the button.

I believe this is an AGS bug (maybe its not a good idea rename the default cursor modes). As for me, i just changed all the code to use eModePointer replacing eModePuntero (which will remain unusefull)

Jp

SMF spam blocked by CleanTalk