Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Moving Platforms

25 replies · 4,892 views · Started 13 April 2009

I was wondering if someone could make an aquamentus that breathes fire.

Edit: I also need moving platforms that are 16x16 combos that carry link around the screen. I'm using changers by the way. :googly:

ffc script Platform{
void run(){
int counterx; int countery;
while(true){
if(Abs(Link->X-(this->X+8*(this->TileWidth-1))) <= 8*this->TileWidth
&& Abs(Link->Y-(this->Y+8*(this->TileHeight-1))) <= 8*this->TileHeight){
Link->X += move(this->Vx,counterx);
Link->Y += move(this->Vy,countery);
counterx = (counterx+1)%(100/factors100(Abs(this->Vx)));
countery = (countery+1)%(100/factors100(Abs(this->Vy)));
}
Waitframe();
}
}
int move(int s,int c){
int as = Abs(s);
int ret;
if(as < 1){
if(c < as*100/factors100(as)) ret = 1;
else ret = 0;
}else if(as < 2){
if(c < (as-1)*100/factors100(as-1)) ret = 2;
else ret = 1;
}
if(s < 0) ret = -ret;
return ret;
}
int factors100(int s){
for(int i=50;i>0;i--) if((s*100)%i == 0) return i;
}
}

Move the 'Falling' boolean from the pit script outside of the script, and put a line inside the if in the while loop in this script that says 'Falling = false;'.

Yeah, I mean it's not perfect but I'd say it's acceptable.
I'm quite proud of it though, took some thinking up.

There's a slight problem with the script. It only moves link if he's facing the same direction as the platforms path of movement. Is it possible to correct this?

There is nothing related to direction in that code at all.

Are you possibly walking against the direction of the platform?
Surprisingly enough that might cause some problems.

I'm using 4 of them joined together like so. That way it looks like a single combo, since it glitches if you try to use a single 32x32 combo.
XX
XX

Big moving ffcs: Incorrect render. Renders only one tile, not the entire combo.
Big animated wide ffcs: Incorrect animation.

About the animation, you have to keep in mind about the tiles thing. You need to put the tiles in the animation order, and then use the Skip X option to do the animation. I'll put together an example tonight when I get home.

Archangel wrote:There's a slight problem with the script. It only moves link if he's facing the same direction as the platforms path of movement. Is it possible to correct this?

Confirmed. Although I haven't done any extensive testing, I ran into the same problem when writing my own version of this script.

I think it has something to do with Link's NES style movement code. It resists moving him in certain ways via script. But, when I enabled Diagonal Movement, suddenly it worked properly.

(I then ran into an issue with a platform moving at a fractional speed, but Link's position not storing decimals! I think Link's position should include the fraction, even if it's truncated for the purpose of determining his position)

(sorry about the double post, this is a reply to a different post)

Archangel wrote:Big moving ffcs: Incorrect render. Renders only one tile, not the entire combo.

Make sure your changers have the same TileWidth/Height and EffectWidth/Height settings. This is important, because any FFC that gets changed will inherit those settings!

Archangel wrote:Big animated wide ffcs: Incorrect animation.

Here's how you have to layout your tiles:

User posted image

Note that they're all side-by-side.

And, here's how you lay out the combos:

User posted image

Note there's only one combo for the whole FFC. Let's take a closer look at that combo, hmm?

User posted image

Ah, there! A.Skip X! Use that so the animation will jump from tile 0 to tile 2 to tile 4, etc, thus giving you the proper animation.

Archangel wrote:I'm using 4 of them joined together like so. That way it looks like a single combo, since it glitches if you try to use a single 32x32 combo.
XX
XX

Yeah, don't do that.
And use diagonal movement.

Joe123 wrote:Yeah, don't do that.
And use diagonal movement.

<_< I hate diagonal movement... It is so buggy. Is there anyway to get this to work without diagonal movement?

Archangel wrote:<_< I hate diagonal movement... It is so buggy. Is there anyway to get this to work without diagonal movement?

No. Link's movement without diagonal movement is much more complicated than it looks. It also forces him to an invisible 4px grid, which prevents the platform from working.

Never mind...

I'm just going to hope they fix the ladder bugs involving diagonal movement.
I managed to fix the problem I was having with the diagonal movement by making it so when link tries to scroll off the screen in some of my cavern rooms it stops by using the Cancel Warp/Sidewarp Trick. 😉

A more complicated platform script should probably check for obstruction before moving Link, something I might add to my platform script. That way, you can't scroll Link off the screen unless it's walkable.

Yes, I like to see it use the ffc variables to give it different properties. If your going to make a platform script, make it as versatile as possible.

Mine works for what I wanted it to do, I posted it to help you out.
If you want to make more versatile I'm quite happy for you to, but I have no need to.

It's that it scrolls link off the screen onto the adjacent screen that caused me problems man. That was all, not really a bug. Just a limitation of the script which I've fixed.