actors that are generated in the same position ?
SoAGAMES
Member Posts: 81
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.
Comments
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
if when shown both at the same time aparescan not glued but at a distance that I decide
i think you want what tiatang is describing.
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
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
then what is the way to do what I ask please help
What have you tried?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
try what you put did not work and I did not know if bad as I can do
please someone help me
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.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
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
It is now.
Thanks for coming to the rescue!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
thanks guys I try
The forum formatting screws up posts with '*' in them . . . .
So, the rules should read:
Change R to random (0,100)
Change A to random (0,360)
Spawn at:
X = R * cos(A)
Y = R * sin(A)
Note:
R = Radius
A = Angle
excuse my ignorance Radius and angle are attributes real ? where the meeting
DELETED // Ignore this non-thought out answer and see below
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
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
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
//
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
please someone help me
My best guess is that the coins and lasers in jetpack joyride are not actually completely random.
One way to do it is to have many preset scenarios of where the coin items spawn and the laser items spawn
Then randomly choose those scenarios
www.rossmanbrosgames.com