Observer Pattern Thoughts, Concerns and Issues

Well so far I’ve tried to implement the build it from scratch observer pattern.  That is I am not using the built in java features and it is not going well.  I was trying to use it for collision dectection between my main character link and other objects which is currently just a key also located in the same room.  I built some interfaces one named observer and the other named subject so that they may be implemented accordingly just like out of the book.  From there I had my link_sprite class implement the subject interface and the my key class implemented the observer interface.  In my key class I pass in an instance of my subject object(link_sprite) and register it as an observer and all my code seems to be in the right places, but I am having trouble using functions in my key class within the driver as if it never really registers itself.  Anyway, my plan is to begin refactoring tonight and next time I am going to be using the built in Java features to utilize the observer pattern, so hopefully I will have it properly moled into my game very soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: