Hotspot behavior

Darkhog

  • Posts: 1243

Darkhog presents...

The Hotspot behavior!

What hotspot is?

If you know what hotspot is, jump to next section. If you used earlier The Games Factory/MultiMedia Fusion, you probab ly know what hotspot is.
Hotspot is a point on the object (actor) from what the position is shown.
In Stencyl the position of "system" hotspot is 0,0 (related to actor space, so 0,0 (in pixels) of first frame of animation is hotspot).

This behavior is created to allow to define different hotspots for different animations (one hotspot per animation).

Of course you could add values to x/y of Actor (which is position of Actor's hotspot which is 0,0 related to actor image) to get similar result, but this is easier.

How to use this behavior?

Well, after attaching to actor and configuring (Help and list's format are in field descriptions, anyway I'll giveout list format again: animation name,xofhotspot,yofhotspot. Animation name mustn't contain ","). you have access to several local custom blocks:

Now we should explain them.

These are pretty ordinary blocks which return Number with x/y of actor. These add necessary offset to builtin x/y getters to include hotspot position. So basically the formula is actor position (x OR y) + hotspot position for current animation.


These blocks sets X/Y of actor with hotspot applied. So if, for example hotspot is 10px far from left of actor's animation's image and 10px from top, these blocks will set position of this point as is would be 0,0 of image (Stencyl's built-in hotspot).

What is purpose of it?
Shmups, shooters and other kinds of games where creating actors on specific position is needed (for example on tip of your gun). Now you can have different animations for different types of weapons and you'll know where to create bullet when specific animation is playing for actor. Don't know how setters would be usable, but made it anyway figuring out, that someone may need them.

Limitations?
Yes. You can't use these blocks from other actors (but it may be omitted by messaging system). So if you have actors named "a" and "b" you can't check hotspot position of actor "a" from behavior attached to actor "b" without using messages. The only other solution (except messages) I can think of is built-in hotspot support which hopefully will came soon to Stencyl.

//edit: After reconsidering I think Actor Values and Game Attributes may also help with getting hotspotted position of actor "a" from actor "b".

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Darkhog

  • Posts: 1243
I have one tiny question: Why it isn't on Featured yet, despite the fact that this is more useful than e.g. Always Simulate behavior which can be replaced by using ONE block in when created of any behavior? And Always Simulate is in featured.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Rhys

  • Posts: 1046
I have one tiny question: Why it isn't on Featured yet, despite the fact that this is more useful than e.g. Always Simulate behavior which can be replaced by using ONE block in when created of any behavior? And Always Simulate is in featured.
So modest.

Jon

  • *
  • Posts: 17516
None of us have had time to patrol Forge this past week, especially after the fiasco with all the broken tilesets. We'll do another sweep of Forge when we have time. Hence why, nothing else has been featured, no headlines and an empty games section.

Hard data I have from the previous Forge suggests that the "less useful" behaviors you are making fun of are by far our most popular ones because they are genuinely useful and easy to understand.

Jon

  • *
  • Posts: 17516
Please reupload this as a Resource Pack or a solo behavior. It doesn't make sense as an Actor, and it won't be found that way. I couldn't even find it at first until I did a direct search.

Also, use a color for the icon that is not the saturated blue. It's hard to make out against the background of SW.

Darkhog

  • Posts: 1243
It is solo behavior. It's just Actor behavior. Also icon is fine to me. Shouldn't look out of place. In attachment there is little mock-up how it'd look like in Forge.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Alexin

  • *
  • Posts: 3132
Your mock-up is a perfect example: see how the blue arrows look much better against the background? Using pure or saturated colors rarely looks good.
"Find the fun"
alexin@stencyl.com