Jump to content

Photo

Sideview Moving Platforms


  • Please log in to reply
5 replies to this topic

#1 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 08 August 2009 - 08:59 PM

I need a ffc script for moving platforms that work in sideview. The ffc uses changers to move, so this script just needs to move Link while stopping him from falling but letting him jump with the up button. Make it part global if you have to. For the collision detection it should use the effect area.

#2 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 08 August 2009 - 09:54 PM

I saw your post over at AGN and as a tip, you might want to be a bit more descriptive and friendly when requesting a script icon_wink.gif

Now, i believe i have a script like this in my script file. It might not work in the newest beta since ZScript has changed a bit from the older betas.

I can get that if you want?

#3 Zim

Zim

    Freelance Nobody

  • Members
  • Real Name:Zim
  • Location:Washington

Posted 09 August 2009 - 12:32 AM

Hey Christian, even if he doesn't want that I do.

#4 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 09 August 2009 - 12:47 PM

QUOTE(Christian @ Aug 8 2009, 09:54 PM) View Post

I saw your post over at AGN and as a tip, you might want to be a bit more descriptive and friendly when requesting a script icon_wink.gif

Now, i believe i have a script like this in my script file. It might not work in the newest beta since ZScript has changed a bit from the older betas.

I can get that if you want?

Ok. Can you help, please? I tried many different thing to get the other one to work. I just can't do it without the FFC solidity flag. If your script can get around this problem, that would be great.

#5 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 09 August 2009 - 06:56 PM

Try this.

CODE

ffc script MovingPlatform{
  void run(){
    while (true){
      // If the player is standing on top of the platform, move
      // him with the same speed.
      if((Link->X + 8 > this->X) && (Link->X - 8 < this->X) &&
          (Link->Y + 17 >= this->Y) && (Link->Y + 15 < this->Y) ){
        Link->X = Link->X + this->Vx;
        Link->Y = Link->Y + this->Vy;
        Link->Jump = 0;
        Link->Z = 0;
      }
      Waitframe();
    }
  }
}


You do know how to set everything up right? I had a long day today and i'm kind of worn out to type and explain how to do it icon_wink.gif
But if you don't, then i would gladly explain everything by line. It's designed to work with sideview gravity.
Try it and see if it works because i'm kind of unsure if it does since i havn't tested it yet.

Or, if it doesn't, then i can modify it and add an FFC solidity check that i have stored somewhere.

Edited by Christian, 09 August 2009 - 07:01 PM.


#6 Zephlon

Zephlon

    Experienced Forumer

  • Members

Posted 10 August 2009 - 05:15 PM

It works good. A few problems: it moves Link at a faster speed than the ffc, the script don't use EffectWidth. (I have a 2x2 platform. The bottom two tiles are mainly empty space.) ... Oh! Wait a minute! No, diagonal movement didn't help. ... I watched it more closely, and when moving left, Link moves too fast. When moving right, Link don't move at all.
CODE
ffc script MovingPlatform{
  void run(){
    while (true){
      // If the player is standing on top of the platform, move
      // him with the same speed.
      if((Link->X + 4 > this->X) && (Link->X - 4 < (this->X + this->EffectWidth - 16)) &&
          (Link->Y + 17 >= this->Y) && (Link->Y + 15 < this->Y) ){
        Link->X = Link->X + this->Vx;
        Link->Y = Link->Y + this->Vy;
        Link->Jump = 0;
        Link->Z = 0;
      }
      Waitframe();
    }
  }
}


I made it use EffectWidth, but I don't now how to fix the other bug. Perhaps having it keep track of its previous position each frame, and add the difference between now and then to Link's position?



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users