swift - How to add SKShapeNode to random position until screen getting full -


i want add skshapenode random position, using sprite kit, until screen getting full.

how can find empty space in screen?

this not off shelf kind of function in sk. solution create hack want. 1 possible approach might create small node , place in various positions on screen, using loop. example (x,y position), 0,0 -> 4,0 -> 8,0 , on...

you can use func intersectsnode(_ node: sknode) -> bool see if node intersects other node.

another approach might use same kind of logic use func containspoint(_ p: cgpoint) -> bool instead.

both approaches processor intensive should run them sparingly.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -