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
|
ud <- getAffection
|
||||||
-- let newPart = updateParticles sec partUpd $ particles ud
|
-- let newPart = updateParticles sec partUpd $ particles ud
|
||||||
-- putAffection $ ud { particles = newPart }
|
-- putAffection $ ud { particles = newPart }
|
||||||
nps <- updateParticleSystem (partsys ud) sec partUpd partDraw
|
|
||||||
putAffection $ ud { partsys = nps }
|
|
||||||
traceM $ (show $ 1 / sec) ++ " FPS"
|
traceM $ (show $ 1 / sec) ++ " FPS"
|
||||||
ev <- liftIO $ SDL.pollEvents
|
ev <- liftIO $ SDL.pollEvents
|
||||||
mapM_ (\e ->
|
mapM_ (\e ->
|
||||||
|
@ -111,8 +109,8 @@ update sec = do
|
||||||
vx <- liftIO $ randomRIO (-20, 20)
|
vx <- liftIO $ randomRIO (-20, 20)
|
||||||
vy <- liftIO $ randomRIO (-20, 20)
|
vy <- liftIO $ randomRIO (-20, 20)
|
||||||
life <- liftIO $ randomRIO (1, 5)
|
life <- liftIO $ randomRIO (1, 5)
|
||||||
traceM $ "position is: " ++ show x ++ " " ++ show y
|
-- traceM $ "position is: " ++ show x ++ " " ++ show y
|
||||||
traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
|
-- traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
|
||||||
putAffection $ ud
|
putAffection $ ud
|
||||||
{ coordinates = Just (fromIntegral x, fromIntegral y)
|
{ coordinates = Just (fromIntegral x, fromIntegral y)
|
||||||
, partsys = (partsys ud)
|
, partsys = (partsys ud)
|
||||||
|
@ -135,6 +133,9 @@ update sec = do
|
||||||
_ ->
|
_ ->
|
||||||
return ()
|
return ()
|
||||||
) ev
|
) ev
|
||||||
|
ud2 <- getAffection
|
||||||
|
nps <- updateParticleSystem (partsys ud2) sec partUpd partDraw
|
||||||
|
putAffection $ ud2 { partsys = nps }
|
||||||
|
|
||||||
clean :: UserData -> IO ()
|
clean :: UserData -> IO ()
|
||||||
clean _ = return ()
|
clean _ = return ()
|
||||||
|
|
Loading…
Reference in a new issue