PDA

View Full Version : "SMB3" Colored Block Style Platform :o



Anthus
01-18-2009, 02:23 AM
I'm not sure if this is simple, or not, but here goes. Some games have solid platforms that you can jump through from underneath. Maple Story comes to mind. There are also various platforms in Mario, and Sonic games like this. I'm wondering if there is a script I can attach to a solid (or whatever, as long as it works) combo to create this effect.

If you are confused to what exactly I'm talking about, I need something that works like the big colored blocks in Super Mario Bros. 3.
http://www.youtube.com/watch?v=Fs299lPuYZo

Thank you.

Joe123
01-18-2009, 09:40 AM
A bit like the drop-through platforms at about 45 seconds in here (http://uk.youtube.com/watch?v=qSyhxcgWViI)?

Anthus
01-18-2009, 11:48 AM
Yes. Exactly o-o

Joe123
01-18-2009, 12:04 PM
I shall have a look at modifying that script for general use.
It's a bit caught up in my horrendous mess of kirby code at the moment.

Anthus
01-18-2009, 02:23 PM
Thank you. I've never attached a script to a combo before, so Imay need some general assistance :)

Joe123
01-18-2009, 04:05 PM
Well, you don't so much 'attach a script to a combotype' (although that would be nice) as 'apply an ffc script to the screen that affects a certain combotype'.

Although, this one's 'add a chunk to your global script that affects a certain flag'.
But that's irrelevant really.


const int CF_PLATFORM = 98;

//Solidity Check, by Saffith
bool isSolid(int x,int y){
if(x<0 || x>255 || y<0 || y>175) return false;
int mask = 1111b;
if(x%16<8) mask &= 0011b;
else mask &= 1100b;
if(y%16<8) mask &= 0101b;
else mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x,y)]&mask;
return ret != 0;
}

global script Slot_2{
void run(){
while(true){
if(!onFloor() && onFlag()) DropThroughPlatform();
Waitframe();
}
}
//Drop-Through Platforms
void DropThroughPlatform(){
if(!Link->InputDown && Link->Jump < 0) Link->Jump = 0;
}
bool onFloor(){
if(isSolid(Link->X+4,Link->Y+18) || isSolid(Link->X+12,Link->Y+18)) return true;
}
bool onFlag(){
if((Screen->ComboF[ComboAt(Link->X+4,Link->Y+16)] == CF_PLATFORM || Screen->ComboI[ComboAt(Link->X+4,Link->Y+16)] == CF_PLATFORM)
&& Screen->ComboF[ComboAt(Link->X+4,Link->Y+14)] != CF_PLATFORM && Screen->ComboI[ComboAt(Link->X+4,Link->Y+14)] != CF_PLATFORM) return true;
else if((Screen->ComboF[ComboAt(Link->X+12,Link->Y+16)] == CF_PLATFORM || Screen->ComboI[ComboAt(Link->X+12,Link->Y+16)] == CF_PLATFORM)
&& Screen->ComboF[ComboAt(Link->X+12,Link->Y+14)] != CF_PLATFORM && Screen->ComboI[ComboAt(Link->X+12,Link->Y+14)] != CF_PLATFORM) return true;
}
}

So basically all you have to do is combine this global script with any you already have (http://www.purezc.com/forums/index.php?showtopic=38773), then put flag '98' wherever you want a drop-through platform.
If you want to change the flag it uses, just edit the constant at the top of the script.


I haven't actually tested it though. Hopefully it works.

Anthus
01-19-2009, 11:02 PM
Awesome. I'll have to test it later though. I'll be a bit busy over the next few days.