Forum Topic: platformer code. like maplestory's

(115 views • 5 replies)

This topic is 1 page long.

<< < > >>
None

iluvAS

Reply To Post Reply & Quote

Posted at: 5/12/09 07:47 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 266

as the subject says how do you go about making it?

Cuz the things i know about sloped platforms is that your character will be rotating about to fit the platform precisely even so im not capable of doing that but ive noticed that maplestory has no rotations invloved. Does anyone know how they calculate the x,y, movements with respect to slopes

And also when u jump off slopes u will be flinged more furthur towards the perpendicular direction of the slope and it takes a longer time for u to climb up slopes than to walk on horizontal ground and it takes even less time when going down slope... how can i do this. Im not asking for free scripts or anyting i jus wanna noe the concept to go about making the code.


None

Fabzilla

Reply To Post Reply & Quote

Posted at: 5/12/09 08:02 AM

Fabzilla NEUTRAL LEVEL 09

Sign-Up: 03/24/05

Posts: 261

if(player contacting slope){
player._rotation = slope._rotation
}

player speed = slope angle

0 is normal
-180 to 0 is slower
0 to 180 is faster

it cant be too hard to find the code out there on the internet


None

iluvAS

Reply To Post Reply & Quote

Posted at: 5/12/09 08:08 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 266

ya i noe thats how u rotate to platform but im toking abt how to make maple's platformer. theirs dun invlove any rotating of the character yet it moves with respect to the angle slope. And btw what if the whole stage is one giant movieclip. i cant set the player's rotation to the floor rotation cuz the whole dam stage is one mc.


None

mayoarm11

Reply To Post Reply & Quote

Posted at: 5/12/09 08:15 AM

mayoarm11 NEUTRAL LEVEL 17

Sign-Up: 06/13/07

Posts: 998

im not sure this is the BEST method for calculating the rotation needed, but it's one I came up with

size = _width/2; //half of player's width. I'm assuming you centered your character movieclip, at least x-wise

p1 = 0;
while(!_root.g.hitTest(_x-size,p1,true)) //g is your ground MC. this checks for the first hit of the ground starting from the top
p1++;
p2=0;
while(!_root.g.hitTest(_x+size,p2,true))
p2++;

_rotation = 180-Math.atan2(size*2,p2-p1)*180/Math.PI ;

Awesome turret game in the making, featuring 85 uniqe turrets: News post

BBS Signature

None

mayoarm11

Reply To Post Reply & Quote

Posted at: 5/12/09 08:17 AM

mayoarm11 NEUTRAL LEVEL 17

Sign-Up: 06/13/07

Posts: 998

sorry for dbl post. This is a direct copy / paste from an experimental engine I was making. It's a function that returns the rotation value of the player. p = player, g = ground

function getRot():Number {
	X = p._x;
	p1 = 0;
	while (!g.hitTest(X-size, p1, true)) {
		p1++;
		if (p1 == Stage.height+1) {
			return p.rot;
		}
	}
	p2 = 0;
	while (!g.hitTest(X+size, p2, true)) {
		p2++;
		if (p2 == Stage.height+1) {
			return p.rot;
		}
	}
	return (Math.PI-Math.atan2(size*2, p2-p1));
}

Awesome turret game in the making, featuring 85 uniqe turrets: News post

BBS Signature

None

Super-Yombario

Reply To Post Reply & Quote

Posted at: 5/12/09 11:37 AM

Super-Yombario FAB LEVEL 06

Sign-Up: 03/16/07

Posts: 1,156

if(this_part_off_teh_grnd.rotated=yes){{
do_the_walk.Up(yes,no,yes);
}{else}{
make_the_regular_walk;
}}{}

There you go, it should work fine.

Obvious troll is so obvious

RIP Ed McMahon - RIP Farrah Fawcett - RIP Michael Jackson
But wait, there's more...
RIP Billy Mays


All times are Eastern Standard Time (GMT -5) | Current Time: 12:57 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!