Fangames > Programming Questions

Duplicating the same step over and over in timelines

(1/1)

Ataosama:
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.

infern0man1:
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: ---step+=1;
switch(step){
  case [frame]:
    //stuff
  break;
}
--- End code ---

Ths works exactly the same way timelines work and it's easier to copy and paste code from one step to another.

klazen108:
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.

Ataosama:
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!

Navigation

[0] Message Index

Go to full version