Figure 1: A robust approach to event hadling
Combining the two approaches I mentioned in my earlier post fixed the issues I was having using only one or the other approach. Now the cat can move and jump without issues. This logic is very similar to the type used in all event handling, with the difference being that the forever loop is often implied rather than explicit, and the if statements may be switch statements instead for convenience. However, the logic stays the same.
Figure 2: The butterfly sprite recieves messages from the cat
I also used some message handlers to pass messages between the cat and butterfly sprites. Each time the cat moves left, right, or jumps, the butterfly sprite will detect and respond to the action in a different way.
I also used some message handlers to pass messages between the cat and butterfly sprites. Each time the cat moves left, right, or jumps, the butterfly sprite will detect and respond to the action in a different way.