Hi! So I'm starting to learn what slope detection is. Can someone please explain in the simplest way what atan2 does?
If you didn't exist, nobody would go back in time and kill your father.
Therefore, your father will still have you. Inception.
Hi! So I'm starting to learn what slope detection is. Can someone please explain in the simplest way what atan2 does?
lol if you don't know what Atan2 is, ill stop you right there, work on tile engines first.

atan2 in flash is a function in flash. Just click the link to know what it does.
http://www.lashf.com/page/actionscript/atan_rotation
arc tangent. it's used to calculate angles of a right triangle according to ratio.
http://arctangent.net/atan.html
hahaha! i know what arc tangent is.. i just dont know what atan2 is.. atan is pretty much elementary to me
)
oh... if you want to know how to use it then try looking at this article: http://www.lashf.com/page/actionscript/atan_rotation
thanks man.
your welcome xD.
hey redligot how do you make your character jump on sloped areas? haha i need an idea XD
well.... actually my method is inefficient but it works.
First I check what the player's _rotation value is. Then I add it up to the speed variable divided by 4(or 2). I know there's a better method, but this is my solution. OK, so... do you follow?
why would you divide it by the speed variable??
Actually it goes sorta like this speed += char._rotation/4 I think xD
ok so i got that working but how do you make it so that the character will be in it's normal rotation when it's in midair?
you can do something like
if(!_root.ground.hitTest(player._x,player._y+3,true)){//check if touching ground is false
if(player._rotation < 0){//if his rotation is less than 0
player._rotation ++//reorient rotation
}
if(player._rotation > 0){
player._rotation --
}
}
so his rotation would re-orient itself when in mid-air.
thanks!!! i shouldve thought of that haha. i didnt think it thru haha
k... so.... demo?
You must log in to post.