-
Senior Member
teach me platfrom game physics
i hope i posted this in the right place, i'm new here.
well the title says it all really. i'm looking for a teacher, so i can learn how to make great platform engines and or games.
what i wish to learn:
all of this will be in as3 by the way. and i learned tile based levels in both as3 and as2 so we will be making this example from that tile based level system. just because it will be easier.
first off the basics; gravity, moving left and right. then going more complicated so slopes being introduced. then get slightly more complicated and make accelerated movement. then things get slightly more hard when jumping is introduced and it would be the kind of jumping were you can set the max height but you can actually let go of the jump button while jumping and if it hasn't reached max height yet it begins to fall until it hits ground.
also even know that all i wish to learn it would involve understanding those variables that people use sometimes in there examples like wind resistance and friction while moving and also there is one called velocity sometimes. i've got confused by all of them many times. so if at all possible you could help teach me that to that would be awesome.
Interested?
well if your interested in wanting to teach me this, please email me at scorpafied@gmail.com
i'm alot more active on my email account so i will reply quicker if you email me. thats why i provided it.
well thanks in advance.
-
Senior Member
so can anyone help me out?
-
Zombie Coder
I'll save some anticipation and tell you now- no one's going to e-mail you. You'll just have to google what you're looking for, and you'll find plenty of tutorials online.
This isn't the place where programmers teach people everything from scratch, but if you do have any specific code-related problems, please feel free to ask.
-
Senior Member
there are no tutorials. hence why i'm here.
basic platformer stuff there are tutorials. but as soon as you want to start making slopes, movement on different shaped surfaces. and you know the general physics behind stuff like that. so yeah basic movement in platformers is as far as it goes.
so you see what i mean hopefully. if not i'll sum it up for you. there are heaps of tutorials on basics of platformers, which is what you mean't i'm sure. but as soon as you want actual physics (meaning movement on different shaped surfaces, and physics involved with that. meaning going down a hillo would increase speed ect...) theres nothing anywere. if there was but, it would be great but still to complex to understand just by looking at thhe code so i would need someone to help me to understand it.
hence why i've asked this question. i'm hyere becuase all other actionscript forums said if i had hope of getting help with this propblem this would be my best place to go.
-
M.D.
-
Senior Member
ohh thanks. they helped. now the only issue is understanding the fla that put all that math into practise. i'm, going threw the code now. but i'm only intermediate level in actionscript. not great at math i've only ever used the basic math functions like math.floor .ceil and .random
so yeah will do my best to understand this stuff i've been given.
thanks for the assitance, so far
-
When you know are.
They aren't AS3 specific, but Tonypa's tutorials seem to be all you need. It wouldn't be difficult to update the code to AS3.
Tile Based Collision: http://www.tonypa.pri.ee/tbw/
Vector Based Collison: http://www.tonypa.pri.ee/vectors/index.html
-
M.D.
it bascially comes down to projection and intersection. Projecting vectors (or points) onto geometry (lines), detecting intersection between projection point and object point, projecting object velocity onto geometry, setting new projected velocity to object.
It all sounds simple on paper, but yeah, learning this stuff will take some time. I'm by no means a maths guru, in fact quite the opposite. Just over the years i've needed to use this stuff more and more.
some advice: start with just getting collision to register, finding collision depth and collision normal (the direction the collision point is from center point of object), once you know this stuff you can easily apply the velocity resolution.
Also, start off with brute force, don't worry about making the algorithm nice and fancy fast, concentrate on getting the result first.
point on a line: http://ozviz.wasp.uwa.edu.au/~pbourk...try/pointline/
-
Senior Member
Son of Bryce:
i've never like tonypa his examples were based from outsideofsociety.com and i always thoughjt they were harder to understand then there ones.
i'm not sure if that was just for tile-based levels or if it was for all his work. i'll look at the examples later when i get home. because i can't access them on the pc i'm on right now. (i'm at work and they filter there internet so people can't view games and stuff. his website is classified as a game, lol.)
but yeah will view them later. thanks didn't even think to look at his stuff.
mr_malee:
yeah everytime i look at math my head says "ahhhh! what are you doing to me." and just runs off somewere. lol so i find it hard to learn how to actually do alot of this stuff. however it dopesn't stop me from trying and usually failing. :P
-
Hype over content...
You don't have to resort to physics to replicate slopes etc.
http://blog.gamingyourway.com/PermaL...e86ca7e89.aspx
But if you do want to go that way, look into box2D, I'm sure there are a handful of tuts on how to make a platform game using it.
Squize.
-
Senior Member
Squize:
well i have no idea what that guy is ranting on about. slopes, arrays, angles, tile based maps.
its almost like he tried to throw a bunch of stuff into a few paragraphs just to make it sound natural, lol. couldn't have done a better job if i say so myself.
but anyway, i can't even do normal sloped collisions on my own. and believe me when i say i've tried going threw tutorials on them for help. but they never do. this is alot of the reason i'm here, asking for a teacher. because to do this, you need to use advance stuff to make it work or stuff i clearly struggle using.
so yeah i'm hoping something helps. or someone manages to teach it to me...
Everyone:
i looked over that fla files code again and i've manage to have no luck understanding it. its past my knowledge of flash programming. so if anyone could go over it and explain in detail all the lines of code, so i can understand it easier; that would be great.
thanks in advance!
-
Isometric Engine
Hi,
I ve made an 2D Isometric Multilevel Engine thanks to Tonypa's tutorials. They explain the basics. You can use my source code if you want to develop your game it will avoid you a lot of headhache.
Links below:
- http://angelstreetv2.free.fr/as3/IsoEngine_AS3.swf
- http://code.google.com/p/2d-isometric-engine/
-
Senior Member
thank you, i really appreicate the code. but i'm making a platformer. so your code wouldn't help me.
plus if i were to take it, i would be stealing. nothing more, i wish to learn not steal. i know learning is seeming like an impossible task but i'd rather my try and keep failing method. it gets my know were but hopefully in the end after failing so many times i'll be able to do all this no problems.
thats the goal anyway.
-
M.D.
forget all the source files. Have you got a point projected onto a line?
that should be your first task
-
Senior Member
i tried bu didn't understand it. so i kept trying, and failed even more. so i left it alone.
-
M.D.
following this page: http://ozviz.wasp.uwa.edu.au/~pbourk...try/pointline/
here is a simple script which find the intersection of a point and line.
Code:
//setup our objects
var line:Object = { sx:100, sy:100, ex:400, ey:260 };
var point:Object = { x:0, y:0 };
function onMain(event:Event):void {
point.x = mouseX;
point.y = mouseY;
//get the lines components (P2 - P1)
var lineSizeX:Number = line.ex - line.sx;
var lineSizeY:Number = line.ey - line.sy;
//get the components between point and line start (P3 - P1)
var linePointDistX:Number = point.x - line.sx;
var linePointDistY:Number = point.y - line.sy;
//find the dot product of the above components
var dotProduct:Number = linePointDistX * lineSizeX + linePointDistY * lineSizeY;
//find the unit vector, this is the time at which the point intersects with the line
//if the point intersects with the line this will be 0 to 1.
var u:Number = dotProduct / (lineSizeX * lineSizeX + lineSizeY * lineSizeY);
//cap the unit vector so it doesn't extend past the lines extents
u = Math.max(0, Math.min(1, u));
//find the intersection point on the line using the unit sized vector
var intersectionX:Number = line.sx + u * lineSizeX;
var intersectionY:Number = line.sy + u * lineSizeY;
//draw some graphics so we can visually see this
graphics.clear();
graphics.lineStyle(1, 0xFF0000);
graphics.moveTo(line.sx, line.sy);
graphics.lineTo(line.ex, line.ey);
graphics.lineStyle(1, 0x000FF);
graphics.drawCircle(point.x, point.y, 2);
graphics.lineStyle(0.3, 0x00FF00);
graphics.moveTo(point.x, point.y);
graphics.lineTo(intersectionX, intersectionY);
graphics.lineStyle(1, 0x00FF00);
graphics.drawCircle(intersectionX, intersectionY, 2);
}
addEventListener(Event.ENTER_FRAME, onMain);
AS3, copy and paste into a new fla.
two things you might not know about that were used
http://en.wikipedia.org/wiki/Dot_product
http://en.wikipedia.org/wiki/Unit_vector
the dot product is a very useful operation and helps us to know information about vectors in relation to other vectors.
Last edited by mr_malee; 09-01-2009 at 08:31 PM.
-
Senior Member
think you can comment that any better?
its just i can't seem to understand the code that well. its just your current comments are going by a common mistake when helping. they phrase things in a way that people of there own skill level would understand.
common mistake, but would be good if you could recomment
thanks for the help. if i can understand this stuff i'm sure everything else would be easier to understand.
-
M.D.
how about you tell us exactly what you know. I'm guessing you know AS3 since you mentioned you wanted the game created in AS3. What about the comments doesn't make sense?
please don't say all of it
-
Senior Member
x-death, please stop looking at code as it is, and try to understand the logic behind it..... every programmer has his own way of implementing things, so it's pretty futile if you try to grasp the implementation without understanding the logic!
I don't understand how much your "intermediate" knoledge of actionscript is so, forget slope and create a basic platformer where you can move left,right, and jump without going through the ground! Next up build simple walls...if you can do this much on your own, show it here, and then I will tell you how to add slopes to this!
And Mr.Malee, since circle-line is going over his head, I think you should start explaining from moving up predefined slopes(point-point check), instead of irregular slopes!
If you like me, add me to your friends list .
PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!
My Arcade My Blog
Add me on twitter:
-
Senior Member
it wil take a few days to make. but it wasn't just slopes i wanted to make. i wanted it to be what ever angle to slope is. and possibly even circular shaped ground also.
but yes i suppose it is wrong of me to expect help, without giving first. i was asking for a little to much; so i will come back in a few days and post up the code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|