Programming Explorer
  • Blog
  • About
  • Contact

A Blended Approach to Event Handling

7/2/2015

0 Comments

 
Picture
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.

Picture
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.
0 Comments



Leave a Reply.

    Programming Explorer

    Computers and programming

    Archives

    July 2015

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.