playMaker

Author Topic: Flipping A Sprite (Custom Action) [SOLVED]  (Read 2982 times)

Wledig

  • Playmaker Newbie
  • *
  • Posts: 7
Flipping A Sprite (Custom Action) [SOLVED]
« on: February 08, 2014, 07:05:29 AM »
Hi! I'm not going to ask you to help me create a Custom Action because I've already done it...

I "created" this Custom Action:



While I was playing around with the Physics 2D actions and watching this video at the same time, I got amazed by his way of handling "flipping".

So I decided to have a look at how I could make a Custom Action. I "studied" a few of them and started coding it.

The thing is that I "copied" Mike Geig's way of doing it. I understood every part of it, but I did not invent it. So my question is: can I share the code with you even if I'm not the "author" of this function? I also copied PlayMaker's "structure" to make Actions, but I guess that's ok 'cause otherwise I wouldn't have been able to make a Custom Action in the first place...

Sorry if this question is stupid but I don't want to steal anybody's code but as I'm kind of new to C#, I need to see how other people do it to try and integrate it into my code.

I'm probably overthinking about it, I dunno.
« Last Edit: February 10, 2014, 06:40:28 AM by Wledig »

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Flipping A Sprite (Custom Action)
« Reply #1 on: February 08, 2014, 10:58:22 PM »
Gonna have to check with the admin,

but if you ask me, to adopt a method from a function that someone else created is fine, we are all in a way learn logics and coding from someone else...

So I think if you want to share it, go ahead, cause I'm sure it is going to be useful for some or a lot people out there...and maybe just put credit for using mike geig method...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Flipping A Sprite (Custom Action)
« Reply #2 on: February 10, 2014, 03:49:49 AM »
Hi,

 Of course!! please share back everything you can!! referencing the source is of course good and preffered, and you seem to be willing to do so, so by all means you are doing everything the right way :)

bye,

 Jean

Wledig

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Flipping A Sprite (Custom Action)
« Reply #3 on: February 10, 2014, 05:38:37 AM »
Marvelous, thanks for your answers guys.  :D
I'll definitely share it then, once it's slightly more polished (not that it's very complicated, but I'm a perfectionist). I've also made a custom action from the video to check if the sprite is "grounded".

So I'm asking myself another question (Not worth opening a new thread): isn't it overkill to create all these custom actions when I could just script everything together and link the script to an FSM? But then I think "yeah but what if you just need the "grounded" action and not the "flipping" one?

Is there a big impact on performance upon creating new custom actions for "small actions"? Like having several little actions instead of a big one that would gather the grounded action and the flipping one?

PlayMaker's flexibility amazes me but then I think about performance...
« Last Edit: February 10, 2014, 05:41:41 AM by Wledig »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Flipping A Sprite (Custom Action)
« Reply #4 on: February 10, 2014, 06:34:14 AM »
Hi,

I would go for a granular approach to prone reusability and flexibility. your question could be challenging for any api, with our without PlayMaker in the mix. Unity could do some internal scripting to allow for more complex behavior for a single api call, that would be more performant, but less reusable and therefore less used.

What I experience on that front is that performance should be very carefully watched for texturesm shaders, meshes and other critical aspect of the rendering pipeline. The amount of projects or issues that boils down to bad scripting strategy is very low and rare actually...

 Also, as a rule of thumb, I always design first and then optimize, so go for a granular approach, if down the line you profile your game and see clearly a bottle neck in that areay, combine both actions into one. But 99.9999% this will never happen...


Bye,

 Jean

Wledig

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Flipping A Sprite (Custom Action)
« Reply #5 on: February 10, 2014, 06:39:54 AM »
Thank you for your quick answer, I'll go for that approach. ;)