Student is in early stages of his game and is having trouble with his sprite. I am sorry, but I can’t figure out what is wrong with the code.
He wants the animation to appear to be walking to the right when the arrow is pressed and when it is not pressed then he wants the animation when it is just standing still. When the up arrow is pressed he wants the animation that is climbing and when it is not pressed then he wants it just standing still.
He has it set-up using the if-else statements. We have tried moving the set.animation blocks around that are in the else part but can’t seem to get it to work both ways.
@sarah.dudley This is a pretty cool implementation of code to change sprites based on keyboard input. I like how your student is thinking.
He is so close to getting it to work. Once I figured that it would only work with the first if/else block, I tried embedding the 2nd if/else block into the first one, so the code would check first if the alien is moving up and change the costume appropriately, but if not, the else condition was the 2nd if/else block and it immediately checked to see if the alien was moving right. and the 2nd else would give the alien the normal costume if neither condition was met.
Yes! Thank you!! The student will be very thankful that you were able to help us out. We had not tried putting the if statement inside the other if statement yet.