http://www.newgrounds.com/dump/item/9e49 0039781dbd5c4eaf88a0043b5ae5 is what i have soo far but how can i fix the sliding when you stop and when you run left and stop it stays facing left instaid of turning right
http://www.newgrounds.com/dump/item/9e49 0039781dbd5c4eaf88a0043b5ae5 is what i have soo far but how can i fix the sliding when you stop and when you run left and stop it stays facing left instaid of turning right
http://www.newgrounds.com/dump/item/9e49 0039781dbd5c4eaf88a0043b5ae5 sorry there was a space in it
Post your Code/Actionscript 2 or 3?
Give us something to work with
At 1/26/10 09:37 PM, CompleteDouche wrote: Post your Code/Actionscript 2 or 3?
Give us something to work with
as2
and
onClipEvent (load)
{
acceleration = 5.000000E-001;
xspeed = 0;
yspeed = 0;
friction = 2.500000E-001;
gravity = 4.000000E-001;
jumppower = 10;
}
onClipEvent (enterFrame)
{
if (xspeed > 0)
{
jumppower = 10 + xspeed / 10;
} // end if
if (xspeed < 0)
{
jumppower = 10 - xspeed / 10;
} // end if
if (Key.isDown(37))
{
xspeed = xspeed - acceleration / 5;
} // end if
if (Key.isDown(39))
{
xspeed = xspeed + acceleration / 5;
} // end if
if (yspeed < -5.000000E-001 && xspeed > 0)
{
_root.hit = 0;
gotoAndStop(3);
}
else if (yspeed > 5.000000E-001 && xspeed > 0)
{
_root.hit = 0;
gotoAndStop(4);
}
else if (yspeed < -5.000000E-001 && xspeed < 0)
{
_root.hit = 0;
gotoAndStop(6);
}
else if (yspeed > 5.000000E-001 && xspeed < 0)
{
_root.hit = 0;
gotoAndStop(7);
}
else if (yspeed < -5.000000E-001)
{
_root.hit = 0;
gotoAndStop(3);
}
else if (yspeed > 5.000000E-001)
{
_root.hit = 0;
gotoAndStop(4);
}
else if (xspeed < -1)
{
gotoAndStop(5);
}
else if (xspeed > 1)
{
gotoAndStop(2);
}
else if (xspeed > -1 && xspeed < 1 && yspeed > -1 && yspeed < 1)
{
gotoAndStop(1);
} // end else if
setProperty("", _y, _y + yspeed);
setProperty("", _x, _x + xspeed);
yspeed = yspeed + gravity;
if (_root.hit == 1)
{
if (xspeed < 0)
{
xspeed = xspeed + friction;
} // end if
if (xspeed > 0)
{
xspeed = xspeed - friction;
} // end if
if (Key.isDown(32))
{
yspeed = yspeed - jumppower;
_root.hit = 0;
}
else if (Key.isDown(38))
{
yspeed = yspeed - jumppower;
_root.hit = 0;
} // end else if
if (Key.isDown(37))
{
xspeed = xspeed - acceleration;
} // end if
if (Key.isDown(39))
{
xspeed = xspeed + acceleration;
} // end if
} // end if
}
if you wanna download the source to scan for more errorsSouce
This screams "decompiled". Try actually writing your own code, you will find that you will have a better chance of understanding it then.
At 1/27/10 04:45 AM, henke37 wrote: This screams "decompiled". Try actually writing your own code, you will find that you will have a better chance of understanding it then.
it wasnt it was from a tut
At 1/27/10 10:30 AM, wobbier wrote: it wasnt it was from a copy-and-paste
corrected
You see, thats your problem. Copy and pasting is gonna get you no where. Learn code
At 1/27/10 11:03 AM, Yambanshee wrote:At 1/27/10 10:30 AM, wobbier wrote: it wasnt it was from a copy-and-pastecorrected
You see, thats your problem. Copy and pasting is gonna get you no where. Learn code
thats the problem i cant find a legit code tut i always find crap. link for good tuts?
At 1/27/10 02:33 PM, HDXmike wrote:At 1/27/10 02:06 PM, wobbier wrote:Jesus , you dont fucking LEARN FROM FUCKING TUTS , you cant just get knowledge implanted in your brain for fucks sake , he said LEARN , tutorials should only be used for small code problems/solutions , the only way you could end up with that code is from typing into google "How to make a flash game " or something similarly vague. Ive taken 2 tutorials in my entire life , 1 for the scribble cel and one for complex buttons when i first started flash , then i learned everything myself and with the OCCASIONAL help from the NG forums , adobe has written mountains of help for you and a huige index to explore make use of itAt 1/27/10 11:03 AM, Yambanshee wrote:thats the problem i cant find a legit code tut i always find crap. link for good tuts?At 1/27/10 10:30 AM, wobbier wrote: it wasnt it was from a copy-and-pastecorrected
You see, thats your problem. Copy and pasting is gonna get you no where. Learn code
</semiflame>
I blame yambanshee for being so right
calm down you cant learn if you dont take a tutorial adobe wrote a tutorial cause it shows you how to do it so dont say you just learned flash somehow you've definately read tuts or you wouldnt be as good as you were now.
ive never read ur code at all but my style of making platformers is kind of like that.. and i call that "glitch" the friction not a factor of acceleration.. imagine ur current velocity is now 5 and ur friction is 2... i
frame 1: xvel=5;
frame 2: xvel=3;
frame 3: xvel=1;
frame 4: xvel=-1; //this is where the glitch starts
frame 5: xvel=1; // and it keeps looping here on out
if(xvel<0){
xvel+=frc;
}else if(xvel>0){
xvel-=frc;
}
due to the friction not being a factor of the xvel. u tend to move when ur xvel is close to 0. which direction depends.. if u put xvel>0 check last it will be moving left xvel<0 check last it will be moving right.
to fix the glitch add in a"speed balancer" as i call it... it detects that the velocity is within that range and then assign it to 0
if(xvel>-friction&&xvel<friction){
xvel=0;
}
this way once the xvel falls below friction value.. which means it will glitch.. the code will assign xvel to 0 hence stops moving. =D
in this way, once ur