#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# actors that are generated in the same position ?

Posts: 81Member

hi guys my question is this I have two actors using spawn with random de position, the problem is that Cruzen not want to be in the same position and also want to put that when aparescan do at a certain distance from each other.

• Posts: 11,408Member, Sous Chef, PRO, Senior Sous-Chef

You want two actors to spawn at a certain distance from each other, but in a random location?

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 81Member

@tatiang said:
You want two actors to spawn at a certain distance from each other, but in a random location?

if when shown both at the same time aparescan not glued but at a distance that I decide

• Posts: 1,165Member
edited August 2016

i think you want what tiatang is describing.

• Posts: 11,408Member, Sous Chef, PRO, Senior Sous-Chef
edited August 2016

I don't know what "aparescan" means so I'm having trouble understanding your sentence. I assume it was a Google Translate term but even Google doesn't seem to know. :P

But if you need to keep two spawned actors apart from each other, I would spawn one actor and then have it spawn the second actor at a certain distance away from itself. You'd need to worry about scene edges but other than that it's not complicated.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 11,408Member, Sous Chef, PRO, Senior Sous-Chef
edited August 2016

Here's an example:

Edit: forgot the Y value... it should also be (random(0,1) * 2-1) * 50 where 50 is the distance. And, um, this doesn't work. I was shooting for a circular area of spawning but it just does four corners. FRIDAY BRAIN!

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 81Member

@tatiang said:
Here's an example:

Edit: forgot the Y value... it should also be (random(0,1) * 2-1) * 50 where 50 is the distance. And, um, this doesn't work. I was shooting for a circular area of spawning but it just does four corners. FRIDAY BRAIN!

• Posts: 11,408Member, Sous Chef, PRO, Senior Sous-Chef

What have you tried?

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 81Member

@tatiang said:
What have you tried?

try what you put did not work and I did not know if bad as I can do

• Posts: 81Member

• ImagineLabs.rocks Posts: 5,445Member, BASIC
edited September 2016

How about checking for a collision between the two objects once they are spawned. If one is colliding with the other destroy that actor and spawn it in a new spot.

• London, UK.Posts: 12,821Member
edited September 2016

@tatiang said:
And, um, this doesn't work. I was shooting for a circular area of spawning but it just does four corners. FRIDAY BRAIN!

You could spawn in a circular area with

Change R to random (0,100)
Change A to random (0,360)
Spawn at:
X = R * cos(A)
Y = R * sin(A)

Although this would be a radial random distribution (is that even a term ?), by that I mean the spawning would be equally distributed along 'lines' leading from the centre to the edge, which necessarily means there will be a bias towards being spawned nearer the centre (where the 'lines' are closer) - you could do a genuinely circular area spawn, but I can't be bothered to do the maths right now

• Posts: 11,408Member, Sous Chef, PRO, Senior Sous-Chef

@Socks said:
a radial random distribution (is that even a term ?)

It is now.

Thanks for coming to the rescue!

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 81Member

@Socks said:

@tatiang said:
And, um, this doesn't work. I was shooting for a circular area of spawning but it just does four corners. FRIDAY BRAIN!

You could spawn in a circular area with

Change R to random (0,100)
Change A to random (0,360)
Spawn at:
X = Rcos(A)
Y = R
sin(A)

Although this would be a radial random distribution (is that even a term ?), by that I mean the spawning would be equally distributed along 'lines' leading from the centre to the edge, which necessarily means there will be a bias towards being spawned nearer the centre (where the 'lines' are closer) - you could do a genuinely circular area spawn, but I can't be bothered to do the maths right now

thanks guys I try

• London, UK.Posts: 12,821Member
edited September 2016

@SoAGAMES said:
thanks guys I try

The forum formatting screws up posts with '*' in them . . . .

Change R to random (0,100)
Change A to random (0,360)
Spawn at:
X = R * cos(A)
Y = R * sin(A)

Note:

A = Angle

• Posts: 81Member
edited September 2016

@Socks said:

@SoAGAMES said:
thanks guys I try

The forum formatting screws up posts with '*' in them . . . .

Change R to random (0,100)
Change A to random (0,360)
Spawn at:
X = R * cos(A)
Y = R * sin(A)

Note:

A = Angle

excuse my ignorance Radius and angle are attributes real ? where the meeting

• Posts: 387Member, PRO
edited September 2016

DELETED // Ignore this non-thought out answer and see below

• London, UK.Posts: 12,821Member
edited September 2016

@SoAGAMES said:
excuse my ignorance Radius and angle are attributes real ?

The Random function only generates integers, you can use 'real' attributes if you want, it's your choice.

If you want 'real' values then you can do this . . . .

Change R to random (0,100000)/1000
Change A to random (0,360000)/1000

For example 188695/100 = 188.695

• London, UK.Posts: 12,821Member
edited September 2016

@NNterprises said:
Yes do real for best precision

The random function only generates integers (see my post above).

P.S metaphysical question of the day, what does 'precision' mean in the context of generating a random value

• Posts: 387Member, PRO

@Socks said:
P.S metaphysical question of the day, what does 'precision' mean in the context of generating a random value

Lol yea true... I saw angles and radius and moving in a circle and just kinda jumped in with a bad answer.
Shhh just act like I was never here....

• London, UK.Posts: 12,821Member

@NNterprises said:
Lol yea true... I saw angles and radius and moving in a circle and just kinda jumped in with a bad answer.
Shhh just act like I was never here....

• Posts: 81Member

@Socks said:

@NNterprises said:
Lol yea true... I saw angles and radius and moving in a circle and just kinda jumped in with a bad answer.
Shhh just act like I was never here....

friend enlighten me a little two actors have one enemy and another coin as I apply the rule that you gave me to not Cruzen when aparescan by random spawn timer

• London, UK.Posts: 12,821Member
edited September 2016

//

• Posts: 81Member

@Socks said:
//

can you help me

• London, UK.Posts: 12,821Member

@SoAGAMES said:

@Socks said:
//

can you help me

I cannot help, your language is too difficult for me to understand, perhaps if English is not your first language you could express your ideas with drawings/images ? They often work really well and break down language barriers.

• Posts: 81Member

@Socks said:

@SoAGAMES said:

@Socks said:
//

can you help me

I cannot help, your language is too difficult for me to understand, perhaps if English is not your first language you could express your ideas with drawings/images ? They often work really well and break down language barriers.

I do like the game of jetpack joyride that actors are generated randomly coins do not intersect with laser

• Posts: 81Member

@Socks said:

@SoAGAMES said:

@Socks said:
//

can you help me

I cannot help, your language is too difficult for me to understand, perhaps if English is not your first language you could express your ideas with drawings/images ? They often work really well and break down language barriers.