src/clojurecraft/actions.clj @ c242e7b1f58c
Oh man. We can now move.
author |
Steve Losh <steve@stevelosh.com> |
date |
Tue, 05 Jul 2011 20:57:11 -0400 |
parents |
580584e8bfbd |
children |
cc621ecb4d27 |
(ns clojurecraft.actions
(:use [clojurecraft.util]))
(defn move [bot x-change y-change z-change]
(let [player (:player bot)]
(dosync
(let [location (:location @player)
new-location (merge location
{:x (+ x-change (:x location))
:y (+ y-change (:y location))
:z (+ z-change (:z location))})]
(alter player merge {:location new-location}))))
bot)