Last active
August 29, 2015 14:25
-
-
Save timsgardner/10da9d05c4923ed06efb to your computer and use it in GitHub Desktop.
mappy late-bound component logic idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defcomponent ProtagonistDriver [logic] | |
(Update [this] | |
(when-let [f (:update logic)] | |
(f this))) | |
(OnCollisionEnter [this that] | |
(when-let [f (:on-collision-enter logic)] | |
(f this that)))) |
I like this a lot. What would the updating API be like? I guess you could
(set! (.. protagonist logic) new-map)
but a more map/record like interface would be awesome. Like
(assoc! protagonist :update new-fn)
The next question is where does state go? Is there a separate map? Do we just use fields?
I like where this is going.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thinking about ways to enable extremely malleable GameObject behavior, readily manipulable as persistent data. For things like the main character, which one wants to make very few assumptions about, and probably tweak the behavior of incrementally as the game progresses. Other ways of doing this, here's one.