playMaker

Author Topic: Making an "Inspect Button"? [SOLVED]  (Read 2380 times)

BrownieEvie

  • Playmaker Newbie
  • *
  • Posts: 4
Making an "Inspect Button"? [SOLVED]
« on: November 29, 2018, 04:39:38 PM »
Every day for a couple of hours after school I work on a little game project that I have, but for the past couple of days I've been stuck on making one of those things that floats above an object or NPC to show you can talk to them or there is something interesting about that object

Like how in Hollow Knight there is an arrow with "Inspect" floating above things, or how in Night In The Woods an eye icon appears over things Mae talks about

What I'm thinking is a trigger box, and when the player enters the icon zooms in (one animation) and then plays a basic animation (other animation) but when the player leaves the box, no animation is played and the icon is not visible

I nearly got it to work once when only one animation played after the player entered the trigger box, but I haven't gotten further than that. I've tried a couple of different state machines generally with the actions "play animation", "visibility" and "OnTrigger2D"

Any help is greatly appreciated, thank you in advance :D
« Last Edit: December 02, 2018, 01:33:48 AM by BrownieEvie »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Making an "Inspect Button"?
« Reply #1 on: November 30, 2018, 02:18:05 AM »
1. You can put on trigger enter, play the animation, then enter the state that waits for trigger exit.
2. You can put get distance, when player enters the defined threshold, play the animation, then enter the state that wait for distance to go above the defined threshold.
Available for Playmaker work

BrownieEvie

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Making an "Inspect Button"?
« Reply #2 on: November 30, 2018, 06:37:11 AM »
1. You can put on trigger enter, play the animation, then enter the state that waits for trigger exit.
2. You can put get distance, when player enters the defined threshold, play the animation, then enter the state that wait for distance to go above the defined threshold.

thank you for your answer :D
I tried the first one, but it doesn't seem to be working, it stays on the first state and says the animation's missing? Here's what it looks like, I've probably done something wrong lol

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Making an "Inspect Button"?
« Reply #3 on: November 30, 2018, 09:33:24 AM »
Don't use play animation, it's legacy and it doesn't work properly.

1. Put an animator component into the object you want to play the animation, in your case owner.
2. Drop the animation clip into the animator, set ins and outs as you wish.
3. Use "animator play" instead of "play animation". Use the animation clip you dropped as a name.

Try it out.
Available for Playmaker work

BrownieEvie

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Making an "Inspect Button"?
« Reply #4 on: December 01, 2018, 02:07:53 AM »
Don't use play animation, it's legacy and it doesn't work properly.

1. Put an animator component into the object you want to play the animation, in your case owner.
2. Drop the animation clip into the animator, set ins and outs as you wish.
3. Use "animator play" instead of "play animation". Use the animation clip you dropped as a name.

Try it out.

It sorted out the animation being "missing", thank you :D
but it is stuck on the first state and even if the player hasn't triggered it, the animation plays.
The "don't play" state I have just has a on trigger exit, did I need to put something else there? Or did I need to put something for Normalised time? (I didn't know what that was and I couldn't find what it meant so I just left it)