update particles after new ones come
This commit is contained in:
parent
55ae0bd32a
commit
a1b0b50b57
1 changed files with 5 additions and 4 deletions
|
@ -98,8 +98,6 @@ update sec = do
|
|||
ud <- getAffection
|
||||
-- let newPart = updateParticles sec partUpd $ particles ud
|
||||
-- putAffection $ ud { particles = newPart }
|
||||
nps <- updateParticleSystem (partsys ud) sec partUpd partDraw
|
||||
putAffection $ ud { partsys = nps }
|
||||
traceM $ (show $ 1 / sec) ++ " FPS"
|
||||
ev <- liftIO $ SDL.pollEvents
|
||||
mapM_ (\e ->
|
||||
|
@ -111,8 +109,8 @@ update sec = do
|
|||
vx <- liftIO $ randomRIO (-20, 20)
|
||||
vy <- liftIO $ randomRIO (-20, 20)
|
||||
life <- liftIO $ randomRIO (1, 5)
|
||||
traceM $ "position is: " ++ show x ++ " " ++ show y
|
||||
traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
|
||||
-- traceM $ "position is: " ++ show x ++ " " ++ show y
|
||||
-- traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
|
||||
putAffection $ ud
|
||||
{ coordinates = Just (fromIntegral x, fromIntegral y)
|
||||
, partsys = (partsys ud)
|
||||
|
@ -135,6 +133,9 @@ update sec = do
|
|||
_ ->
|
||||
return ()
|
||||
) ev
|
||||
ud2 <- getAffection
|
||||
nps <- updateParticleSystem (partsys ud2) sec partUpd partDraw
|
||||
putAffection $ ud2 { partsys = nps }
|
||||
|
||||
clean :: UserData -> IO ()
|
||||
clean _ = return ()
|
||||
|
|
Loading…
Reference in a new issue