Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: Thore on June 05, 2019, 06:31:06 PM

Title: Bool Float Modifier
Post by: Thore on June 05, 2019, 06:31:06 PM
What it does
This action takes a float and multiplies it with one or the other factor depending on a bool variable.

Use Case
In 2D games, you often need to apply a positive force for one direction, and a negative force for the other direction, for example for moving projectiles or setting the velocity of the player. Right now, you'd have to use different states to check for direction, modify values to then apply the correct one. This action can do it in one simple action: you simply multiply e.g. your force or velocity float by 1 for the right direction and -1 for the left direction. The action might have other purposes, too.

Parameters

I guess nobody will find this action when needed, since it's a somewhat abstract solution, and it might already exist. Anyhow, in case someone wants it ;)

[edit: added parameter, clarified a bit]
Title: Re: Bool Float Modifier
Post by: jeanfabre on June 06, 2019, 08:44:27 AM
Hi,

 it's actually a nice action, I have put it on the ecosystem.

I made few adjustments:

- result is saved in a distinct variable, which means you can still override the float by pointing both the float and result to the same variable, but you are also now free to not do that, which helps in many cases
- fixed reset, if you had selected everyframe, it would not reset to the original value, but to the last set.
- fixed a typo


Usually, if you are a developer in need of something, there is a very high chance that you are not alone :) so it's always very healthy to spread your work, share  what you find useful. It's good karma at the very least :)

Bye,

 Jean
Title: Re: Bool Float Multiplier
Post by: Thore on June 06, 2019, 11:16:01 AM
Thanks, and good changes! :)