I made a simple example-game for practice. Everything worked fine with
global containers like heroes-container or pickups-container (refs). They
were working in global agents. But now I need to run several game instances
at the same time, so I need Game class with its own "global variables"
This is the class and definition:
(defrecord Game [heroes-container
pickups-container
bullets-container
movement-agent
behavior-agent
pickuping-agent
bullets-agent
finish-check-agent
display-agent
game-speed
finished?])
(defn start-new-game [display?]
(let [game (Game. (ref []) (ref []) (ref [])
(agent nil) (agent nil) (agent nil) (agent nil) (agent
nil) (agent nil)
(if display? 1 5)
(atom false))]
...
continue in the next post...
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.