thanks Matt, we've tried that and its not working. Ill explain in more detail.
We have a series of random objects spawning from the right side of the screen and moving across to the left. Those objects speed increases based on the score of the game.
What we want to do is determine the distance between the last object to spawn and the spawn point, so that when the object has moved a certain distance it will spawn another. Keeping the distance between all objects equal despite the increasing speed.
Create the following attributes: SpawnX - Real - Make it the X position of where you spawn SpawnY - Real - Make it the Y position of where you spawn DistanceFrom- Real Last - Text
Put in all your actors that are spawned: Attribute - Boolean - "Last"
Change attribute - self.name to random(1,9999) Change attribute - game.Last to self.name Rule: If self.name = game.Last, change self.Last to true. Rule: If self.Last is true, Constrain Attribute game.DistanceFrom to magnitude(self.position.x-game.SpawnX, self.position.Y-game.SpawnY) Rule: If game.DistanceFrom < X (make it a number lol) spawn actor
Enjoy
________________________________ 1 On 1 Project Help - Matthewredler@gmail.com
I put that in, but I can't check if self.name = game.last, because they are text variables. Also, GS seems to crash when I try to run it with this code.
No luck at all, unfortunately. We have another method of doing this but it's a bit messy, worst comes to worst we will just use that. Thanks for your help though, it's really appreciated.
for the determining of if the object is last I would try putting in a game attribute integer set at zero and each actor has rules in that add 1 to that integer then taking game attribute integer number as a self ID in a self integer attribute. Then check to see if their self number is less than the game integer, and (in another rule) equal to,and so know they were the last actor and with the first rule will update themselves if they fall out of being last.
the second aspect of your question would be to add 1 more self number attribute and a boolean for checking of the spawning. On birth put self position x into the new x self attribute, and then run a rule that says then when boolean is false, and the coordinates are greater than the stored x + whatever, then spawn and change the boolean to true.
Comments
Change attribute: game.recent to self.name
This way, when you spawn new actors that attribute will automatically become their name.
Matt
We have a series of random objects spawning from the right side of the screen and moving across to the left. Those objects speed increases based on the score of the game.
What we want to do is determine the distance between the last object to spawn and the spawn point, so that when the object has moved a certain distance it will spawn another. Keeping the distance between all objects equal despite the increasing speed.
Is that possible??
Interesting and possible
Okay first
Create the following attributes:
SpawnX - Real - Make it the X position of where you spawn
SpawnY - Real - Make it the Y position of where you spawn
DistanceFrom- Real
Last - Text
Put in all your actors that are spawned:
Attribute - Boolean - "Last"
Change attribute - self.name to random(1,9999)
Change attribute - game.Last to self.name
Rule: If self.name = game.Last, change self.Last to true.
Rule: If self.Last is true, Constrain Attribute game.DistanceFrom to magnitude(self.position.x-game.SpawnX, self.position.Y-game.SpawnY)
Rule: If game.DistanceFrom < X (make it a number lol) spawn actor
Enjoy
________________________________
1 On 1 Project Help - Matthewredler@gmail.com
Matt
Matt
Matt
Matt
I've tested it and it seems to work
http://imageshack.us/photo/my-images/16/lastactor.png/
the second aspect of your question would be to add 1 more self number attribute and a boolean for checking of the spawning. On birth put self position x into the new x self attribute, and then run a rule that says then when boolean is false, and the coordinates are greater than the stored x + whatever, then spawn and change the boolean to true.