is there a median block if not how would I create one?

Shadowblitz16

  • Posts: 44
is there a median block if not how would I create one?
I do know how to use custom blocks now but I don't know the math or equations behind it

SadiQ

  • Posts: 1795
What is it used for? The terminology is different in stencyl so it may be called something else.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

letmethink

  • *
  • Posts: 2545
I don't believe there is (if you are talking about the middle of a list of numbers). A quick look shows that Haxe doesn't have that function built in (from what I can see), but you can sort the list (temporarily) and then pick the number at the middle of the list.

Try importing in this behaviour I just wrote and seeing if it works the way you want it to (it includes a global custom block). The file is a png but contains a behaviour - just import it and see.
~Letmethink

Shadowblitz16

  • Posts: 44
your link is a png?

letmethink

  • *
  • Posts: 2545
Correct, reread my previous post
~Letmethink


letmethink

  • *
  • Posts: 2545
Just checking, does it work fine?
~Letmethink

Shadowblitz16

  • Posts: 44
I don't have a engine/game to test it with right now but...

I was wondering how to do something like median3 median4 median5... and so on
median3 being  the middle value of the 3 inputs(not lists)
and median5 being the middle value of the 5 inputs(not lists)

letmethink

  • *
  • Posts: 2545
It is easy just to add them to a list before comparing them.
~Letmethink