mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-05-28 23:41:31 +00:00
changed namespace phys to physics
This commit is contained in:
parent
faee52fcd8
commit
7afb653f38
|
@ -1,4 +1,4 @@
|
|||
(ns robotwar.phys)
|
||||
(ns robotwar.physics)
|
||||
|
||||
; trig functions
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
(:use [robotwar.constants])
|
||||
(:require [robotwar.brain :as brain]
|
||||
[robotwar.register :as register]
|
||||
[robotwar.phys :as phys]))
|
||||
[robotwar.physics :as physics]))
|
||||
|
||||
; TODO: deal with bumping into walls and other robots.
|
||||
|
||||
|
@ -27,13 +27,13 @@
|
|||
[{:keys [pos-x pos-y v-x v-y desired-v-x desired-v-y] :as robot}]
|
||||
(let [max-accel-x (if (neg? desired-v-x) (- MAX-ACCEL) MAX-ACCEL)
|
||||
max-accel-y (if (neg? desired-v-y) (- MAX-ACCEL) MAX-ACCEL)
|
||||
{new-pos-x :d, new-v-x :v} (phys/d-and-v-given-desired-v
|
||||
{new-pos-x :d, new-v-x :v} (physics/d-and-v-given-desired-v
|
||||
pos-x
|
||||
v-x
|
||||
desired-v-x
|
||||
max-accel-x
|
||||
*GAME-SECONDS-PER-TICK*)
|
||||
{new-pos-y :d, new-v-y :v} (phys/d-and-v-given-desired-v
|
||||
{new-pos-y :d, new-v-y :v} (physics/d-and-v-given-desired-v
|
||||
pos-y
|
||||
v-y
|
||||
desired-v-y
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(ns robotwar.shell
|
||||
(:use [robotwar.constants])
|
||||
(:require [robotwar.phys :as phys]))
|
||||
(:require [robotwar.physics :as physics]))
|
||||
|
||||
(defn init-shell
|
||||
[pos-x pos-y aim distance]
|
||||
; TODO: make the starting point dependent upon the robot radius,
|
||||
; which should be in constants.
|
||||
(let [{unit-x :x unit-y :y} (phys/decompose-angle (phys/deg->rad aim))]
|
||||
(let [{unit-x :x unit-y :y} (physics/decompose-angle (physics/deg->rad aim))]
|
||||
{:pos-x pos-x
|
||||
:pos-y pos-y
|
||||
:v-x (* unit-x SHELL-SPEED)
|
||||
|
|
Loading…
Reference in New Issue
Block a user