playMaker

Author Topic: Requiring button/key press and trigger stay 2d for 3 seconds  (Read 111 times)

stanimal

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Requiring button/key press and trigger stay 2d for 3 seconds
« on: April 07, 2021, 07:08:46 AM »
I'm trying to accomplish the following and keep falling short. Anyone have any suggestions on what the best approach to accomplishing what i've described below?

- I have 2 players in the game, each with a different character prefab.
- Each player competes to dig as many holes as possible.
- Holes are prefab game objects scattered throughout the scene with an FSM that reacts to each player differently.
- In order to dig a hole I'd like to require the player 1. trigger stay 2. press the Interact button and hold it for a specified wait period (3 seconds for example).
- Player can choose to let go of button or leave position to cancel the digging
- If other player or npc bumps player the digging task stops and restarts.
- Depending on which player digs the hole the sprite color and other variables (points) will be set. (don't worry at least i know how to set sprite...)

How can I require both the trigger and button press hold of a specific player?

Background:
I am using Corgi 2d (which offers no support for Playmaker but seems to play nice enough together with Playmaker.

I have ecosystem browser and plenty of common actions, but no coding or program experience.

Newb here... so go easy on me if this is obvious. I'd share what i've tried but i am falling asleep at the keyboard... hopefully i've described thing well enough that someone can steer me in the right directions.

Weak Interactive

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Re: Requiring button/key press and trigger stay 2d for 3 seconds
« Reply #1 on: April 08, 2021, 03:13:00 AM »
You have two questions; the first is how to accomplish your game, but that's not really something anyone can answer in a forum post haha. I'll try to provide some info on your second question "How can I require both the trigger and button press hold of a specific player?"

Differentiating players shouldn't be too difficult with Playmaker; not sure about Corgi though. Using "Collision2D Event" or "Trigger2D Event" actions, store the collider to get the player object that triggered the collision as a game object variable, then get the tag of that player with "Get Tag" to differentiate between Players 1 and 2. You can then use a "String Compare" action to send an event based on which tag you got. Then it's just a matter of telling the player what you want them to do.

That is a very simple way of differentiating players, but there are loads of ways you could go about it. As I said earlier, it's not really possible to explain how to accomplish your entire game here, but if you have more specific questions, I'm sure there are plenty of people around that would be happy to help.

Have a good one, and good luck with your project.
« Last Edit: April 08, 2021, 11:34:02 AM by Weak Interactive »

stanimal

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Requiring button/key press and trigger stay 2d for 3 seconds
« Reply #2 on: April 09, 2021, 07:38:36 PM »
Thanks for your help. Your advice to tag player 1 and player 2 seems like I should have figured that out and other than that i was pretty close already.

As far as the request for complete I was just trying to provide context in case it helped folks understand what i was going for. It's hard as a very inexperienced hobbyist to know exactly how to describe and ask for help. I should have made a more clear ask and then provided the context in case someone needed it.

Thanks again for taking the time to respond.

Weak Interactive

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Re: Requiring button/key press and trigger stay 2d for 3 seconds
« Reply #3 on: April 09, 2021, 09:49:44 PM »
Hey, glad of I could be of some help.

Context can be helpful, and it's always interesting to see hear what people are working on, so sorry if it sounded like I was criticizing you for that.

Also, if you still have unanswered questions, don't let my wall of text response stop you from asking them; there are people a lot more experienced than me lurking around haha.