PDA

View Full Version : Moving Platforms



Archangel
04-13-2009, 11:54 AM
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:

pkmnfrk
04-13-2009, 11:57 AM
Um, subject line and topic divergance?

Archangel
04-13-2009, 12:08 PM
Fixed... Smack to the face.

Joe123
04-13-2009, 12:54 PM
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;
}
}

Christian
04-13-2009, 10:48 PM
How do you set this script up using your pit script?

Joe123
04-14-2009, 02:35 AM
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;'.

Christian
04-14-2009, 02:48 AM
Ah , very simple.

Thanks =)

Joe123
04-14-2009, 04:14 AM
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.

Archangel
04-15-2009, 09:25 PM
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?

Joe123
04-17-2009, 04:47 AM
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.

Archangel
04-17-2009, 09:17 AM
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

pkmnfrk
04-17-2009, 10:30 AM
Define 'glitches'.

Note that a large FFC uses the surrounding tiles, not combos.

Archangel
04-17-2009, 10:38 AM
Big moving ffcs: Incorrect render. Renders only one tile, not the entire combo.
Big animated wide ffcs: Incorrect animation.

pkmnfrk
04-17-2009, 11:58 AM
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.

Christian
04-17-2009, 02:07 PM
It works well for me.

And it probably works great for the creator also.

pkmnfrk
04-17-2009, 11:14 PM
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)

pkmnfrk
04-18-2009, 01:21 AM
(sorry about the double post, this is a reply to a different post)


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!


Big animated wide ffcs: Incorrect animation.

Here's how you have to layout your tiles:

http://zctut.com/other/ffc1.png

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

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

http://zctut.com/other/ffc2.png

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

http://zctut.com/other/ffc3.png

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.

Joe123
04-18-2009, 06:03 PM
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.

Archangel
04-29-2009, 02:04 PM
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?

Joe123
04-29-2009, 02:11 PM
It's not buggy.

pkmnfrk
04-29-2009, 02:58 PM
<_< 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.

Archangel
04-29-2009, 09:02 PM
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. ;)

pkmnfrk
04-29-2009, 11:44 PM
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.

Archangel
04-30-2009, 12:37 AM
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.

Joe123
04-30-2009, 03:15 AM
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.

Archangel
04-30-2009, 02:02 PM
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.