Custom "hitbox" for objects

Started by Sakspapir, Tue 11/04/2023 21:14:39

« previous - next »

Sakspapir

Hi guys,

I have created an object that is simply a loose thread from table cloth. This thread is only one pixel thick (the game is very low res) and its bending and turning.

In this game, the mouse changes to interact mode whenever it is hovering above an object, hotspot or character. Otherwise it changes to walkto mode.

The thing is that when the mouse is hovering above it, the mouse cursor needs to be exactly on top of one of the thread's pixels for the Interact-mode to be activated. This makes the UX pretty bad, because there is much flickering between walkto- and interact mouse cursors.

Is there a good way to solve this? Ive thought of the following:

1) Create a hotspot on top of the thread object (and make it rectangular) and then set the objects Clickable property to false. Then the mouse cursor would change according to the hotspot instead of the object.

2) Create the thread graphic with highly transparent pixels where there are no thread-pixels. I really don't like this idea, though.

What im really hoping for, is some smart way of customizing the "hitbox" of the object, instead of it being defined by its pixels. Does anyone know of a good way to solve this?

Thanks in advance!

Khris

Is other mobile stuff supposed to be able to appear behind this object? If not, just include pixels of the room background in the object's sprite.

Sakspapir

Thanks for the reply,

Yeah I could do that, I guess. It would just be a lot simpler if I could manually adjust the objects hitbox.

I have other objects with the same issue as well (although not as severe) and it would be relatively time consuming to add the extra room graphics.

Im currently using the previously mentioned hotspot-technique. It works fine, but it still feels a bit "dirty".

Crimson Wizard

I think what could work is another, thicker, object with Transparency set to 100.

According to AGS logic, Transparency does not affect interactivity, so even fully transparent objects will be clickable.

Sakspapir

ok, thanks!

That could work nicely I think. Creating an object oThread and then an oThreadHitbox that could be just a black rectangle with transparency set to 100.

Thanks a lot!

DBoyWheeler

Hmm, hitboxes might come in handy for Quest for Glory style games too.  Might have to consider this.

SMF spam blocked by CleanTalk