Re: Generate non-overlapping objects

Posted:
Thu Jan 31, 2013 7:19 pm
by lverona
Works. Thank you very much for responding in such detail!
Re: Generate non-overlapping objects

Posted:
Thu Jan 31, 2013 8:21 pm
by lverona
One more clarification, to understand how gE works here.
In this code:
- Code: Select all
if(CollisionFree(ball.clonename, ball.x, ball.y+5)
does gE understand that ball.x is really ball.clonename.x?
Re: Generate non-overlapping objects

Posted:
Thu Jan 31, 2013 9:34 pm
by skydereign
Yes, but ball.clonename is just a string variable. So, it really isn't ball.clonename.x, since a string isn't a struct, and doesn't have a x variable. But, just for the same reason ball.clonename gets you the correct clonename, ball.x will get you the x of the same clone.
Using an actor's name to get variables (for instance ball.clonename) uses gE's default actor struct. In most cases, that default struct will be equal to the struct of the lowest cloneindexed actor of that name. So, ball.clonename will usually be ball.0 (or ball.n, n being the lowest cloneindex of the ball actor). But, CreateActor will update the default struct to be equal to the highest indexed clone (since a newly created clone will always be the highest indexed). This is what you are using. So the struct can never point at multiple different clones.
Re: Generate non-overlapping objects

Posted:
Fri Feb 01, 2013 5:38 am
by lverona
Wow, this is some sophisticated stuff! And very useful knowledge. I should probably write a simple tutorial on this, because this is super useful stuff, being able to address latest created clone.