playMaker

Author Topic: 2d toolkit custom actions: Some minor changes.  (Read 1737 times)

fimmfingur

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
2d toolkit custom actions: Some minor changes.
« on: October 24, 2012, 06:09:53 PM »
Hi guys,
I just recently started using Unity and I just bought Playmaker. And I love it.

I have been playing around with Playmaker and 2D Toolkit to make just a small prototype game for fun (nothing interesting at all) and I found out that the actions I wanted were not included and I didn't find them by searching. So I made some new ones (Not really, I just made a few changes to some older scripts and gave them a new name(I don't take any credit for doing this))

I understand if some of you think it's silly off me to put this up here because the changes that I made to these already great actions are so minor that a lot of you have probably already done this. But I'm guessing there are some people that might be in need off this that don't have any understanding of code. For those, here you go.

The first Action is just a change to the Get Axis Action that comes with Playmaker. My character kept sliding a little when I used Get Axis and I wanted to use GetAxisRaw instead of GetKeyDown so that the user can use either the Arrow Keys or WASD.  

The second Action I made changes to was AxisEvent. Once Again I just did a minor change and added the RAW. I'm using the AxisRawEvent for my 2D Toolkit animations. With the AxisEvent my character kept playing the animation just a little longer than I wanted. The AxisRawEvent plays them perfectly.

That last one is for 2DToolkit and I got the original files from
https://hutonggames.fogbugz.com/default.asp?W717
All i did was change the PlayAnimation action so that I didn't to add a StopAnimation before every play animation.

I'm fairly new to these kind of things and any criticism is accepted.
 
« Last Edit: October 25, 2012, 10:17:10 PM by jeanfabre »

fimmfingur

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Some minor changes.
« Reply #1 on: October 25, 2012, 04:19:37 AM »
Just made a new one. This is for the 2D ToolKit FlipX() function. I'm sure most of you already have a better solution, but I didn't find one on this forum so I just made my own.

I posted a picture about how to use it.

1) First I set a variable
2) I named mine Flip because that's the only function it will be used for.
3) I set the value of the int to 0. 0 being the "original" flip direction. on this animation, its left.
4) My states look like this.
5) My right states has these action.
6) First i selected the variable the action has to check
7) Here is a basic If statement and IF the flip variable is 0 (which is left for me) it does the .FlipX() to flip the animation.
8) If the character was flipped, the action sets the flip variable to 1 (1 being right for me)
9) Next is the left side
10) Flip variable is selected like before
11) and in this if the flip var is set to 1 the action will make the animation flip to the other side
12) And now if the animation was flipped the action will set the Flip var to 0 again.

This works like a charm for me. And hopefully someone else is looking for something like this :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: 2d toolkit custom actions: Some minor changes.
« Reply #2 on: October 25, 2012, 10:18:56 PM »
Hi Fimmfingur,

This is all very positive! thanks for your input, I have modified your thread title so that users can find this.

Bye,

 Jean


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: 2d toolkit custom actions: Some minor changes.
« Reply #3 on: October 25, 2012, 10:22:11 PM »
one more thing.

 I would make separate separated threads for each of your actions, so that it's easier to find, here people will likely miss your very useful axisRawEvent action for example. Simply post each custom action you want to share in this  section:

http://hutonggames.com/playmakerforum/index.php?board=19.0

bye,

 Jean

fimmfingur

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: 2d toolkit custom actions: Some minor changes.
« Reply #4 on: October 26, 2012, 03:23:18 AM »
Thank you for the positive feedback Jeanfabre.
The actions are now in separate threads :)