====== Part 17 - Timeline Tracks ====== We could set up a spawner to create a load of monsters for us, but we'll use a timeline instead. A timeline can issue commands. Our timeline will simply issue the same create object command over and over in a loop. Before we do this, remove the single monster from the Scene. We don't need it any more: [Scene] ChildList = PlatformObject # MiddlePlatformObject # TopLeftPlatformObject # TopPlatformObject # TopRightPlatformObject # StarObject Now to create a simple track: [MonsterMakerTrack] 1 = Object.Create MonsterObject Loop = True This will create monsters over and over every second for us. But the monster objects need to start at a random position each time. Change the monster object to have a range of starting x positions: [MonsterObject] Graphic = MonsterGraphic AnimationSet = MonsterAnimationSet Position = (-380, -300, 0) ~ (200, -200, 0) Scale = 2.0 Body = MonsterBody Finally, to actually use the track which will create monsters, add it to the TrackList property in the Scene section: [Scene] ChildList = PlatformObject # MiddlePlatformObject # TopLeftPlatformObject # TopPlatformObject # TopRightPlatformObject # StarObject TrackList = MonsterMakerTrack Looking great! Monsters should be dropping in all over the place: {{:guides:beginners:beginners-42-timeline-monsters.png?nolink|}} Some tweaks can be added to the monster and the body to improve things a little: [MonsterObject] Graphic = MonsterGraphic AnimationSet = MonsterAnimationSet Position = (-380, -300, 0) ~ (200, -200, 0) Speed = (-20, 0, 0) ~ (20, 0, 0) Scale = 2.0 Body = MonsterBody [MonsterBody] Dynamic = true PartList = MonsterBodyPart AngularDamping = 50 LinearDamping = 0.2 [MonsterBodyPart] Type = box Solid = true SelfFlags = monster CheckMask = hero # platforms # bullet Friction = 0 Restitution = 0.2 Density = 20 The ''Speed'' on the object will give the monsters a little random left/right movement. The ''Friction'' on the bodypart will make the monster less slippery on the ground. The ''LinearDamping'' on the body will slow him down a little over time if he's too fast. The high ''AngularDamping'' will ensure the monster tips over the edge but not rotate and tumble wildly. Finally, a touch of ''Restitution'' on the body will allow it to bounce just a touch when landing from a height. That should work a little better. ---- Next: [[en:guides:beginners:exploding_monsters|Part 18 – Exploding Monsters]]. {{section>en:guides:beginners:toc&noheader&nofooter&noeditbutton}}