[VN] Hotspot Overlays


(Leslie Young) #1

This requires the BGS Visual Novel Engine since the overlay images are defined in there.

Create overlay images like you would normally but for this case you need to add a collider, like Component > Physisc2D > BolxCollider2D and Component > BGS > 2D > Click Sprite to the prefab.

The setup for the sprite is exactly same as shown in the video linked above. But in this case you do not really need the sprite to be visible, except if you do. But if you only want a “click area” then create a transparent image of the size you need and setup the prefab as per video. You can also set the sprite’s alpha colour to 0 so it is not visible. It is up to you what you need here.

The import additions are the collider and click sprite components. IN my example I have a door the player can click on. I created a transparent sprite with same size as the door.

The click sprite needs to know what object has a main graph to make a call to. In this case it is the VNEngine component which I placed on an object named MainController. I then tell it what the graph is to execute and the name of a label in that graph. See the image of graph below to see why I use those names. Note that the names must be exactly same as what you use in the graph editor (case sensitive).

The FlowGraph for this is real simple. I show the background scene as normal and then place the overlay image object and exit the graph. When the player clicks on where the sprite is it will call back into the VNEngine to execute graph and continue on a label node with specific name. This gives me opportunity to remove the sprite object, since this is not automatically done, before going on to another graph. Of course I could just continue flow in the same graph from the label. Everything here has been covered in the tutorial videos so I will not go into details.

overlay-01


BGS updates
Hotspot overlay in bgs?