Forum Topic: slopes on platforms?

(351 views • 25 replies)

This topic is 1 page long.

<< < > >>
None

iluvAS

Reply To Post Reply & Quote

Posted at: 10/20/09 10:21 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

ive been doing some googling trying to include slope platform in my current engine and erm i got seriously confusing maths stuff like eulers rule and smth that starts with a V integration thing o_O... i seriously cant remember wat it was but its not v@gin@....

so ermm can anyone point me out to any tutorials or perhaps even jus write down in this thread how i go abt doing it? so far all i noe is 2 ways to go abt doing it

1. 2 imaginary dots on each side of teh character and the angle between the 2 will be the angle of the char. so basically all hittests is on the dots not on the char.

2. that eular rule thing.

pls help cuz my engine are teh awesumz n it haz to be awesomer. it can liek wall kikz and stuffs =3

slopes on platforms?


None

iluvAS

Reply To Post Reply & Quote

Posted at: 10/20/09 10:24 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

ps u may notice there is a slope there. it werks but its not to my expectation. it aint physicish... it will like not stick onto the slope if it is going down... uphill still looks perfect but its that cheating

tol=1
while(map.flr.hitTest(_x,_y+_height/2-tol,true){
_y-=tol/2
}

yeah i noe AS2 cuz i find it easier to be done there....


None

liaaaam

Reply To Post Reply & Quote

Posted at: 10/20/09 10:52 AM

liaaaam NEUTRAL LEVEL 22

Sign-Up: 12/11/04

Posts: 14,542

Nobody is going to go out of their way to help you when you type like a 12 year old with attention deficit disorder. Use proper grammar and spelling and your posts will be much more readable.


Crying

iluvAS

Reply To Post Reply & Quote

Posted at: 10/20/09 10:56 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

=(

im sorry... well basically i just want some guidance in making a proper working sloped platform engine to include in my current one.


None

Rustygames

Reply To Post Reply & Quote

Posted at: 10/20/09 03:43 PM

Rustygames LIGHT LEVEL 18

Sign-Up: 05/07/05

Posts: 6,661

It's impossible, this has baffled game developers for years

- Matt, Rustyarcade.com


None

zrb

Reply To Post Reply & Quote

Posted at: 10/20/09 06:54 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,554

At 10/20/09 03:43 PM, Rustygames wrote: It's impossible, this has baffled game developers for years

ur totelly rite man i tryd to doo thees for so long nd it dunt work fr me :(

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

Torrunt

Reply To Post Reply & Quote

Posted at: 10/21/09 04:10 AM

Torrunt LIGHT LEVEL 20

Sign-Up: 05/03/07

Posts: 263

At 10/20/09 03:43 PM, Rustygames wrote: It's impossible, this has baffled game developers for years

Just to make sure: you're joking, right?

Slopes are really easy to do in a graphic based engine and for tile based engines I'm not so sure about the difficulty (haven't tried it yet myself) but quite a lot of people have done it and there's quite a few tutorials out there.


None

Nayhan

Reply To Post Reply & Quote

Posted at: 10/21/09 04:59 AM

Nayhan LIGHT LEVEL 14

Sign-Up: 09/08/06

Posts: 550

At 10/20/09 06:54 PM, zrb wrote:
At 10/20/09 03:43 PM, Rustygames wrote: It's impossible, this has baffled game developers for years
ur totelly rite man i tryd to doo thees for so long nd it dunt work fr me :(

Brad Bourne's made pretty much perfect slopes in fancy pants to it's not impossible, just difficult.

I haven't figured it out yet but I think you can use Sin & Cos functions to do it.
Your not going to be able to get it to work without some complicated maths though.


None

grafik2d

Reply To Post Reply & Quote

Posted at: 10/21/09 07:50 AM

grafik2d NEUTRAL LEVEL 10

Sign-Up: 06/29/04

Posts: 182

Working with slope is easier than you might think. I have a platform engine in my portfolio. I won't give you the full code but the concept is to use a loop to catch where your standing reference + your xSpeed is going to met the ground(hittest) and set a property like myHero.nextY=i. Basically make it start from the middle of the hero movie clip down to about a dozen of pixel or so. I might publish a tutorial when done with my platform engine, I'm still working on the map scrolling, some moving platform, ladders and other common things


None

jonathansario

Reply To Post Reply & Quote

Posted at: 10/21/09 07:57 AM

jonathansario NEUTRAL LEVEL 01

Sign-Up: 09/15/09

Posts: 14

If you're using while statements, it should work popping up the character when he's going up the slop... so the problem is he doesn't stick to the slope when he's going down...

Have you tried NOT negating the gravity while he's in contact with the floor? This way when he moves down a slop, gravity will assist him, keeping him ON the slope.


None

Rustygames

Reply To Post Reply & Quote

Posted at: 10/21/09 01:20 PM

Rustygames LIGHT LEVEL 18

Sign-Up: 05/07/05

Posts: 6,661

At 10/21/09 04:59 AM, Nayhan wrote:
At 10/20/09 06:54 PM, zrb wrote:
At 10/20/09 03:43 PM, Rustygames wrote: It's impossible, this has baffled game developers for years
ur totelly rite man i tryd to doo thees for so long nd it dunt work fr me :(
Brad Bourne's made pretty much perfect slopes in fancy pants to it's not impossible, just difficult.

I haven't figured it out yet but I think you can use Sin & Cos functions to do it.
Your not going to be able to get it to work without some complicated maths though.

Nah that's a trick of the eye. Fancy pants is made using smoke and mirrors. It's impossible and cannot be done

- Matt, Rustyarcade.com


None

Toast

Reply To Post Reply & Quote

Posted at: 10/21/09 04:23 PM

Toast DARK LEVEL 09

Sign-Up: 04/02/05

Posts: 8,925

At 10/21/09 07:57 AM, jonathansario wrote: Have you tried NOT negating the gravity while he's in contact with the floor?

Err, nope. Don't you know that gravity is gone when your feet touch the floor? Seriously, go learn some physics before you try to make flash games.


Questioning

Schmastalukas

Reply To Post Reply & Quote

Posted at: 10/21/09 09:12 PM

Schmastalukas NEUTRAL LEVEL 17

Sign-Up: 10/22/07

Posts: 395

At 10/21/09 04:23 PM, Toast wrote: Err, nope. Don't you know that gravity is gone when your feet touch the floor? Seriously, go learn some physics before you try to make flash games.

What are you on? Gravity is still there, and it's still pushing down on you. It's just that you're feet and legs are working pushing against the ground and keeping you up.

Winning = failing at failing
Failing at failing = failing
Therefore... Winning = failing

BBS Signature

None

ProfessorFlash

Reply To Post Reply & Quote

Posted at: 10/21/09 09:29 PM

ProfessorFlash DARK LEVEL 24

Sign-Up: 10/06/07

Posts: 813

At 10/21/09 04:23 PM, Toast wrote:
At 10/21/09 07:57 AM, jonathansario wrote: Have you tried NOT negating the gravity while he's in contact with the floor?
Err, nope. Don't you know that gravity is gone when your feet touch the floor? Seriously, go learn some physics before you try to make flash games.

Was this a joke or did Toast just bring shame to him and his family? :)


None

Version2

Reply To Post Reply & Quote

Posted at: 10/21/09 09:59 PM

Version2 EVIL LEVEL 11

Sign-Up: 09/24/03

Posts: 613

At 10/21/09 09:29 PM, ProfessorFlash wrote:
At 10/21/09 04:23 PM, Toast wrote:
At 10/21/09 07:57 AM, jonathansario wrote: Have you tried NOT negating the gravity while he's in contact with the floor?
Err, nope. Don't you know that gravity is gone when your feet touch the floor? Seriously, go learn some physics before you try to make flash games.
Was this a joke or did Toast just bring shame to him and his family? :)

Let's see... Triangle devided by a coeffiecent and some pie... Nope, he's absolutely correct. As soon as your feet touch the ground, gravity goes away. Also, space ends 12 miles up... according to these calculators.


None

kizza0

Reply To Post Reply & Quote

Posted at: 10/22/09 03:25 AM

kizza0 NEUTRAL LEVEL 08

Sign-Up: 10/13/07

Posts: 276

You could use the equation of a line to represent the line and the y position can then be calculated form the xposition.

BOOM HEADSHOT

BBS Signature

None

LeechmasterB

Reply To Post Reply & Quote

Posted at: 10/22/09 07:55 AM

LeechmasterB EVIL LEVEL 16

Sign-Up: 04/01/05

Posts: 940

At 10/21/09 04:23 PM, Toast wrote: Err, nope. Don't you know that gravity is gone when your feet touch the floor? Seriously, go learn some physics before you try to make flash games.

LoL

At 10/21/09 09:59 PM, Version2 wrote: Let's see... Triangle devided by a coeffiecent and some pie... Nope, he's absolutely correct. As soon as your feet touch the ground, gravity goes away. Also, space ends 12 miles up... according to these calculators.

Haha

Okay lets get a little more serious now. :)

At 10/20/09 10:21 AM, iluvAS wrote: 2. that eular rule thing.

Which one? Euler was a damn famous mathematician and there are tons of "euler things" basically his whole life work!

As to how slopes work:
Gravity pulls you down, also on a slope but there you split up the gravity vector into a component that is normal to the collision surface and one that is tangential to the collision surface. That way the normal component will push him up and make him not collide whereas the tangential component will make him slide.

If you are art based its trickier to find out the normal vector, basically you have to take sample points in player center and at least one or two more on one or both sides ie. slightly displaced on the x axes. With the sample points you calculate the normal vector and use that one to calculate the gravity distribution ect.

You could also have movieclips that are rotated and calculate the normal based on the rotation and voronoi region.

You could also have a tile engine with precalculated/preset normal vectors.

Now the problem is this all requires basic vector math and a brain to do, and i certainly don't have the time to write out the code for you. So there are 3 options left, either someone else does, you go and learn it (using google) or you simply give up. :)

cheers


None

LeechmasterB

Reply To Post Reply & Quote

Posted at: 10/22/09 08:03 AM

LeechmasterB EVIL LEVEL 16

Sign-Up: 04/01/05

Posts: 940

Btw. euler was swiss and went to the same uni as i did (yay) ! :P
Here s a list of euler things (sorry only found a compiled list in german but you ll get the point).
Euler Things:

* Euler-Bernoulli-Gleichung, Differentialgleichung vierter Ordnung, die der Kontinuumsmechanik des Balkens zugrunde liegt
* Euler-Charakteristik, in der Topologie eine Kennzahl für geschlossene Flächen
* eulersche Differentialgleichung, lineare gewöhnliche Differentialgleichung beliebiger Ordnung
* eulersches Dreieck, s. u.: "eulersches Kugeldreieck"
* Euler-Eytelwein-Formel, Formel für Seilhaftung
* Satz von Euler-Fermat (Zahlentheorie)
* eulersche Formel (Flächenkrümmung)
* eulersche Formeln (harmonische Analyse)
* eulersche Gerade: die Verbindungsgerade von Schwerpunkt, Höhenschnittpunkt und Umkreismittelpunkt eines Dreiecks
* Satz von Euler (Geometrie)
* Euler-Gleichungen (eulersche Bewegungsgleichungen), Grundgleichungen der Hydrodynamik idealer (reibungsfreier) Flüssigkeiten (Strömungsmechanik)
* eulersche Gleichungen (Kreiseltheorie), eulersche Kreiselgleichungen
* Euler-Hierholzer-Satz
* eulersche Identität ei%u03C0 = %u2212 1, ein Spezialfall der eulerschen Relation: e^{iz} = \cos z + i\sin z\
* eulersches Integral erster und zweiter Gattung
* eulersche Konstante siehe Euler-Mascheroni-Konstante (nicht zu verwechseln mit der eulerschen Zahl).
* eulersches Kugeldreieck, eine besondere Form des Kugeldreiecks
* Euler-Lagrange-Gleichung
* eulersche Last in der Balkentheorie die minimale axiale Last, die nötig ist, um eine Verbiegung zu bewirken
* eulersche Linie (auch "Eulertour" oder "Eulerkreis") in der Graphentheorie: ein Kantenzug, der jede Kante eines Graphen enthält
* Euler-Maclaurin-Formel
* Euler-Mascheroni-Konstante %u03B3 = 0.5772...
* Euler-Maruyama-Verfahren zur Lösung von stochastischen Differentialgleichungen
* eulersche %u03C6-Funktion in der Zahlentheorie: %u03C6(m) = Anzahl der zu m teilerfremden ganzen Zahlen a mit 0 < a < m
* eulerscher Polyedersatz
* eulersches Polygonzugverfahren (Integrationsverfahren für Differenzialgleichungen)
* Euler-Produkt, siehe Dirichletreihe
* eulersche Pseudoprimzahl
* eulersche Reihentransformation
* eulersche Turbinengleichung als Grundlage für die Kraftmaschine der modernen Stromerzeugung
* eulersche Vermutung, Vermutung der Zahlentheorie und Verallgemeinerung der fermatschen Vermutung
* die Euler-Wiege, eine kardanische Aufhängung, die in allen drei eulerschen Winkeln drehbar ist
* Euler-Wind
* eulersche Winkel
* eulersche Zahl e = exp(1) = 2,71828...
* eulersche Zahlen, verwandt mit den Bernoulli-Zahlen, treten als Taylor-Koeffizienten von sec(x) auf
* Euler-Zahlen bilden das dem Pascalschen Dreieck ähnliche Euler-Dreieck in der Kombinatorik
* Euler-Zahl ist eine dimensionslose Kennzahl in der Strömungsmechanik


None

jonathansario

Reply To Post Reply & Quote

Posted at: 10/22/09 07:57 PM

jonathansario NEUTRAL LEVEL 01

Sign-Up: 09/15/09

Posts: 14

Ah... You're confusing the original poster. Simplest is usually the best way.

From what I could figure out from his original posts, his character does not stick to the slope when its going down the slope. If he zeros his gravity when touching the floor, the character's falling velocity will fluctuate as he goes down a sloping floor.

At least thats how I picture it...


Elated

iluvAS

Reply To Post Reply & Quote

Posted at: 11/3/09 06:23 AM

iluvAS NEUTRAL LEVEL 07

Sign-Up: 11/18/07

Posts: 271

wow i never thought anybody would reply me after some person said i was toking like a 5 year old or smth =(. when i came back omfg pro pplz in uni and stuffs who actually knows wth is eularz and stuff. so erm sry for teh late reply

and abt the guy who said gravity acting upon the char.... i think he gave me ehh clue it is possible....

i will leave gravity to a positive value (falling down). But then WTH I FALLZ... thats when my anti sink into floor code comes in .... he is constantly falling but the while(ur are sinked into floor){ code pushes me up.... it gives me an illusion ive stopped falling and stuck to the ground... so when i run downs a slope the char falls immidiately and pushes back up to stick to the floor.

it are teh h4x0rxz. =3

Buttehhhh well one mystery solved but me being a mapler i kinda wann achieve that maple engine =\ ive no idea why. if u guys play maple u shud notice when u jump into the air and when the floor u land upon is a slope and u jump the moment you hit the floor... the character will be flung towards the direction the slope is sloping downwards to.... welll howz i do dat??

trying to achieve fanceh pants lvl of platformer engine is as crazy muchacho sicko as asking a kid to cycle with his pants off and face on the seat instead of his ass.... well u noe waddaimean so im jus trying to aim for teh maple platformer engine.....

so yeah abt the contraverseh over the OMFG gravity is gone when u touchez floor. LOOL noo u newb go learn ur feeseekz. i think.. i think.... graivty is never gone just that there is an opposing force to keep u from falling =3. erm so thankz to the gravity exist even when on land idea =) and someone pls teach megh abt teh maple engine ....

kthxbai


Elated

hdxmike

Reply To Post Reply & Quote

Posted at: 11/3/09 06:34 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/3/09 06:23 AM, iluvAS wrote: Stuff

I just cant stop laughing

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Toast

Reply To Post Reply & Quote

Posted at: 11/3/09 06:54 AM

Toast DARK LEVEL 09

Sign-Up: 04/02/05

Posts: 8,925

At 11/3/09 06:34 AM, hdxmike wrote:
At 11/3/09 06:23 AM, iluvAS wrote: Stuff
I just cant stop laughing

Dude what's with the double equal signs? If you're making a statement outside of a condition there's only one equal sign.


None

hdxmike

Reply To Post Reply & Quote

Posted at: 11/3/09 07:04 AM

hdxmike LIGHT LEVEL 09

Sign-Up: 09/11/09

Posts: 1,815

At 11/3/09 06:54 AM, Toast wrote: Dude what's with the double equal signs? If you're making a statement outside of a condition there's only one equal sign.

Its my sig , i didnt expect anyone to actually LOOK at it

OOP AS3 || Flash 8,CS3,CS4 || *sigh* || The new forum on the block : FLASH SEED !

BBS Signature

None

Montycarlo

Reply To Post Reply & Quote

Posted at: 11/3/09 07:06 AM

Montycarlo LIGHT LEVEL 19

Sign-Up: 03/14/05

Posts: 742

At 11/3/09 06:54 AM, Toast wrote: Dude what's with the double equal signs? If you're making a statement outside of a condition there's only one equal sign.

A single equilateral operator would set it to that value; two would do as you stated; return a boolean value. He's claiming that they're true, so that's why he used them ;)


None

Toast

Reply To Post Reply & Quote

Posted at: 11/3/09 07:21 AM

Toast DARK LEVEL 09

Sign-Up: 04/02/05

Posts: 8,925

At 11/3/09 07:04 AM, hdxmike wrote:
At 11/3/09 06:54 AM, Toast wrote: Dude what's with the double equal signs? If you're making a statement outside of a condition there's only one equal sign.
Its my sig , i didnt expect anyone to actually LOOK at it

What? That doesn't make sense.

At 11/3/09 07:06 AM, Montycarlo wrote: A single equilateral operator would set it to that value; two would do as you stated; return a boolean value. He's claiming that they're true, so that's why he used them ;)

What? That doesn't make sense. posts == 22 doesn't bring any information at all about how many posts you have. Only (posts == 22) = true would.


None

Montycarlo

Reply To Post Reply & Quote

Posted at: 11/3/09 07:24 AM

Montycarlo LIGHT LEVEL 19

Sign-Up: 03/14/05

Posts: 742

At 11/3/09 07:21 AM, Toast wrote: What? That doesn't make sense. posts == 22 doesn't bring any information at all about how many posts you have. Only (posts == 22) = true would.

In a sense that's what he's done, that's what I was getting at.
"He's claiming that they're true, so that's why he used them ;)"


All times are Eastern Standard Time (GMT -5) | Current Time: 01:56 AM

<< 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!