Jump to content

Photo

[2.55]


  • Please log in to reply
6 replies to this topic

#1 xenomicx

xenomicx

    Zelda Arcade

  • Members
  • Location:Chi-town

Posted 15 January 2020 - 05:28 PM

wYgx5sV.jpg

I'm trying to figure out the positioning, on how Link should be when he jumps under this block and hits the bottom of it. So far the block appears when Link jumps into the center of the tile.

if ( ( Abs(Hero->X - this->PosX()) < 8 ) && ( Abs(Hero->Y - this->PosY()) < 8 ))

The block also appears if Link falls from above.



#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 15 January 2020 - 05:38 PM

`Abs()` is an absolute value, used for raw distance. In this case, using it means you don't care if he comes from top or bottom, and left or right, for the y and x respectively.
Though, being an invisible block.... hmm, no, you want to check Jump
`if(Hero->Jump > 0)`, then he is moving upwards in sideview. `Hero->Jump < 0` indicates falling.
Also, might want a more detailed topic title than just the version you are using.
if(Hero->Jump > 0 && Abs(Hero->X - this->PosX()) < 8 && Hero->Y > (this->PosY() - 15) && (Hero->Y - Hero->Jump)  < (this->PosY() + 15))
{
//reveal block
}


#3 xenomicx

xenomicx

    Zelda Arcade

  • Members
  • Location:Chi-town

Posted 15 January 2020 - 05:38 PM

Could you write out the whole argument? I don't math so good LOL! If I write Hero->Jump>0 the block will appear anytime and anywhere the Hero jumps.

Spoiler

Edited by xenomicx, 15 January 2020 - 05:43 PM.


#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 15 January 2020 - 05:40 PM

if(Hero->Jump > 0 && Abs(Hero->X - this->PosX()) < 8 && Hero->Y > (this->PosY() - 15) && (Hero->Y - Hero->Jump)  < (this->PosY() + 15))
{
//reveal block
}


#5 xenomicx

xenomicx

    Zelda Arcade

  • Members
  • Location:Chi-town

Posted 15 January 2020 - 05:42 PM

Thanks...I meant to write out the topic more, but I was too busy trying to figure out how to add a photo I forgot LOL!!


Edited by xenomicx, 15 January 2020 - 05:42 PM.


#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 January 2020 - 09:46 AM

if ( (Hero->Jump > 0) && (Abs(Hero->X - this->PosX()) < 7) && (Hero->Y == this->PosY+16) )


#7 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 18 January 2020 - 02:18 PM

if ( (Hero->Jump > 0) && (Abs(Hero->X - this->PosX()) < 7) && (Hero->Y == this->PosY+16) )

This doesn't work well. My code works much better.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users