Fix remote projectile direction control
This commit is contained in:
@@ -99,7 +99,7 @@ upProjectile pu pj = case pu of
|
|||||||
PJShellCollisionCheck -> updateShell pj
|
PJShellCollisionCheck -> updateShell pj
|
||||||
PJDecTimMvVel -> decTimMvVel pj
|
PJDecTimMvVel -> decTimMvVel pj
|
||||||
PJThrust st et
|
PJThrust st et
|
||||||
| act st et -> doThrust' pj
|
| act st et -> doThrust pj
|
||||||
| otherwise -> id
|
| otherwise -> id
|
||||||
PJSpin t cid spinamount
|
PJSpin t cid spinamount
|
||||||
| ain t -> trySpinByCID' cid spinamount pj
|
| ain t -> trySpinByCID' cid spinamount pj
|
||||||
@@ -129,18 +129,19 @@ retireRemoteProj'' itid pjid w =
|
|||||||
& cWorld . props %~ IM.delete pjid
|
& cWorld . props %~ IM.delete pjid
|
||||||
|
|
||||||
setRemoteDir :: Int -> Int -> Proj -> World -> World
|
setRemoteDir :: Int -> Int -> Proj -> World -> World
|
||||||
setRemoteDir cid itid pj w = w & cWorld . projectiles . ix (_prjID pj) . prjDir .~ newdir
|
setRemoteDir cid itid pj w = w & cWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir
|
||||||
where
|
where
|
||||||
|
turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir
|
||||||
--i = _prjID pj
|
--i = _prjID pj
|
||||||
newdir
|
newdir
|
||||||
| SDL.ButtonRight `M.member` _mouseButtons w
|
| SDL.ButtonRight `M.member` _mouseButtons w
|
||||||
&& w ^? cWorld . creatures . ix cid . crInvSel . iselPos
|
-- && w ^? cWorld . creatures . ix cid . crInvSel . iselPos
|
||||||
== w ^? cWorld . itemLocations . ix itid . ipInvID =
|
-- == w ^? cWorld . itemLocations . ix itid . ipInvID
|
||||||
_cameraRot (_cWorld w) + argV (_mousePos w)
|
= _cameraRot (_cWorld w) + argV (_mousePos w)
|
||||||
| otherwise = _prjDir pj
|
| otherwise = _prjDir pj
|
||||||
|
|
||||||
doThrust' :: Proj -> World -> World
|
doThrust :: Proj -> World -> World
|
||||||
doThrust' pj w =
|
doThrust pj w =
|
||||||
w
|
w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& cWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
|
& cWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
|
||||||
|
|||||||
Reference in New Issue
Block a user