Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Clickable object help

A topic by Dan Campbell created Feb 14, 2021 Views: 145 Replies: 2
Viewing posts 1 to 2
Submitted

How would I go about having a clickable object in my scene that when clicked on would trigger the next state. For example:

My game is a text based pick your own path and say the player is fighting a robot... clicking on the head will kill the robot and take the player down a different to story path to say clicking on the robots hand. Clicking on the hand would generate a few more states with story until the robot is killed. 

Sorry if this is confusing I am trying to understand it myself haha. I already have a script that loads the next state if the player presses 1 or 2 on the keyboard. 

I don't know what Engine/Framework you're using, but normally you should get the X and Y position of the cursor whenever a click event is fired, and check if that overlaps with the current position of the robot's bodypart to execute the change of state

Submitted

Great I will try that out, many thanks!