YesNoOk
avatar

FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers) (Read 25479 times)

Started by Ricepigeon, September 29, 2015, 04:39:09 pm
Share this topic:
FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#1  September 29, 2015, 04:39:09 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
FrontEdgeDist gives the distance between the x-axis of the player and the edge of the screen in front of the player. FrontEdgeBodyDist gives the distance between the front of the player (as determined by the front edge of his width bar) and the edge of the screen. BackEdgeDist gives the distance between the x-axis of the player and the edge of the screen behind of the player. BackEdgeBodyDist gives the distance from the back of the player, as determined by the end of his width bar, to the back edge of the screen.

Format:
    1.) FrontEdgeDist
    2.) FrontEdgeBodyDist
    3.) BackEdgeDist
    4.) BackEdgeBodyDist
Arguments:
    none
Return type:
    float
Error conditions:
    none

Examples:
Code:
;Triggers if the x-axis of the player is within 30 pixels of the edge of the screen in front of him.
trigger1 = FrontEdgeDist < 30

;Triggers if the front of the player is within 30 pixels of the edge of the screen in front of him.
trigger1 = FrontEdgeBodyDist < 30

;Triggers if the x-axis of the player is within 30 pixels of the edge of the screen in back of him.
trigger1 = BackEdgeDist < 30

;Triggers if the back of the player’s width bar is within 30 pixels of the edge of the screen in back of him.
trigger1 = BackEdgeBodyDist < 30

Additional Notes:
Since most characters front and back will be nonzero values, using FrontEdgeDist and BackEdgeDist are not adequate methods of determining if the player is in the corner of the screen. If a player is allowed to go offscreen, such as a helper or a player using a ScreenBound SCTRL, there can be instances where the front or back of the player will offscreen, causing FrontEdgeBodyDist and BackEdgeBodyDist to return negative values, but their X-axis can still be onscreen, causing FrontEdgeDist and BackEdgeDist to return positive values. Note that using a Width SCTRL can affect the results of FrontEdgeBodyDist and BackEgdeBodyDist, but never FrontEdgeDist or BackEdgeDist.
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#2  September 29, 2015, 06:49:00 pm
  • ******
    • www.justnopoint.com/
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#3  June 14, 2016, 02:50:48 pm
  • ***
Is there a way to use de edge distance of p2?
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#4  June 14, 2016, 02:57:37 pm
  • ******
Yeah, use a enemy redirect (enemy,FrontEdgeDist).

Target redirect works too, not sure which is better.
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#5  June 14, 2016, 03:37:53 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
enemy,FrontEdgeDist and enemynear,FrontEdgeDist will return the distance of the enemy, no matter if he's been hit or not

target,FrontEdgeDist will return the distance of the enemy being hit. When the enemy is no longer in a hit state, it will not trigger, and return bottom

XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#6  June 14, 2016, 03:53:19 pm
  • ***
Thanks guys!
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#7  June 28, 2016, 08:48:36 am
  • avatar
  • *
    • Argentina
    • el.wrang@gmail.com
I was wondering if there was a way to get the end of the actual stage rather the screen, I searched, but apparently there is no such a trigger, maybe some
workround?
because sometimes you would like to make the character able to bounce from the wall, but only at the real end of the stage, and not a virtual nonexistant wall defined by the screen
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#8  June 30, 2016, 07:30:55 pm
  • *****
  • Shame on you!
    • USA
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: July 01, 2016, 10:05:27 pm by Odb718
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#9  April 25, 2017, 08:19:23 pm
  • *
    • Ireland
Can I use this trigger for helpers? I run into a little trouble while coding my helper. I want him to disappear as soon as he reaches the end of the stage, but it would turn out that he gets stuck on it instead. :l Can somebody help me please?
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#10  April 25, 2017, 09:38:54 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
Can I use this trigger for helpers? I run into a little trouble while coding my helper. I want him to disappear as soon as he reaches the end of the stage, but it would turn out that he gets stuck on it instead. :l Can somebody help me please?

Did you check to make sure that any Screenbound controllers are disabled? Would cause the problem you're describing.
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#11  April 26, 2017, 07:21:54 am
  • *
    • Ireland
Are you talking about the stages? Well yes I have, I have set the screen bound from 1000 to 10,000 but still my helper gets stuck when the move misses.

Well the move goes like this, my character commands a 'helper' to rush forward towards the opponent. If he catches him/her, he would hold him in place for a short duration of time. L/M/H versions differ. Needless to say, if the opponent dodges or blocks the helper's initial attack, the helper would come back to me. However, if the opponent manages to DODGE only the HEAVY VERSION of the move, my helper gets stuck at the end of the stage. L and M versions work just fine :l I wonder what I did wrong?
Re: FrontEdgeDist, FrontEdgeBodyDist, BackEdgeDist, & BackEdgeBodyDist (Triggers)
#12  June 07, 2019, 11:34:51 am
  • avatar
  • *
    • Ukraine
Might not be helpful to AensleigheR, but maybe will be to someone else.
Are you talking about the stages? Well yes I have, I have set the screen bound from 1000 to 10,000 but still my helper gets stuck when the move misses.
You want to put a ScreenBound state controller in your helper's state, which will allow it to actually go off screen. The simplest example of such SCTRL would look like this:
Code:
[State whatever]
type = ScreenBound
trigger1 = 1; active always while the helper is in this state
value = 0; allow going off screen
Then you can use DestroySelf on the helper when it's well off the screen. You should know its approximate size in pixels and the direction you have it move in (most likely, forward). Say, it's 100 pixels wide and moves forward. In this case, when its FrontEdgeDist reaches -50, it's entirely off the screen: -EdgeDist triggers take the difference between your character's X axis and the corresponding edge rather than your character's edge and the stage edge. Multiply this by 1.5 just to make sure and you have this:
Code:
[State whatever]
type = DestroySelf
triggerall = ishelper; it's good practice to perform this check.
; If you accidentally put this SCTRL into a non-helper state or
; if your helper shares states with the character themself, you
; won't get the "DestroySelf called for non-helper" message.
trigger1 = frontedgedist < -75; adjust as necessary
If your helper is moving backwards instead of forward, you do the same, but use BackEdgeDist instead of FrontEdgeDist. -Dist triggers are more reliable than -BodyDist ones in case you have to go beyond the screen boundaries because they don't depend on the width and height of your character.