spawn actor at certain place?
EpicoreGames
Member Posts: 188
May i know is it possible to make my actor to spawn at the place that i want like at the middle of the screen but random x position ?
Comments
Sure. In the Spawn Actor behavior, put in x=random(0,1024) or whatever values you want for the size of the scene and y=768/2 or half of whatever your scene height is.
Since actor positions are determined by their centers, you may want to do something like random(0+[widthOfActor/2],1024-[widthOfActor/2]).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok thank you . But I have another question now . Can I spawn my actor at any 8 different places that I want ?
Like first place x = 60 and y= 70 ( example )
And I set 8 places like that how can I let my actor to spawn randomly at that 8 places ?
Here's a demo that does that although you'd have to randomize which row is picked:
http://forums.gamesalad.com/discussion/comment/383521/#Comment_383521
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok thank you so much I'll look at it later
@tatiang i am confused with your example
what does tableCellValue(game.|T| Positions, self.SpawnRowID mean in the " Set x from table" tab?
and why set self.SpawnRowID to game.RowCounter? what does they mean and do in the game?
i try to do it myself and i can't get it to work
this is my table:
http://postimg.org/image/kybr7x1rb/
this is what i add to the prototype:
http://postimg.org/image/6ie2i0xpf/
when i run it , it just jumps to that location and won't change the location again:
http://postimg.org/image/citpmsd09/
the full change attribute tab :
tableCellValue(game.Spawn Location, random(1,8) column)
whats wrong with it ?