done getting player's projectiles to collide with enemies successfully, and tested (although the code of the enemy reacting to the player is not the best)
This commit is contained in:
18
fcore/projectile.sml
Normal file
18
fcore/projectile.sml
Normal file
@@ -0,0 +1,18 @@
|
||||
structure Projectile =
|
||||
struct
|
||||
fun helpGenerateTree (pos, projectiles, acc) =
|
||||
if pos = Vector.length projectiles then
|
||||
acc
|
||||
else
|
||||
let
|
||||
val size = Player.defeatedSizeInt
|
||||
|
||||
val {x, y, facing = _} = Vector.sub (projectiles, pos)
|
||||
val acc = QuadTree.insert (x, y, size, size, 0, 0, 1920, 1080, pos, acc)
|
||||
in
|
||||
helpGenerateTree (pos + 1, projectiles, acc)
|
||||
end
|
||||
|
||||
fun generateTree projectiles =
|
||||
helpGenerateTree (0, projectiles, QuadTree.empty)
|
||||
end
|
||||
Reference in New Issue
Block a user