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
TextureOrigin	= (0, 0, 0) ;required by the animation system for sizing.
TextureSize	= (32, 32, 0)
Pivot		= center

We need an object:

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

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

[MonsterAnimationSet]
Texture			= monster.png
FrameSize		= (32, 32, 0)
MonsterWobbleAnim	= -1 ;use the entire sheet
StartAnim		= MonsterWobbleAnim
MonsterWobbleAnim->	= MonsterWobbleAnim
Pivot			= center
 
[MonsterWobbleAnim]
KeyDuration = 0.1

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.1497323859.txt.gz · Last modified: 2017/06/12 23:17 (7 years ago) (external edit)