User Tools

Site Tools


en:guides:beginners:jelly_monsters

This is an old revision of the document!


Part 16 - Jelly Monsters

We need something to create challenge in the game. Alien jelly monsters are the obvious choice. Lots of them. Here's a sprite sheet for the monsters:

Right click and save to the data/anim folder as “monster.png”.

Create graphics from the sprite sheet in the config:

[MonsterGraphic]
Texture     = monster.png
TextureSize = (32, 32, 0)
Pivot       = center
 
[MonsterGraphic1@MonsterGraphic]
TextureOrigin = (0,0,0)
 
[MonsterGraphic2@MonsterGraphic]
TextureOrigin = (32,0,0)
 
[MonsterGraphic3@MonsterGraphic]
TextureOrigin = (64,0,0)

We need an object:

[MonsterObject]
Graphic      = MonsterGraphic1
AnimationSet = MonsterAnimationSet
Position     = (90, 90, 0)
Scale        = 2.0

Then to define the animation set and the one animation we need:

[MonsterAnimationSet]
AnimationList = MonsterWobbleAnim
LinkList      = MonsterWobbleLoop
 
[MonsterWobbleAnim]
DefaultKeyDuration = 0.1
KeyData1           = MonsterGraphic1
KeyData2           = MonsterGraphic2
KeyData3           = MonsterGraphic3
KeyData4           = MonsterGraphic2
 
[MonsterWobbleLoop]
Source      = MonsterWobbleAnim
Destination = MonsterWobbleAnim

Just so you can see the monster working… add a MonsterObject to the Scene childlist:

[Scene]
ChildList = PlatformObject # MiddlePlatformObject #
TopLeftPlatformObject # TopPlatformObject #
TopRightPlatformObject #
StarObject # MonsterObject

Run the game and you'll see a monster wobbling in the top left hand corner of the screen:

We need more than one monster, very soon we'll make lots of them drop out of the sky.

Last job is to give the monster a body and ensure he collides with platforms, bullets, and our hero:

[MonsterObject]
Graphic      = MonsterGraphic
AnimationSet = MonsterAnimationSet
Position     = (90, 90, 0)
Scale        = 2.0
Body         = MonsterBody
 
[MonsterBody]
Dynamic  = true
PartList = MonsterBodyPart
 
[MonsterBodyPart]
Type        = box
Solid       = true
SelfFlags   = monster
CheckMask   = hero # platforms # bullet

And add “monster” to the PlatformBody so that collisions work on both object types:

[PlatformBodyPart]
Type        = box
Solid       = true
SelfFlags   = platforms
CheckMask   = hero # monster

Run it again and the monster should drop nicely onto a platform.


Next: Part 17 – Timeline Tracks.

en/guides/beginners/jelly_monsters.1496119845.txt.gz · Last modified: 2017/05/30 00:50 (7 years ago) (external edit)