Hey Guys!
Thanks to the awesome PlasmaNapkin I was able to learn a few thing about "For Statements"
Now I've been experimenting with avoidance patterns a little bit. What I wanna do is to make cherries that fly off from the center of the screen, split intro even more cherries.
My Code looks something like this
STEPCOUNTER += 1
if STEPCOUNTER = 150
{
cherry = instance_create(x,y,deliciousFruit);
cherry.radius=100;
cherry.winkel=degtorad(i*36)
}
}
if (STEPCOUNTER >= 150)
{
for(i=0;i<10;i+=1)
{
cherry.x= center_x+cos(cherry.winkel) * cherry.radius
cherry.y= center_y+sin(cherry.winkel) * cherry.radius
cherry.winkel += 0.2;
cherry.radius -=2;
Again thanks to PlasmaNapkin. Also winkel means angle
Now at, lets say Step 180 I want all of the cherries to create new cherries that fly off from their individual origin position.
I was able get one of the cherries to creat new ones. But I want each of them to create a barrage.
Also I could make the first wave of cherries a different object wich then spawns the new cherries. But was wondering if there was a more efficient way of doing this.
Thanks in advance. I hope I explained it right :atkHappy:
Thank you so much for your help :atkHappy:
However I have a few more questions
My Code
STEPCOUNTER += 1;
if (STEPCOUNTER == 1)
{
for( i=0;i<10;i+=1)
{
a=instance_create(x,y,deliciousFruit);
a.speed = 2;
a.direction = (360/10)*i;
a.tag = 1;
}
}
//BAM!!
if (STEPCOUNTER == 50)
{
for(i=0;i<10;i+=1)
{
with(deliciousFruit)
{
if (tag == 1)
{
a=instance_create(x,y,deliciousFruit);
a.speed = 1;
a.direction = (360/10)*i;
a.tag = 2;
}
}
}
}
//Und zurück!
if (STEPCOUNTER == 100)
{
for(i=0;i<10;i+=1)
{
with(deliciousFruit)
{
if (tag == 2)
{
a=instance_create(x,y,deliciousFruit);
a.direction = 90
a.speed = 3;
a.tag = 3;
}
}
}
}
First Question: (Edit: ALSO NOW OBSOLET)
What happens now is, there are 10 Cherries flying off in a circle shape.
Then at Frame 50 I want each of the Cherries to make 10 new cherries fly into 10 different directions (another circle shape) from the current position of the first wave of cherries. What happens now is they just fly to the right. (I guess I'm still missing out on something) EDIT: Yeah I just needed to move the "for Statement" below the "with" and "if" statement. Thank you brain for actually trying to understand what all this code translates to :atkHappy:
Second Question: (Obsolet)
At Frame 100 I want the second wave of cherries to fly into the air.
Now the second wave of cherries creates a new wave of cherries that fly into the air WICH is obvious since I... nevermind I just figured it out. The "a." had to be removed. Thanks brain! :atkHappy:
This post has become unnacessary befor I was even able to post it.
Thanks again. If I come across any more problems. I'll post it ;)