Yet another random spawn without override question
frario
Member Posts: 164
Hello everyone,
I know this has been asked before, but I want 6 cards to spawn in a random one of 6 places of a grid on the left of my my scene, without overriding.
I see there are several solutions. But before moving to another one, I really need to understand why mine doesn't work
So, here's what I did:
I have 6 actors, called "mover 1", "mover 2" etc.
And I have 6 others called "selection 1", "selection 2" etc. These are tagged as "selections"
What "mover 2" for example, does, is:
if game.Placed2 is false
- change self.Position.X to [(random(1,2)*98)-46]
- change self.Position.Y to [(random(1,3)*98)-46]
- if overlaps with actor tagged "selections"
-- spawn actor "mover 2" */* in a unique position, es 300,100
-- destroy this actor
-- otherwise:
---- change game.Placed2 to 1
---- spawn actor "selection 2" 500px on the right
---- destroy this actor
What "selections" do is:
load an image
move 500px to the left
This looks good, but is sick.
SYMPTOMS:
The result is that a random number of "selection" is spawned (always from 3 to 6).
Rarely the movers don't even disappear, and stay behind the "selections".
I spent one day on this, before asking. I hate when I can't figure out things
Any advice would be appreciated.
I know this has been asked before, but I want 6 cards to spawn in a random one of 6 places of a grid on the left of my my scene, without overriding.
I see there are several solutions. But before moving to another one, I really need to understand why mine doesn't work
So, here's what I did:
I have 6 actors, called "mover 1", "mover 2" etc.
And I have 6 others called "selection 1", "selection 2" etc. These are tagged as "selections"
What "mover 2" for example, does, is:
if game.Placed2 is false
- change self.Position.X to [(random(1,2)*98)-46]
- change self.Position.Y to [(random(1,3)*98)-46]
- if overlaps with actor tagged "selections"
-- spawn actor "mover 2" */* in a unique position, es 300,100
-- destroy this actor
-- otherwise:
---- change game.Placed2 to 1
---- spawn actor "selection 2" 500px on the right
---- destroy this actor
What "selections" do is:
load an image
move 500px to the left
This looks good, but is sick.
SYMPTOMS:
The result is that a random number of "selection" is spawned (always from 3 to 6).
Rarely the movers don't even disappear, and stay behind the "selections".
I spent one day on this, before asking. I hate when I can't figure out things
Any advice would be appreciated.