The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.39 / 5.00 38,635 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 15,161 Viewshi folks hope your well, im having some trouble getting my player to actually walk rather then run
here is my code
if (Key.isDown(16) && xaccel<maxwlkaccel && falling == false) {
xaccel += walkaccelamt;
gwalking = true;
trace(gwalking);
} else {
gwalking = false;
trace(gwalking);
}
if (Key.isDown(Key.LEFT) && xaccel>-maxaccel && falling == false && gwalking == false) {
/*If the left arrow key is pressed and xaccel does not excede its maximum speed
and falling is false (not falling), then:*/
xaccel -= runaccelamt;
//xaccel minuses the amount set for runaccelamt
} else if (Key.isDown(Key.RIGHT) && xaccel<maxaccel && falling == false && gwalking == false) {
/*Otherwise if the right arrow key is pressed and xaccel does not excede its maximum speed
and falling is false (not falling), then:*/
xaccel += runaccelamt;
gwalking = false;
here are my vars
gravityaccel = .2;//The amount gravity accelerates by
runaccelamt = .3;//The amount the guy accelerates by when he runs
walkaccelamt = .1;
friction = .2;//The friction of the ground
airrisist = .05;//The risistance of the air
waterrisist = 1.5;//The risistance of the water
maxwlkaccel = 1;
maxaccel = 3;//The maximum speed the guy can run
maxjump = 5;//The maximum height the guy can jump
if shift is pressed and any of the directions then the player should walk rather then run, im not doing this right but cant find a solution, can any one help? thanks!
you forgot to declare your Boolean variables...
Kanye West Did What??????
They should make a black guy the manager, they know how to run shit!
2 Girls 1 Cup .... THE SONG!!!!
you also need to tell what needs to move... what's the instance of your player????
like.... player._x += 5;
would enable the player to move right at speed of five.
Kanye West Did What??????
They should make a black guy the manager, they know how to run shit!
2 Girls 1 Cup .... THE SONG!!!!
u mean like all the variables ? ive got them all, double checked them all
i have my movement code later on in the code, thats just what im showing you because thats the part ive tried to create for the walking
guy._y += gravity;//Move the guy's y posistion (up and down) according to gravity
guy._x += xaccel;//Move the guy's x posistion (left and right) accor
At 12/3/10 08:58 AM, SmallPete wrote: ping
The thing is that you do not need to declare variabels in AS2. For instance you can write "walking = false" and the compiler will automatically declare it as a bool. However, there could be many things that mess up the code, doesn't need to be the code itself. Make sure to know when to use global variables and how to access them; also, as someone already noticed, the instance names are important.
I am sorry, cant say whats right or wrong at this moment without looking at the construction of your program
Check out the coolest Donkey Kong Game on NG!
http://www.newgrounds.com/portal/vi ew/459064
100 posts @ Posted at: 9/15/08 07:36 AM http://www.newgrounds.com/bbs/topic /969232