add asset for ChainEdge (attack)
This commit is contained in:
49
fcore/chain-edge.sml
Normal file
49
fcore/chain-edge.sml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
structure ChainEdgeRight =
|
||||||
|
struct
|
||||||
|
fun lerp (startX, startY, drawWidth, drawHeight, windowWidth, windowHeight, r, g, b) : Real32.real vector =
|
||||||
|
let
|
||||||
|
val endY = windowHeight - startY
|
||||||
|
val startY = windowHeight - (startY + drawHeight)
|
||||||
|
val endX = startX + drawWidth
|
||||||
|
val windowHeight = windowHeight / 2.0
|
||||||
|
val windowWidth = windowWidth / 2.0
|
||||||
|
in
|
||||||
|
#[ (((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.799999952316)) + (endY * 0.799999952316)) / windowHeight) - 1.0,
|
||||||
|
r, g, b,
|
||||||
|
|
||||||
|
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.200000017881)) + (endY * 0.200000017881)) / windowHeight) - 1.0,
|
||||||
|
r, g, b,
|
||||||
|
|
||||||
|
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.485714316368)) + (endY * 0.485714316368)) / windowHeight) - 1.0,
|
||||||
|
r, g, b
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
structure ChainEdgeLeft =
|
||||||
|
struct
|
||||||
|
fun lerp (startX, startY, drawWidth, drawHeight, windowWidth, windowHeight, r, g, b) : Real32.real vector =
|
||||||
|
let
|
||||||
|
val endY = windowHeight - startY
|
||||||
|
val startY = windowHeight - (startY + drawHeight)
|
||||||
|
val endX = startX + drawWidth
|
||||||
|
val windowHeight = windowHeight / 2.0
|
||||||
|
val windowWidth = windowWidth / 2.0
|
||||||
|
in
|
||||||
|
#[ (((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.799999952316)) + (endY * 0.799999952316)) / windowHeight) - 1.0,
|
||||||
|
r, g, b,
|
||||||
|
|
||||||
|
(((startX * (1.0 - 1.0)) + (endX * 1.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.200000017881)) + (endY * 0.200000017881)) / windowHeight) - 1.0,
|
||||||
|
r, g, b,
|
||||||
|
|
||||||
|
(((startX * (1.0 - 0.0)) + (endX * 0.0)) / windowWidth) - 1.0,
|
||||||
|
(((startY * (1.0 - 0.485714316368)) + (endY * 0.485714316368)) / windowHeight) - 1.0,
|
||||||
|
r, g, b
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -548,7 +548,7 @@ struct
|
|||||||
case #mainAttack player of
|
case #mainAttack player of
|
||||||
MAIN_ATTACKING {length, ...} =>
|
MAIN_ATTACKING {length, ...} =>
|
||||||
let
|
let
|
||||||
val {x, y, ...} = player
|
val {x, y, facing, ...} = player
|
||||||
val wratio = width / Constants.worldWidthReal
|
val wratio = width / Constants.worldWidthReal
|
||||||
val hratio = height / Constants.worldHeightReal
|
val hratio = height / Constants.worldHeightReal
|
||||||
val x =
|
val x =
|
||||||
@@ -573,18 +573,13 @@ struct
|
|||||||
val {charge, ...} = player
|
val {charge, ...} = player
|
||||||
val alpha = Real32.fromInt charge / 60.0
|
val alpha = Real32.fromInt charge / 60.0
|
||||||
in
|
in
|
||||||
Field.lerp
|
case facing of
|
||||||
( x
|
FACING_RIGHT =>
|
||||||
, y
|
ChainEdgeRight.lerp
|
||||||
, realLength
|
(x, y, realLength, realSize, width, height, 0.5, 0.5, 0.5)
|
||||||
, realSize
|
| FACING_LEFT =>
|
||||||
, width
|
ChainEdgeLeft.lerp
|
||||||
, height
|
(x, y, realLength, realSize, width, height, 0.5, 0.5, 0.5)
|
||||||
, 0.7
|
|
||||||
, 0.7
|
|
||||||
, 1.0
|
|
||||||
, alpha
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
@@ -603,18 +598,13 @@ struct
|
|||||||
val {charge, ...} = player
|
val {charge, ...} = player
|
||||||
val alpha = Real32.fromInt charge / 60.0
|
val alpha = Real32.fromInt charge / 60.0
|
||||||
in
|
in
|
||||||
Field.lerp
|
case facing of
|
||||||
( x
|
FACING_RIGHT =>
|
||||||
, y
|
ChainEdgeRight.lerp
|
||||||
, realLength
|
(x, y, realLength, realSize, width, height, 0.5, 0.5, 0.5)
|
||||||
, realSize
|
| FACING_LEFT =>
|
||||||
, width
|
ChainEdgeLeft.lerp
|
||||||
, height
|
(x, y, realLength, realSize, width, height, 0.5, 0.5, 0.5)
|
||||||
, 0.7
|
|
||||||
, 0.7
|
|
||||||
, 1.0
|
|
||||||
, alpha
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
| _ => Vector.fromList []
|
| _ => Vector.fromList []
|
||||||
|
|||||||
1
oms.mlb
1
oms.mlb
@@ -15,6 +15,7 @@ ann
|
|||||||
in
|
in
|
||||||
fcore/block.sml
|
fcore/block.sml
|
||||||
fcore/field.sml
|
fcore/field.sml
|
||||||
|
fcore/chain-edge.sml
|
||||||
end
|
end
|
||||||
|
|
||||||
fcore/wall.sml
|
fcore/wall.sml
|
||||||
|
|||||||
@@ -241,15 +241,14 @@ struct
|
|||||||
|
|
||||||
val wallVec = Wall.getDrawVec (#walls game, width, height)
|
val wallVec = Wall.getDrawVec (#walls game, width, height)
|
||||||
val platVec = Platform.getDrawVec (#platforms game, width, height)
|
val platVec = Platform.getDrawVec (#platforms game, width, height)
|
||||||
val wallVec = Vector.concat [wallVec, platVec]
|
val chainVec = Player.getFieldVec (#player game, width, height)
|
||||||
|
val wallVec = Vector.concat [wallVec, platVec, chainVec]
|
||||||
val fieldVec = Player.getFieldVec (#player game, width, height)
|
|
||||||
|
|
||||||
(* temp *)
|
(* temp *)
|
||||||
val pelletVec = Player.getPelletVec (#player game, width, height)
|
val pelletVec = Player.getPelletVec (#player game, width, height)
|
||||||
val projectileVec =
|
val projectileVec =
|
||||||
Projectile.getProjectileVec (#player game, width, height)
|
Projectile.getProjectileVec (#player game, width, height)
|
||||||
val fieldVec = Vector.concat [pelletVec, projectileVec, fieldVec]
|
val fieldVec = Vector.concat [pelletVec, projectileVec]
|
||||||
|
|
||||||
val shellState = uploadWall (shellState, wallVec)
|
val shellState = uploadWall (shellState, wallVec)
|
||||||
val shellState = uploadPlayer (shellState, playerVec)
|
val shellState = uploadPlayer (shellState, playerVec)
|
||||||
|
|||||||
Reference in New Issue
Block a user