XXXconanXXX
Cocktails anyone?
- Reaction score
- 284
Been stuck on this and I can't figure out how to get the character to hit the block, and still be able to move after he hits it.
Here's the code for the move method:
nx and nx2 scroll the background, Left is to make sure the char can't go back to previous areas of the level.
Problem is, when I check for as long as the character's X isn't the same as the block's X, move() he'll get stuck when he hits the block and is not able to move. Very frustrating. Any ideas?
Here's the code for the move method:
Code:
public void move() {
if (dx != -1 ) {
if (Left + dx <= 150) {
Left = Left + dx;
} else {
x = x + dx;
nx2 = nx2 + dx;
nx = nx + dx;
}
} else if(Left + dx > 0) {
Left = Left + dx;
}
}
nx and nx2 scroll the background, Left is to make sure the char can't go back to previous areas of the level.
Problem is, when I check for as long as the character's X isn't the same as the block's X, move() he'll get stuck when he hits the block and is not able to move. Very frustrating. Any ideas?