Question: Java FX 3.(13 pts) I want to program a guard character that walks back and forth across the screen. When walking to the right he

 Java FX 3.(13 pts) I want to program a guard character

Java FX

3.(13 pts) I want to program a guard character that walks back and forth across the screen. When walking to the right he walks at two speeds - for the first half of the screen he walks at 4 pixels per frame, then, for the second half he walks at 2 pixels per frame. On the way back to the left, he walks the whole way at 5 pixels per frame. Then the whole thing repeats endlessly. Assuming 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 guard's position and the state. You can assume the guard is walking between pixels 0 and 400 and that the current x position of the guard is given in the variable guard_x. switch (state) { case RIGHT1: case RIGHT2: case LEFT: ]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!