indy_logo.gif (3362 bytes)

Step 5: improving animation

Indy walks and talks, but that's not enough. At specific moments, the character must perform a special movement.


ROOM main
{
	IMAGE { "gr/idol.jpg" }
	WALK { "gr/idol_bm.gif" }

	ITEM Indy       // My hero   :)
	{
		ANIMATION
		{
			// --- standby images ---
			0  0  "gr/indy_d.gif"  1 // Looking South
			0  1  "gr/indy_r.gif"  1 // Looking West
			0  2  "gr/indy_u.gif"  1 // Looking North
			0  3  "gr/indy_l.gif"  1 // Looking East
			// --- walking animation ---
			1  0  "gr/indy_wd.gif" 4 // Looking South
			1  1  "gr/indy_wr.gif" 6 // Looking West
			1  2  "gr/indy_wu.gif" 4 // Looking North
			1  3  "gr/indy_wl.gif" 6 // Looking East
			// --- talking animation ---
			2  0  "gr/indy_td.gif" 7 // Looking South
			2  1  "gr/indy_tr.gif" 4 // Looking West
			2  2  "gr/indy_tu.gif" 1 // Looking North
			2  3  "gr/indy_tl.gif" 4 // Looking East
		}
		POSITION { 170 170 0 }
	}
	ITEM Idol
	{
		IMAGE { 0  0  "gr/idol.gif" }
		POSITION { 155 135 0 }

		COMMAND push idol
		{
			SETANIMATION indy 3 0 "gr/indy_su.gif" 1	// Define image #0 for attitude #3
			ATTITUDE indy 3					// Switch to that mode
			SAY indy "hummmmpppfff..."
			WAIT indy
			ATTITUDE indy 0		// Back to normal animation (standby)
			SAY indy "That doesn't work."
		}
	}
}

Attitude #3 is reserved by the system for custom animations.
Notice how an image that wasn't included in the initial ANIMATION block for this item is defined inside a COMMAND block, and loaded on the fly.
It is also possible to load images for any other attitude with the same instruction.

Next >>

Back to the main page