I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: Ataosama on August 14, 2015, 03:14:18 PM

Title: Duplicating the same step over and over in timelines
Post by: Ataosama on August 14, 2015, 03:14:18 PM
Hello, I would like to know if there is an easy way to duplicate a step a lot of times without having to create each step one by one for the timelines.
Title: Re: Duplicating the same step over and over in timelines
Post by: infern0man1 on August 14, 2015, 04:24:47 PM
I don't believe there is a way to do that without creating a new step.

Alternatively, you could create a main object and in the step event put:

Code: [Select]
step+=1;
switch(step){
  case [frame]:
    //stuff
  break;
}

Ths works exactly the same way timelines work and it's easier to copy and paste code from one step to another.
Title: Re: Duplicating the same step over and over in timelines
Post by: klazen108 on August 14, 2015, 07:41:16 PM
I highly recommend doing it the way Inferno said, that gives you a lot more freedom in being able to copy, paste, quickly scroll, search, etc.

If you're already too invested in a timeline, though, you could move the code you want to copy to a script, then have the steps call that script instead. Or you could do something like have the timeline set "alarm[0]=1" then have an alarm in the host object that fires the code you want at a certain interval.
Title: Re: Duplicating the same step over and over in timelines
Post by: Ataosama on August 15, 2015, 11:14:08 AM
For the moment I make my timeline call other objects that fire the attack but I will see how to use your code infern0man1.

Thanks for your answers!