DirectX SDK

MusicLines Sample

[Visual Basic]

This topic pertains only to application development in C and C++. See DirectMusic Visual Basic Samples.

[C++]

Description

The MusicLines sample demonstrates interactive music elements in a simple game, and in particular how game elements can be driven by the music.

Path

Source: (SDK root)\Samples\Multimedia\Dmusic\Src\MusicLines

Executable: (SDK root)\Samples\Multimedia\DMusic\Bin

User's Guide

In the opening dialog box, choose windowed or full-screen mode and a difficulty level, and set the players to human or computer. If two humans are playing, one can use the arrow keys while the other uses the keys AZSW. Start moving by pressing an arrow key.

The object of the game is to force the other player to collide with an existing line.

Change the direction of your line by pressing the arrow keys or the equivalent letter keys. Observe how the main music changes to reflect the current state of play, how motifs are used to signal events such as collisions, and how the speed of the lines is actually controlled by the music.

If you win against the computer, you can continue extending your line or bring the game to an end by deliberately colliding. Play again by pressing the space bar. Quit by pressing ALT+F4.

Programming Notes

The music logic is in Mlmusic.cpp and is amply commented.