Hack Forums
Trying to spawn sprites in random spots and make them fly across the screen. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: Trying to spawn sprites in random spots and make them fly across the screen. (/showthread.php?tid=4792392)



Trying to spawn sprites in random spots and make them fly across the screen. - Fυcĸleѕѕ - Apr 23, 2015

I want to spawn sprites in random x/x coordinates outside of the view, and when they spawn I want them to move across the screen. Here's the code I have already. I'm not sure how to start going about this at all. I've tried messing with CGPositon and couldn't figure it out.

code (Click to View)


* - gecco - Apr 24, 2015

What about giving each sprite a random velocity in X and Y and a random spawning position outside of the screen?