Curious about a method

ChiselbrainChiselbrain Member Posts: 25
edited November -1 in Working with GS (Mac)
I know how to create spawn points and make an actor choose one of them randomly when spawning. I'm wondering about another method, if it would work I should say.

Let's say you have a maze made out of wall actors and you want to spawn an object anywhere in the maze, but not on top of a wall actor.

Spawn actor in random x, random y location
Check if actor overlaps wall actor
If yes, delete actor and try spawning again
If no, done spawning

Though simple enough written is pseudo code, I can't seem to get gamesalad to do this. I can't find a "loop" type of behavior.

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    I would find the center of an open paths location, up or down, and spawn an actor to a specific x, or y location, depending if the pathway is going up or down. You can make it spawn randomly along that x, or y path.

    To do what you are saying so it spawns randomly somewhere in the maze, you would just need an attribute that turns on and off depending on the actors collision with the walls. If it's true, then interpolate to another random position. I don't know how well that will work since theoretically, you could be waiting for 10 seconds before it spawns in an open location.
  • ChiselbrainChiselbrain Member Posts: 25
    "I would find the center of an open paths location, up or down"

    Being a mechanical designer, I use Solidworks extensively to do my design work. What Solidworks does is dynamically display the X,Y coordinates of your mouse pointer position in the bottom middle right of the screen. It would be wonderful if GameSalad had a similar display for getting coordinate position when you want it. Also a grid that you could set the size of as well as position and be able to display it and turn snapping on and off .

    Lon
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    It's not the most efficient way, but you can drag an actor on the stage, and place it somewhere along one of the paths, and double click it, and over on the left, you can get the x and y position of that actor, and could use that info for the spawn location. And thinking about it, I bet you could make an actor that has rules to display the x, and y coordinates of the mouse pointers current position. That would be a cool custom behavior to have…

    As far as grids go, I don't know if you are familiar with Deep Blue's grid program. It doesn't have a snap function, but it will work with any program since it's an overlay, and you can customize it as well.

    http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./Screen_Grid.html
  • UtopianGamesUtopianGames Member Posts: 5,692
    Have you tried using a simple collide...if the actors spawns on top of the wall and has a collide with wall it should move to the nearest free space.

    Darren.
Sign In or Register to comment.