Rotation and spawning
markfirman
Member, BASIC Posts: 18
Hello I'm having some trouble.. I'm trying to spawn a new actor that can appear anywhere OFF screen. So it can be spawned to the left, top, right or bottom of the scene ready to be moved in. I've tried using the random function with the spawn actor behaviour but I cannot work out a formula to make this work properly - could someone help?
Also, When I've spawned the actor I want to constrain the rotation of the actor so that it essentially points towards the center of the screen - is this possible?
Thanks
Comments
Here's a rough example, assuming iPhone Landscape and not taking into account half actor widths for scene edges:
Change Attribute self.randomChoice to random(1,4)
When Attribute self.randomChoice=1
Spawn Actor [actorName] [x=random(0,320)] [y=618] relative to scene
When Attribute self.randomChoice=2
Spawn Actor [actorName] [x=-50] [y=random(0,568)] relative to scene
When Attribute self.randomChoice=3
Spawn Actor [actorName] [x=random(0,320)] [y=-50] relative to scene
When Attribute self.randomChoice=4
Spawn Actor [actorName] [x=370] [y=random(0,568)] relative to scene
And for the spawned actor:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
That was very helpful, thanks