This site requires JavaScript, please enable it in your browser!
Greenfoot back
mcGreen
mcGreen wrote ...

2014/4/27

Error..

1
2
danpost danpost

2014/4/27

#
I would start by putting an 'else' at the beginning of line 46 of the Player class (as shown at the top of this discussion).
mcGreen mcGreen

2014/4/27

#
Could you please further elaborate? I dont understand what an "else" would do at this line
if (!Greenfoot.isKeyDown("left") && direction == -1)  
danpost danpost

2014/4/27

#
mcGreen wrote...
Could you please further elaborate? I dont understand what an "else" would do at this line
if (!Greenfoot.isKeyDown("left") && direction == -1)  
After looking at it again, I guess it will not help (as you are calling 'checkKeys' prior to 'checkDirection').
mcGreen mcGreen

2014/4/27

#
The problem is that the boolean "onGround" is false for one or two act-cycles while walking. I dont know why it is and if you do not either its not really that important. You really helped me here danpost
You need to login to post a reply.
1
2