Question: java fx Create a program where a character walks back and forth across the screen. When the character walks to the right he walks at
Create a program where a character walks back and forth across the screen. When the character walks to the right he walks at two different speeds the first half of the screen he walks at 5 pixels per frame and the second half he walks at 3 pixels per frame. On the way back to the left, he walks the whole way at 4 pixels per frame; the whole process should repeat. Let's assume that we have defined the following three states for a Finite State Machine, fill in the code for the switch statement in the update () method. Your code should make appropriate changes to the character's position and the state. You can assume the character is walking between pixels 0 and 400 and that the current x position of the character is given in the variable character_x. switch (state) { case Rl: case R2: case L: }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
