User Tools

Site Tools


guides:beginners:timeline_tracks

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      = MonsterGraphic1
AnimationSet = MonsterAnimationSet
Position     = (20, 0, 0) ~ (600, 0, 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:

Some tweaks can be added to the monster and the body to improve things a little:

[MonsterObject]
Graphic      = MonsterGraphic1
AnimationSet = MonsterAnimationSet
Position     = (20, 0, 0) ~ (600, 0, 0)
Speed        = (-20, 0, 0) ~ (20, 0, 0)
Scale        = 2.0
Body         = MonsterBody
 
[MonsterBody]
Dynamic            = true
PartList           = MonsterBodyPart
AllowGroundSliding = false
AngularDamping     = 5

This will give the monsters a little left/right movement (speed) and stop them from slipping along the floor (AllowGroundSliding). Also stops them from flipping over so much (AngularDamping).

That should work a little better.


Next: Part 18 – Exploding Monsters.

guides/beginners/timeline_tracks.txt · Last modified: 2016/10/04 00:49 (6 months ago) by sausage