restructuring
This commit is contained in:
parent
3d9af3eaf8
commit
ae38902d9c
|
@ -91,11 +91,7 @@ instance Actor Pituicat where
|
||||||
lerp (min 0.95 (59 * dt)) (pcMoveVel physCat) (pcTMoveVel physCat)
|
lerp (min 0.95 (59 * dt)) (pcMoveVel physCat) (pcTMoveVel physCat)
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
(A.log Debug (
|
finalCat
|
||||||
("being at " <> fromString (show $ position finalCat)) <>
|
|
||||||
("; moving with " <> fromString (show $ velocity finalCat))
|
|
||||||
)
|
|
||||||
) finalCat
|
|
||||||
|
|
||||||
instance Mass Pituicat where
|
instance Mass Pituicat where
|
||||||
|
|
||||||
|
@ -145,24 +141,26 @@ instance Collidible Pituicat where
|
||||||
|
|
||||||
collide cat _ NoCollision = cat
|
collide cat _ NoCollision = cat
|
||||||
collide cat other collr@(Collision ddt (V2 dirx diry)) =
|
collide cat other collr@(Collision ddt (V2 dirx diry)) =
|
||||||
A.log
|
let ncat = (elasticCollision 0.3 cat other collr)
|
||||||
Debug
|
vel@(V2 vx vy) = velocity cat
|
||||||
("*boing* meow! other: " <>
|
nvel@(V2 dx dy) = velocity ncat
|
||||||
fromString (show other))
|
grounded =
|
||||||
(
|
(dy * ddt) >= 0 &&
|
||||||
let ncat = (elasticCollision 0.3 cat other collr)
|
(dy * ddt) < 2 && diry == -1
|
||||||
nvel@(V2 dx dy) =
|
in
|
||||||
velocity ncat *
|
A.log
|
||||||
if dirx == 0
|
Debug
|
||||||
then V2 0 1
|
("*boing* meow! collision result: " <>
|
||||||
else V2 1 1
|
fromString (show collr) <>
|
||||||
grounded = (dy * ddt) <= 0 && (dy * ddt) > (-2) && diry == 0
|
"\nother: " <>
|
||||||
in
|
fromString (show other)
|
||||||
ncat
|
)
|
||||||
{ pcGrounded = grounded
|
(
|
||||||
, pcMoveVel = pcMoveVel ncat *
|
ncat
|
||||||
if dirx == 0
|
{ pcGrounded = grounded
|
||||||
then V2 0 1
|
, pcMoveVel = pcMoveVel ncat *
|
||||||
else V2 1 1
|
if dirx /= 0
|
||||||
}
|
then V2 0 1
|
||||||
)
|
else V2 1 1
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue