home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / ASPRITE.ZIP / help.ht_ / help.ht
Encoding:
Text File  |  1998-04-30  |  61.6 KB  |  2,167 lines

  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type"
  5. content="text/html; charset=iso-8859-1">
  6. <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
  7. <title>ASprite ActiveX Control DocumentationHome Page /</title>
  8. </head>
  9.  
  10. <body bgcolor="#FFFFFF">
  11. <div align="center"><center>
  12.  
  13. <table border="2" bordercolor="#008080">
  14.     <tr>
  15.         <td><p align="center"><br>
  16.         <font color="#004040" size="5" face="Comic Sans MS"><strong><u>ASprite
  17.         ActiveX Control v2.0 Documentation</u></strong></font><br>
  18.         <font size="2"><br>
  19.         <strong>For complete and most recent documentation and
  20.         samples, visit</strong></font><font size="1"><br>
  21.         </font><a href="http://www.dreamscape.com/beaulieu/"><font
  22.         size="2"><strong>http://www.dreamscape.com/beaulieu/</strong></font></a></p>
  23.         </td>
  24.     </tr>
  25. </table>
  26. </center></div>
  27.  
  28. <p><font size="5"><strong><u>Overview</u></strong></font><br>
  29. The ASprite ActiveX Control enables programmers to <em><strong>easily</strong></em>
  30. create video games for Windows 95 and NT using DirectX. The
  31. control can be used within most 4GL tools such as Visual Basic,
  32. and examples are included. Some of the features of the ASprite
  33. Control are:</p>
  34.  
  35. <ul>
  36.     <li>Sprite Animation via DirectDraw</li>
  37.     <li>Joystick Support</li>
  38.     <li>Keyboard Support</li>
  39.     <li>Buffered Sound via DirectSound</li>
  40. </ul>
  41.  
  42. <p><font size="5"><strong><u>Legal Information<br>
  43. </u></strong></font>The ASprite ActiveX Control is Freeware. This
  44. means you can freely use and distribute the control (ASPRITE.OCX)
  45. in its original unmodified form. <br>
  46. The author makes no warranties, either express or implied, as to
  47. the reliability of this software and accompanying information and
  48. examples or its fitness to be used for your particular
  49. purpose.  The entire risk of the use of, or the results from
  50. the use of this software remains with you.</p>
  51.  
  52. <p align="left"><font size="5"><strong><u>What's New in Version
  53. 2.0<br>
  54. </u></strong></font>Here are some the highlights for the new
  55. version:</p>
  56.  
  57. <ul>
  58.     <li>Any code written for version 1.0 of the control is still <strong>compatible</strong>;
  59.         simply recompile against the new control.</li>
  60.     <li><strong>Multiple bitmap</strong> (BMP) files supported!</li>
  61.     <li>Complete sample projects in VB5 show you how to do fast <strong>full
  62.         page scrolling</strong> and multiple BMP support.</li>
  63.     <li>It's still <strong>FREEWARE</strong>!</li>
  64.     <li>Here's a summary of the <strong>new properties and
  65.         methods</strong> for v2.0:</li>
  66. </ul>
  67.  
  68. <table border="0">
  69.     <tr>
  70.         <td width="50"> </td>
  71.         <td> </td>
  72.         <td><strong>SoundPlayLoop</strong></td>
  73.         <td>Plays a WAV file in a looping manner.</td>
  74.     </tr>
  75.     <tr>
  76.         <td width="50"> </td>
  77.         <td> </td>
  78.         <td><strong>SoundStopLoop</strong></td>
  79.         <td>Stops playing a WAV loop started with SoundPlayLoop.</td>
  80.     </tr>
  81.     <tr>
  82.         <td width="50"> </td>
  83.         <td> </td>
  84.         <td><strong>SoundGetVolume</strong></td>
  85.         <td>Gets the current playback volume for SoundPlay
  86.         calls..</td>
  87.     </tr>
  88.     <tr>
  89.         <td width="50"> </td>
  90.         <td> </td>
  91.         <td><strong>SoundSetVolume</strong> </td>
  92.         <td>Sets the playback volume for all SoundPlay calls..</td>
  93.     </tr>
  94.     <tr>
  95.         <td width="50"> </td>
  96.         <td> </td>
  97.         <td><strong>SpriteFileNum property</strong></td>
  98.         <td>Used for applications requiring multiple bitmap (BMP)
  99.         files.</td>
  100.     </tr>
  101.     <tr>
  102.         <td width="50"> </td>
  103.         <td> </td>
  104.         <td><strong>SpriteTestCollisionExt</strong></td>
  105.         <td>Tests for a collision between sprites in different
  106.         BMP files. </td>
  107.     </tr>
  108.     <tr>
  109.         <td width="50"> </td>
  110.         <td> </td>
  111.         <td><strong>InputJoystickButtons</strong></td>
  112.         <td>Gives detailed information about joystick buttons.</td>
  113.     </tr>
  114. </table>
  115.  
  116. <p><font size="5"><strong><u>List of Properties and Methods</u></strong></font><br>
  117. Below is a list of properties and methods for the ASprite ActiveX
  118. Control:</p>
  119.  
  120. <table border="0">
  121.     <tr>
  122.         <td><a href="#hWnd Property"><strong>hWnd Property</strong></a></td>
  123.         <td>Notifies ASprite Control of what window to use for
  124.         DirectX.</td>
  125.     </tr>
  126.     <tr>
  127.         <td><a href="#AboutBox Method"><strong>AboutBox</strong></a></td>
  128.         <td>Displays control information in a dialog box.</td>
  129.     </tr>
  130.     <tr>
  131.         <td><a href="#DrawInit Method"><strong>DrawInit</strong></a></td>
  132.         <td>Initializes DirectDraw for use.</td>
  133.     </tr>
  134.     <tr>
  135.         <td><a href="#DrawDisable Method"><strong>DrawDisable</strong></a></td>
  136.         <td>Releases DirectDraw resources.</td>
  137.     </tr>
  138.     <tr>
  139.         <td><a href="#DrawFloodFill Method"><strong>DrawFloodFill</strong></a></td>
  140.         <td>Fills the back buffer with a specified palette entry.</td>
  141.     </tr>
  142.     <tr>
  143.         <td><a href="#DrawFlipBackBuffer Method"><strong>DrawFlipBackBuffer</strong></a></td>
  144.         <td>Flips the back buffer to the visible front buffer.</td>
  145.     </tr>
  146.     <tr>
  147.         <td><a href="#InputIsKeyPressed Method"><strong>InputIsKeyPressed</strong></a></td>
  148.         <td>Determines whether a specific key is down.</td>
  149.     </tr>
  150.     <tr>
  151.         <td><a href="#InputJoystickButtonDown Method"><strong>InputJoystickButtonDown</strong></a></td>
  152.         <td>Determines whether joystick button #1 is down.</td>
  153.     </tr>
  154.     <tr>
  155.         <td><a href="#InputJoystickButtons Method"><strong>InputJoystickButtons</strong></a></td>
  156.         <td>Gives detailed information about joystick buttons.</td>
  157.     </tr>
  158.     <tr>
  159.         <td><a href="#InputJoystickDirection Method"><strong>InputJoystickDirection</strong></a></td>
  160.         <td>Gets the current direction of the joystick.</td>
  161.     </tr>
  162.     <tr>
  163.         <td><a href="#InputKeyArrowDirection Method"><strong>InputKeyArrowDirection</strong></a></td>
  164.         <td>Gets the current direction of the keyboard arrow
  165.         keys.</td>
  166.     </tr>
  167.     <tr>
  168.         <td><a href="#SpriteFileNum Property"><strong>SpriteFileNum
  169.         property</strong></a></td>
  170.         <td>Used for applications requiring multiple bitmap (BMP)
  171.         files.</td>
  172.     </tr>
  173.     <tr>
  174.         <td><a href="#SpriteLoad Method"><strong>SpriteLoad</strong></a></td>
  175.         <td>Loads a BMP file into memory for use as a sprite.</td>
  176.     </tr>
  177.     <tr>
  178.         <td><a href="#SpriteDefine Method"><strong>SpriteDefine</strong></a></td>
  179.         <td>Defines a sprite within a BMP file.</td>
  180.     </tr>
  181.     <tr>
  182.         <td><a href="#SpriteDisplay Method"><strong>SpriteDisplay</strong></a></td>
  183.         <td>Displays a sprite to the back buffer.</td>
  184.     </tr>
  185.     <tr>
  186.         <td><a href="#SpriteMove Method"><strong>SpriteMove</strong></a></td>
  187.         <td>Moves a sprite.</td>
  188.     </tr>
  189.     <tr>
  190.         <td><a href="#SpriteDefineCollisionRect Method"><strong>SpriteDefineCollisionRect</strong></a></td>
  191.         <td>Defines a sprite's collision rectangle for use in
  192.         collision detection.</td>
  193.     </tr>
  194.     <tr>
  195.         <td><a href="#SpriteGetDirection Method"><strong>SpriteGetDirection</strong></a></td>
  196.         <td>Gets the last direction SpriteMove was called with.</td>
  197.     </tr>
  198.     <tr>
  199.         <td><a href="#SpriteGetFrame Method"><strong>SpriteGetFrame</strong></a></td>
  200.         <td>Gets a sprite's animation frame.</td>
  201.     </tr>
  202.     <tr>
  203.         <td><a
  204.         href="#SpriteGetXPosition, SpriteGetYPosition Methods"><strong>SpriteGetXPosition</strong></a></td>
  205.         <td>Gets a sprite's current X coordinate position.</td>
  206.     </tr>
  207.     <tr>
  208.         <td><a
  209.         href="#SpriteGetXPosition, SpriteGetYPosition Methods"><strong>SpriteGetYPosition</strong></a></td>
  210.         <td>Gets a sprite's current Y coordinate position.</td>
  211.     </tr>
  212.     <tr>
  213.         <td><a href="#SpriteSetFrame Method"><strong>SpriteSetFrame</strong></a></td>
  214.         <td>Sets a sprite's animation frame.</td>
  215.     </tr>
  216.     <tr>
  217.         <td><a href="#SpriteGetActive Method"><strong>SpriteGetActive</strong></a></td>
  218.         <td>Gets a sprite's current active state.</td>
  219.     </tr>
  220.     <tr>
  221.         <td><a href="#SpriteSetActive Method"><strong>SpriteSetActive</strong></a></td>
  222.         <td>Sets a sprite as active or inactive.</td>
  223.     </tr>
  224.     <tr>
  225.         <td><a
  226.         href="#SpriteSetNextFrame, SpriteSetPrevFrame Methods"><strong>SpriteSetNextFrame</strong></a></td>
  227.         <td>Increments a sprite's animation frame.</td>
  228.     </tr>
  229.     <tr>
  230.         <td><a
  231.         href="#SpriteSetNextFrame, SpriteSetPrevFrame Methods"><strong>SpriteSetPrevFrame</strong></a></td>
  232.         <td>Decrements a sprite's animation frame.</td>
  233.     </tr>
  234.     <tr>
  235.         <td><a href="#SpriteSetPosition Method"><strong>SpriteSetPosition</strong></a></td>
  236.         <td>Sets a sprite's X,Y coordinate position.</td>
  237.     </tr>
  238.     <tr>
  239.         <td><a href="#SpriteTestCollision Method"><strong>SpriteTestCollision</strong></a></td>
  240.         <td>Tests whether two sprites collide.</td>
  241.     </tr>
  242.     <tr>
  243.         <td><a href="#SpriteTestCollisionExt Method"><strong>SpriteTestCollisionExt</strong></a></td>
  244.         <td>Tests for a collision between sprites in different
  245.         BMP files. </td>
  246.     </tr>
  247.     <tr>
  248.         <td><a href="#TextSetAttributes Method"><strong>TextSetAttributes</strong></a></td>
  249.         <td>Sets font, size, and color attributes for displayed
  250.         text.</td>
  251.     </tr>
  252.     <tr>
  253.         <td><a href="#TextDisplay Method"><strong>TextDisplay</strong></a></td>
  254.         <td>Displays text to the back buffer.</td>
  255.     </tr>
  256.     <tr>
  257.         <td><a href="#SoundInit Method"><strong>SoundInit</strong></a></td>
  258.         <td>Initializes DirectSound for use.</td>
  259.     </tr>
  260.     <tr>
  261.         <td><a href="#SoundDisable Method"><strong>SoundDisable</strong></a></td>
  262.         <td>Releases DirectSound resources.</td>
  263.     </tr>
  264.     <tr>
  265.         <td><a href="#SoundLoad Method"><strong>SoundLoad</strong></a></td>
  266.         <td>Loads a WAV file into memory for use as a sound.</td>
  267.     </tr>
  268.     <tr>
  269.         <td><a href="#SoundPlay Method"><strong>SoundPlay</strong></a></td>
  270.         <td>Plays a WAV file previously loaded with SoundLoad.</td>
  271.     </tr>
  272.     <tr>
  273.         <td><a href="#SoundPlayFile Method"><strong>SoundPlayFile</strong></a></td>
  274.         <td>Plays a WAV file <em>without</em> utilizing
  275.         DirectSound (unbuffered).</td>
  276.     </tr>
  277.     <tr>
  278.         <td><a href="#SoundPlayLoop Method"><strong>SoundPlayLoop</strong></a></td>
  279.         <td>Plays a WAV file in a looping manner.</td>
  280.     </tr>
  281.     <tr>
  282.         <td><a href="#SoundStopLoop Method"><strong>SoundStopLoop</strong></a></td>
  283.         <td>Stops playing a WAV loop started with SoundPlayLoop.</td>
  284.     </tr>
  285.     <tr>
  286.         <td><a href="#SoundGetVolume Method"><strong>SoundGetVolume</strong></a></td>
  287.         <td>Gets the current playback volume for SoundPlay
  288.         calls..</td>
  289.     </tr>
  290.     <tr>
  291.         <td><a href="#SoundSetVolume Method"><strong>SoundSetVolume</strong></a>
  292.         </td>
  293.         <td>Sets the playback volume for all SoundPlay calls..</td>
  294.     </tr>
  295.     <tr>
  296.         <td><a href="#TimerGetTickCount Method"><strong>TimerGetTickCount</strong></a></td>
  297.         <td>Returns the number of milliseconds since Windows was
  298.         started.</td>
  299.     </tr>
  300. </table>
  301.  
  302. <hr>
  303.  
  304. <p><a name="hWnd Property"><font color="#0000FF" size="4"><strong>hWnd
  305. Property</strong></font></a></p>
  306.  
  307. <p>Notifies DirectX of what window to use for functionality<br>
  308. <br>
  309. <strong>Syntax</strong><br>
  310. ASprite.<strong>hWnd = Form1.hWnd</strong><br>
  311. <br>
  312. <br>
  313. <strong>Remarks</strong><br>
  314. You <strong>must always</strong> set the hWnd property for the
  315. ASprite Control before doing any DirectX functionality.</p>
  316.  
  317. <hr>
  318.  
  319. <p><a name="AboutBox Method"><font color="#0000FF" size="4"><strong>AboutBox
  320. Method</strong></font></a></p>
  321.  
  322. <p>Displays the About box for the control.<br>
  323. <br>
  324. <strong>Syntax</strong><br>
  325. ASprite.<strong>AboutBox</strong><br>
  326. <br>
  327. <br>
  328. <strong>Remarks</strong><br>
  329. This is the same as clicking About in the Properties window.</p>
  330.  
  331. <hr>
  332.  
  333. <p><a name="DrawInit Method"><font color="#0000FF" size="4"><strong>DrawInit
  334. Method</strong></font></a></p>
  335.  
  336. <p>Initializes DirectDraw and sets resolution mode.</p>
  337.  
  338. <p><br>
  339. <strong>Syntax</strong><br>
  340. ASprite.<strong>DrawInit(long lXRes, long lYRes, long
  341. lColorDepth, long lRamNeeded </strong>)<br>
  342. <br>
  343. <strong>Parameters</strong></p>
  344.  
  345. <table border="0">
  346.     <tr>
  347.         <td><em>lXRes</em></td>
  348.         <td>The X resolution, in pixels, of the desired graphics
  349.         mode.</td>
  350.     </tr>
  351.     <tr>
  352.         <td><em>lYRes</em></td>
  353.         <td>The Y resolution, in pixels, of the desired graphics
  354.         mode.</td>
  355.     </tr>
  356.     <tr>
  357.         <td><em>lColorDepth<br>
  358.         <br>
  359.         </em></td>
  360.         <td>The color depth, in bits, of the desired graphics
  361.         mode. For example, to get 256 colors, you would use 8 for
  362.         lColorDepth, since 2<font size="1"><sup><sup><sup>8</sup></sup></sup></font>
  363.         is 256.</td>
  364.     </tr>
  365.     <tr>
  366.         <td><em>lRamNeeded</em></td>
  367.         <td>The amount of memory you expect you application to
  368.         require. DrawInit will return a failure code if this
  369.         amount of RAM is not available.</td>
  370.     </tr>
  371. </table>
  372.  
  373. <p><strong>Return Values<br>
  374. </strong></p>
  375.  
  376. <table border="0">
  377.     <tr>
  378.         <td width="10%">0 </td>
  379.         <td>Success</td>
  380.     </tr>
  381.     <tr>
  382.         <td width="10%">1 </td>
  383.         <td>DDRAW.DLL not found; DirectDraw not installed.</td>
  384.     </tr>
  385.     <tr>
  386.         <td width="10%">2</td>
  387.         <td>Could not create DirectDraw Object.</td>
  388.     </tr>
  389.     <tr>
  390.         <td width="10%">3</td>
  391.         <td>Could not get exclusive access.</td>
  392.     </tr>
  393.     <tr>
  394.         <td width="10%">4</td>
  395.         <td>Could not set display mode.</td>
  396.     </tr>
  397.     <tr>
  398.         <td width="10%">5</td>
  399.         <td>Not enough RAM available.</td>
  400.     </tr>
  401.     <tr>
  402.         <td width="10%">6</td>
  403.         <td>hWnd property not set.</td>
  404.     </tr>
  405. </table>
  406.  
  407. <p><strong><br>
  408. Remarks</strong><br>
  409. Use DrawInit before doing any other Draw methods. This function
  410. is responsible for setting up DirectDraw and its buffers. Be sure
  411. to set the ASprite.hWnd property before calling this function.</p>
  412.  
  413. <p><strong>Example<br>
  414. </strong><font size="2" face="Courier New">ASprite1.hWnd =
  415. Form1.hWnd<br>
  416. ASprite1.SoundInit<br>
  417. ASprite1.SoundLoad 0, "gun.wav"<br>
  418. ASprite1.<strong>DrawInit</strong> 640, 480, 8, 0 </font><font
  419. color="#008000" size="2" face="Courier New">'Initialize to 640 x
  420. 480, 256 colors</font><font size="2" face="Courier New"><br>
  421. ASprite1.SpriteLoad "example.bmp", 2, 11<br>
  422. ASprite1.SpriteDefine 0, 290, 215, 0, 0, 60, 50, 72, 9, 1, 1</font><br>
  423. ...</p>
  424.  
  425. <hr>
  426.  
  427. <p><a name="DrawDisable Method"><font color="#0000FF" size="4"><strong>DrawDisable
  428. Method</strong></font></a></p>
  429.  
  430. <p>Disables DirectDraw and frees associated resources.</p>
  431.  
  432. <p><br>
  433. <strong>Syntax</strong><br>
  434. ASprite.<strong>DrawDisable</strong><br>
  435. <br>
  436. </p>
  437.  
  438. <p><strong>Return Values<br>
  439. </strong></p>
  440.  
  441. <table border="0">
  442.     <tr>
  443.         <td width="10%">0 </td>
  444.         <td>Success</td>
  445.     </tr>
  446. </table>
  447.  
  448. <p><strong><br>
  449. Remarks</strong><br>
  450. Use <strong>DrawDisable</strong> to clean up all DirectDraw
  451. resources when your application is done with them.</p>
  452.  
  453. <hr>
  454.  
  455. <p><a name="DrawFloodFill Method"><font color="#0000FF" size="4"><strong>DrawFloodFill
  456. Method</strong></font></a></p>
  457.  
  458. <p>Fills the back buffer with a specific palette entry.</p>
  459.  
  460. <p><br>
  461. <strong>Syntax</strong><br>
  462. ASprite.<strong>DrawFloodFill(double dwColor)</strong><br>
  463. <br>
  464. <strong>Return Values</strong></p>
  465.  
  466. <table border="0">
  467.     <tr>
  468.         <td width="10%">0 </td>
  469.         <td>Success</td>
  470.     </tr>
  471. </table>
  472.  
  473. <p><strong><br>
  474. Remarks</strong><br>
  475. Use <strong>DrawFloodFill</strong> to clear out the back buffer
  476. by filling it with a specific color.</p>
  477.  
  478. <hr>
  479.  
  480. <p><a name="DrawFlipBackBuffer Method"><font color="#0000FF"
  481. size="4"><strong>DrawFlipBackBuffer Method</strong></font></a></p>
  482.  
  483. <p>Flips the back buffer to the visible screen.</p>
  484.  
  485. <p><br>
  486. <strong>Syntax</strong><br>
  487. ASprite.<strong>DrawFlipBackBuffer()</strong><br>
  488. <br>
  489. <strong>Return Values</strong></p>
  490.  
  491. <table border="0">
  492.     <tr>
  493.         <td width="10%">0 </td>
  494.         <td>Success</td>
  495.     </tr>
  496. </table>
  497.  
  498. <p><strong><br>
  499. Remarks</strong><br>
  500. Use <strong>DrawFlipBackBuffer</strong> to display the contents
  501. of the back buffer to the screen after you have rendered an
  502. entire scene.</p>
  503.  
  504. <hr>
  505.  
  506. <p><a name="InputIsKeyPressed Method"><font color="#0000FF"
  507. size="4"><strong>InputIsKeyPressed Method</strong></font></a></p>
  508.  
  509. <p>Determines whether a specific key is currently being pressed.</p>
  510.  
  511. <p><br>
  512. <strong>Syntax</strong><br>
  513. ASprite.<strong>InputIsKeyPressed(long lKeyCode)</strong><br>
  514. <br>
  515. </p>
  516.  
  517. <p><strong>Parameters</strong></p>
  518.  
  519. <table border="0">
  520.     <tr>
  521.         <td><strong>lKeyCode<br>
  522.         </strong></td>
  523.         <td>The system key code for the key to test for. For
  524.         Visual Basic, use the vbKeyCode constants.</td>
  525.     </tr>
  526. </table>
  527.  
  528. <p><strong>Return Values</strong></p>
  529.  
  530. <table border="0">
  531.     <tr>
  532.         <td width="10%">0 </td>
  533.         <td>Success</td>
  534.     </tr>
  535. </table>
  536.  
  537. <p><strong><br>
  538. Remarks</strong><br>
  539. Use <strong>InputIsKeyPressed</strong> to determine whether the
  540. user is pressing a specific key.<br>
  541. <br>
  542. <strong>Example<br>
  543. </strong><font size="2" face="Courier New">If
  544. ASprite1.InputIsKeyPressed(vbKeyEscape) Then<br>
  545. </font><font color="#008000" size="2" face="Courier New">'User
  546. wants to quit!</font><font size="2" face="Courier New"><br>
  547. bContinue = False<br>
  548. End If<br>
  549. </font></p>
  550.  
  551. <hr>
  552.  
  553. <p><a name="InputJoystickButtonDown Method"><font color="#0000FF"
  554. size="4"><strong>InputJoystickButtonDown Method</strong></font></a></p>
  555.  
  556. <p>Determines whether the joystick button is currently being
  557. pressed. You must call <a href="#InputJoystickDirection Method">InputJoystickDirection</a>
  558. prior to this function to get accurate results.</p>
  559.  
  560. <p><br>
  561. <strong>Syntax</strong><br>
  562. bRetVal = ASprite.<strong>InputJoystickButtonDown()</strong><br>
  563. <br>
  564. </p>
  565.  
  566. <p><strong>Return Values</strong></p>
  567.  
  568. <table border="0">
  569.     <tr>
  570.         <td width="10%">TRUE </td>
  571.         <td>The joystick button is down.</td>
  572.     </tr>
  573.     <tr>
  574.         <td>FALSE </td>
  575.         <td>The joystick button is up.</td>
  576.     </tr>
  577. </table>
  578.  
  579. <hr>
  580.  
  581. <p><a name="InputJoystickButtons Method"><font color="#0000FF"
  582. size="4"><strong>InputJoystickButtons Method</strong></font></a></p>
  583.  
  584. <p>Determines which the joystick buttons are currently being
  585. pressed. You must call <a href="#InputJoystickDirection Method">InputJoystickDirection</a>
  586. prior to this function to get accurate results.</p>
  587.  
  588. <p><br>
  589. <strong>Syntax</strong><br>
  590. bRetVal = ASprite.<strong>InputJoystickButtons()</strong><br>
  591. </p>
  592.  
  593. <p><strong>Return Values<br>
  594. </strong>Returns the added binary value of all buttons currently
  595. being pressed. You may use a bitwise AND in VB to see if a button
  596. is down. For example, if button two is pressed, then the
  597. expression (ASprite1.InputJoystickButtons() And 1) is true.<br>
  598. </p>
  599.  
  600. <p><strong>Remarks<br>
  601. </strong>InputJoystickButtons gives extended information on what
  602. joystick buttons are currently being pressed by the user. If you
  603. simply want to see if button 1 is being pressed, you can use the
  604. InputJoystickButtonDown() function instead.<br>
  605. </p>
  606.  
  607. <p><strong>Example<br>
  608. </strong>iJoyButton = ASprite1.InputJoystickButtons()<br>
  609. If iJoyButton And 1 Then<br>
  610. <font color="#0000FF" size="3" face="Times New Roman"><code><img
  611. src="pics/tab.gif" width="20" height="1"></code></font>ASprite1.TextDisplay
  612. "Button 1 is down!", 1, 1<br>
  613. End If<br>
  614. If iJoyButton And 2 Then<br>
  615. <font color="#0000FF" size="3" face="Times New Roman"><code><img
  616. src="pics/tab.gif" width="20" height="1"></code></font>ASprite1.TextDisplay
  617. "Button 2 is down!", 1, 100<br>
  618. End If</p>
  619.  
  620. <hr>
  621.  
  622. <p><a name="InputJoystickDirection Method"><font color="#0000FF"
  623. size="4"><strong>InputJoystickDirection Method</strong></font></a></p>
  624.  
  625. <p>Returns the current direction of the joystick.</p>
  626.  
  627. <p><br>
  628. <strong>Syntax</strong><br>
  629. lDirection = ASprite.<strong>InputJoystickDirection</strong><br>
  630. <br>
  631. <strong>Return Values</strong></p>
  632.  
  633. <table border="0">
  634.     <tr>
  635.         <td width="10%">0 </td>
  636.         <td>Center position (no user movement)</td>
  637.     </tr>
  638.     <tr>
  639.         <td>1 </td>
  640.         <td>The joystick is pointed right.</td>
  641.     </tr>
  642.     <tr>
  643.         <td>2</td>
  644.         <td>The joystick is pointed down and right.</td>
  645.     </tr>
  646.     <tr>
  647.         <td>3</td>
  648.         <td>The joystick is pointed down.</td>
  649.     </tr>
  650.     <tr>
  651.         <td>4</td>
  652.         <td>The joystick is pointed down and left.</td>
  653.     </tr>
  654.     <tr>
  655.         <td>5</td>
  656.         <td>The joystick is pointed left.</td>
  657.     </tr>
  658.     <tr>
  659.         <td>6</td>
  660.         <td>The joystick is pointed up and left.</td>
  661.     </tr>
  662.     <tr>
  663.         <td>7</td>
  664.         <td>The joystick is pointed up.</td>
  665.     </tr>
  666.     <tr>
  667.         <td>8</td>
  668.         <td>The joystick is pointed up and right.</td>
  669.     </tr>
  670. </table>
  671.  
  672. <hr>
  673.  
  674. <p><a name="InputKeyArrowDirection Method"><font color="#0000FF"
  675. size="4"><strong>InputKeyArrowDirection Method</strong></font></a></p>
  676.  
  677. <p>Returns the current direction of the arrow keys on the
  678. keyboard. </p>
  679.  
  680. <p><br>
  681. <strong>Syntax</strong><br>
  682. lDirection = ASprite.<strong>InputKeyArrowDirection</strong><br>
  683. <br>
  684. <strong>Return Values</strong></p>
  685.  
  686. <table border="0">
  687.     <tr>
  688.         <td width="10%">0 </td>
  689.         <td>Center position (no user movement)</td>
  690.     </tr>
  691.     <tr>
  692.         <td>1 </td>
  693.         <td>The arrows are pointed right.</td>
  694.     </tr>
  695.     <tr>
  696.         <td>2</td>
  697.         <td>The arrows are pointed down and right.</td>
  698.     </tr>
  699.     <tr>
  700.         <td>3</td>
  701.         <td>The arrows are pointed down.</td>
  702.     </tr>
  703.     <tr>
  704.         <td>4</td>
  705.         <td>The arrows are pointed down and left.</td>
  706.     </tr>
  707.     <tr>
  708.         <td>5</td>
  709.         <td>The arrows are pointed left.</td>
  710.     </tr>
  711.     <tr>
  712.         <td>6</td>
  713.         <td>The arrows are pointed up and left.</td>
  714.     </tr>
  715.     <tr>
  716.         <td>7</td>
  717.         <td>The arrows are pointed up.</td>
  718.     </tr>
  719.     <tr>
  720.         <td>8</td>
  721.         <td>The arrows are pointed up and right.</td>
  722.     </tr>
  723. </table>
  724.  
  725. <p><strong>Remarks<br>
  726. </strong>Use <strong>InputKeyArrowDirection </strong>to easily
  727. determine what direction the user is inputting with the keyboard
  728. arrow keys. These keys are used in many game applications to get
  729. user input.</p>
  730.  
  731. <hr>
  732.  
  733. <p><a name="SpriteFileNum Property"><font color="#0000FF"
  734. size="4"><strong>SpriteFileNum Property</strong></font></a></p>
  735.  
  736. <p>Used to access sprites across multiple bitmap (BMP) files. </p>
  737.  
  738. <p><br>
  739. <strong>Syntax</strong><br>
  740. ASprite.<strong>SpriteFileNum</strong> = lBMPFileNumber</p>
  741.  
  742. <p><strong>Remarks<br>
  743. </strong>The SpriteFileNum property is used in applications that
  744. require two or more bitmap (BMP) files for storing sprites. Since
  745. each BMP file contains sprites with the same reference (e.g. both
  746. files contain a sprite number 0, sprite number 1, etc...), it is
  747. necessary to use this property for accessing each bitmap's
  748. sprites.<br>
  749. <br>
  750. Lets suppose you have two bitmap files, "A.BMP" and
  751. "B.BMP". The first file, A.BMP, contains animation
  752. frames for 3 sprites, and the second file, B.BMP, contains
  753. animation frames for 4 sprites. In this example, you can think of
  754. having two "sprite arrays." <br>
  755. <br>
  756. A.BMP is BMP file number 0. It is composed of sprites 0,1, and 2.<br>
  757. B.BMP is BMP file number 1. It is composed of sprites 0,1,2, and
  758. 3.<br>
  759. <br>
  760. You would set the ASprite.SpriteFileNum property to 0 whenever
  761. you need to set or get properties for its three sprites. You
  762. would set the ASprite.SpriteFileNum property to 1 whenever you
  763. want to set or get properties for its four sprites.<br>
  764. <br>
  765. <strong>Example</strong><br>
  766. <font size="2" face="Courier New">ASprite1.hWnd = Form1.hWnd<br>
  767. ASprite1.DrawInit 640, 480, 8, 0<br>
  768. <br>
  769. </font><font color="#008000" size="2" face="Courier New">'Load
  770. A.BMP, and define its three sprites.<br>
  771. </font><font size="2" face="Courier New">ASprite1.SpriteFileNum =
  772. 1<br>
  773. ASprite1.SpriteLoad "a.bmp", 16, 11<br>
  774. ASprite1.SpriteDefine 0, 290, 215, 0, 0, 80, 65, 16, 8, 1, 1<br>
  775. ASprite1.SpriteDefine 1, 290, 215, 0, 65, 80, 65, 16, 8, 1, 1<br>
  776. ASprite1.SpriteDefine 2, 290, 215, 0, 130, 80, 65, 16, 8, 1, 1<br>
  777. <br>
  778. </font><font color="#008000" size="2" face="Courier New">'Load
  779. B.BMP, and define its four sprites.<br>
  780. </font><font size="2" face="Courier New">ASprite1.SpriteFileNum =
  781. 2<br>
  782. ASprite1.SpriteLoad "b.bmp", 16, 11<br>
  783. ASprite1.SpriteDefine 0, 290, 215, 0, 0, 80, 65, 16, 8, 1, 1<br>
  784. ASprite1.SpriteDefine 1, 290, 215, 0, 65, 80, 65, 16, 8, 1, 1<br>
  785. ASprite1.SpriteDefine 2, 290, 215, 0, 130, 80, 65, 16, 8, 1, 1<br>
  786. ASprite1.SpriteDefine 3, 290, 215, 0, 195, 80, 65, 16, 8, 1, 1<br>
  787. </font></p>
  788.  
  789. <hr>
  790.  
  791. <p><a name="SpriteTestCollisionExt Method"><font color="#0000FF"
  792. size="4"><strong>SpriteTestCollisionExt Method</strong></font></a></p>
  793.  
  794. <p>Tests for a collision between two sprites which exist in
  795. DIFFERENT<br>
  796. bitmap (BMP) files. </p>
  797.  
  798. <p><br>
  799. <strong>Syntax</strong><br>
  800. bRetVal = ASprite.<strong>SpriteTestCollisionExt</strong>(long
  801. lSprite1, long lFileNum1,long lSprite2, long lFileNum2)<br>
  802. </p>
  803.  
  804. <p><strong>Parameters</strong></p>
  805.  
  806. <table border="0">
  807.     <tr>
  808.         <td><strong>lSprite1<br>
  809.         </strong></td>
  810.         <td>The number of the sprite for the first sprite
  811.         involved in the collision test. <br>
  812.         </td>
  813.     </tr>
  814.     <tr>
  815.         <td><strong>lFileNum1 <br>
  816.         </strong></td>
  817.         <td>The number of the file for the first sprite involved
  818.         in the collision test. </td>
  819.     </tr>
  820.     <tr>
  821.         <td><strong>lSprite2<br>
  822.         </strong></td>
  823.         <td>The number of the sprite for the second sprite
  824.         involved in the collision test. </td>
  825.     </tr>
  826.     <tr>
  827.         <td><strong>lFileNum2</strong></td>
  828.         <td>The number of the file for the second sprite involved
  829.         in the collision test. </td>
  830.     </tr>
  831. </table>
  832.  
  833. <p><strong>Return Values</strong></p>
  834.  
  835. <table border="0">
  836.     <tr>
  837.         <td width="10%">TRUE </td>
  838.         <td>lSprite1 Collides with lSprite2.</td>
  839.     </tr>
  840.     <tr>
  841.         <td>FALSE </td>
  842.         <td>lSprite1 does not collide with lSprite2.</td>
  843.     </tr>
  844. </table>
  845.  
  846. <p><strong>Remarks<br>
  847. </strong>The SpriteTestCollisionExt method is used in
  848. applications that utilize two or more bitmap (BMP) files for
  849. storing sprites. Separate BMP files are loaded and used with the
  850. SpriteFileNum property. </p>
  851.  
  852. <p>Since each BMP file contains sprites with the same reference
  853. (e.g. both files contain a sprite number 0, sprite number 1,
  854. etc...), it is necessary to use this method for collision testing
  855. INSTEAD OF the SpriteTestCollision method.</p>
  856.  
  857. <hr>
  858.  
  859. <p><a name="SpriteLoad Method"><font color="#0000FF" size="4"><strong>SpriteLoad
  860. Method</strong></font></a></p>
  861.  
  862. <p>Loads a Windows Bitmap (BMP) file into memory for use as one
  863. or more sprites.</p>
  864.  
  865. <p><br>
  866. <strong>Syntax</strong><br>
  867. ASprite.<strong>SpriteLoad(string lpctstrFileName, short
  868. iNumSprites, long lTransparentColorEntry) </strong><br>
  869. <br>
  870. </p>
  871.  
  872. <p><strong>Parameters</strong></p>
  873.  
  874. <table border="0">
  875.     <tr>
  876.         <td><strong>lpctstrFileName<br>
  877.         </strong></td>
  878.         <td>The BMP file which you want to load for use as a
  879.         sprite.<br>
  880.         </td>
  881.     </tr>
  882.     <tr>
  883.         <td><strong>iNumSprites<br>
  884.         </strong></td>
  885.         <td>The number of sprites you will later define in the
  886.         BMP file with SpriteDefine.</td>
  887.     </tr>
  888.     <tr>
  889.         <td><strong>lTransparentColorEntry<br>
  890.         </strong></td>
  891.         <td>The color in the image that you wish to have
  892.         transparent when the sprites are drawn to the back
  893.         buffer.</td>
  894.     </tr>
  895. </table>
  896.  
  897. <p><strong>Return Values</strong></p>
  898.  
  899. <table border="0">
  900.     <tr>
  901.         <td width="10%">0 </td>
  902.         <td>Success</td>
  903.     </tr>
  904.     <tr>
  905.         <td>1 </td>
  906.         <td>Failure, normally due to lack of resources</td>
  907.     </tr>
  908. </table>
  909.  
  910. <p><strong>Remarks<br>
  911. </strong>Use <strong>SpriteLoad </strong>to get a BMP file in
  912. memory before using SpriteDefine to set up your sprites. When
  913. creating your bitmaps, use a color such as black or bright blue
  914. in the background, and give this palette entry for <strong>lTransparentColorEntry.</strong></p>
  915.  
  916. <hr>
  917.  
  918. <p><a name="SpriteDefine Method"><font color="#0000FF" size="4"><strong>SpriteDefine
  919. Method</strong></font></a></p>
  920.  
  921. <p>Defines a sprite within a bitmap previously loaded with
  922. SpriteLoad.</p>
  923.  
  924. <p><br>
  925. <strong>Syntax</strong><br>
  926. ASprite.<strong>SpriteDefine(long lSpriteNum, long iXPos, long
  927. iYPos, <br>
  928. long iXPosBMP, long iYPosBMP, <br>
  929. long iFrameWidth, long iFrameHeight, <br>
  930. long iFrameCount, long iFramesPerRow, <br>
  931. long iCurrentFrame, short iDirection) </strong><br>
  932. </p>
  933.  
  934. <p><strong>Parameters</strong></p>
  935.  
  936. <table border="0">
  937.     <tr>
  938.         <td><strong>lSpriteNum<br>
  939.         </strong></td>
  940.         <td>The sprite number you are defining. Start with 0 and
  941.         increment by 1 for each sprite.<br>
  942.         </td>
  943.     </tr>
  944.     <tr>
  945.         <td><strong>iXPos<br>
  946.         </strong></td>
  947.         <td>The initial X screen coordinate position for the
  948.         sprite.</td>
  949.     </tr>
  950.     <tr>
  951.         <td><strong>iYPos<br>
  952.         </strong></td>
  953.         <td>The initial Y screen coordinate position for the
  954.         sprite.</td>
  955.     </tr>
  956.     <tr>
  957.         <td><strong>iXPosBMP</strong></td>
  958.         <td>The X coordinate position of the beginning of the
  959.         sprite data inside the BMP file you loaded with
  960.         SpriteLoad. </td>
  961.     </tr>
  962.     <tr>
  963.         <td><strong>iYPosBMP</strong></td>
  964.         <td>The Y coordinate position of the beginning of the
  965.         sprite data inside the BMP file you loaded with
  966.         SpriteLoad. </td>
  967.     </tr>
  968.     <tr>
  969.         <td><strong>iFrameWidth</strong></td>
  970.         <td>The width of each animation frame for the sprite.</td>
  971.     </tr>
  972.     <tr>
  973.         <td><strong>iFrameHeight</strong></td>
  974.         <td>The height of each animation frame for the sprite.</td>
  975.     </tr>
  976.     <tr>
  977.         <td><strong>iFrameCount</strong></td>
  978.         <td>The number of animation frames for the sprite.</td>
  979.     </tr>
  980.     <tr>
  981.         <td><strong>iFramesPerRow</strong></td>
  982.         <td>The number of frames on each row inside the BMP file.</td>
  983.     </tr>
  984.     <tr>
  985.         <td><strong>iCurrentFrame</strong></td>
  986.         <td>The initial frame number to display for the sprite.</td>
  987.     </tr>
  988.     <tr>
  989.         <td><strong>iDirection</strong></td>
  990.         <td>For future use, not currently supported by control.</td>
  991.     </tr>
  992. </table>
  993.  
  994. <p><strong>Return Values</strong></p>
  995.  
  996. <table border="0">
  997.     <tr>
  998.         <td width="10%">0 </td>
  999.         <td>Success</td>
  1000.     </tr>
  1001.     <tr>
  1002.         <td>1 </td>
  1003.         <td>Failure</td>
  1004.     </tr>
  1005. </table>
  1006.  
  1007. <p><strong>Remarks<br>
  1008. </strong>Use <strong>SpriteDefine </strong>to define the sprites
  1009. that exist in the BMP file you loaded with the SpriteLoad method.
  1010. When creating the BMP file, be sure each frame of the sprite
  1011. occupies an equal sized rectangular region.</p>
  1012.  
  1013. <p><strong>Example<br>
  1014. </strong><font size="2" face="Courier New">ASprite1.hWnd =
  1015. Form1.hWnd<br>
  1016. ASprite1.DrawInit 640, 480, 8, 0<br>
  1017. ASprite1.SpriteLoad "example.bmp", 2, 11<br>
  1018. </font><font color="#008000" size="2" face="Courier New">'Define
  1019. the first Sprite (0). Its initial position will be 290, 215.<br>
  1020. 'It exists in example.bmp at coordinates 0,0.<br>
  1021. 'Each frame is 60 x 50.<br>
  1022. 'There are 72 frames of animation, with 9 frames on each row.<br>
  1023. 'Frame 1 will be the initial frame to display, and its direction
  1024. is 1.<br>
  1025. </font><font size="2" face="Courier New">ASprite1.SpriteDefine 0,
  1026. 290, 215, 0, 0, 60, 50, 72, 9, 1, 1<br>
  1027. </font></p>
  1028.  
  1029. <hr>
  1030.  
  1031. <p><a name="SpriteDisplay Method"><font color="#0000FF" size="4"><strong>SpriteDisplay
  1032. Method</strong></font></a></p>
  1033.  
  1034. <p>Displays a sprite onto the back buffer.</p>
  1035.  
  1036. <p><br>
  1037. <strong>Syntax</strong><br>
  1038. ASprite.<strong>SpriteDisplay(long lSpriteNum) </strong><br>
  1039. </p>
  1040.  
  1041. <p><strong>Parameters</strong></p>
  1042.  
  1043. <table border="0">
  1044.     <tr>
  1045.         <td><strong>lSpriteNum <br>
  1046.         </strong></td>
  1047.         <td>The sprite number you want to display to the back
  1048.         buffer.<br>
  1049.         </td>
  1050.     </tr>
  1051. </table>
  1052.  
  1053. <p><strong>Return Values</strong></p>
  1054.  
  1055. <table border="0">
  1056.     <tr>
  1057.         <td>no return value.</td>
  1058.     </tr>
  1059. </table>
  1060.  
  1061. <p><strong>Remarks<br>
  1062. </strong>Use <strong>SpriteDisplay </strong>to draw a sprite onto
  1063. the back buffer at its current position and animation frame. The
  1064. Sprite must be active for it to display. Use SpriteSetActive to
  1065. set active states.</p>
  1066.  
  1067. <hr>
  1068.  
  1069. <p><a name="SpriteMove Method"><font color="#0000FF" size="4"><strong>SpriteMove
  1070. Method</strong></font></a></p>
  1071.  
  1072. <p>Sets the position of a sprite on the screen.</p>
  1073.  
  1074. <p><br>
  1075. <strong>Syntax</strong><br>
  1076. ASprite.<strong>SpriteMove(long lSpriteNum, long lDirection, long
  1077. lDistance) </strong><br>
  1078. </p>
  1079.  
  1080. <p><strong>Parameters</strong></p>
  1081.  
  1082. <table border="0">
  1083.     <tr>
  1084.         <td><strong>lSpriteNum<br>
  1085.         </strong></td>
  1086.         <td>The number of the sprite you are moving. <br>
  1087.         </td>
  1088.     </tr>
  1089.     <tr>
  1090.         <td><strong>lDirection<br>
  1091.         <br>
  1092.         <br>
  1093.         <br>
  1094.         <br>
  1095.         <br>
  1096.         <br>
  1097.         <br>
  1098.         <br>
  1099.         <br>
  1100.         <br>
  1101.         </strong></td>
  1102.         <td>The direction you want to move the sprite in:<br>
  1103.         <table border="0">
  1104.             <tr>
  1105.                 <td>1 </td>
  1106.                 <td>Move the sprite right.</td>
  1107.             </tr>
  1108.             <tr>
  1109.                 <td>2</td>
  1110.                 <td>Move the sprite down and right.</td>
  1111.             </tr>
  1112.             <tr>
  1113.                 <td>3</td>
  1114.                 <td>Move the sprite down.</td>
  1115.             </tr>
  1116.             <tr>
  1117.                 <td>4</td>
  1118.                 <td>Move the sprite down and left.</td>
  1119.             </tr>
  1120.             <tr>
  1121.                 <td>5</td>
  1122.                 <td>Move the sprite left.</td>
  1123.             </tr>
  1124.             <tr>
  1125.                 <td>6</td>
  1126.                 <td>Move the sprite up and left.</td>
  1127.             </tr>
  1128.             <tr>
  1129.                 <td>7</td>
  1130.                 <td>Move the sprite up.</td>
  1131.             </tr>
  1132.             <tr>
  1133.                 <td>8</td>
  1134.                 <td>Move the sprite up and right.</td>
  1135.             </tr>
  1136.         </table>
  1137.         </td>
  1138.     </tr>
  1139.     <tr>
  1140.         <td><strong>lDistance<br>
  1141.         </strong></td>
  1142.         <td>The number of pixels to move the sprite.<br>
  1143.         </td>
  1144.     </tr>
  1145. </table>
  1146.  
  1147. <p><strong>Return Values</strong></p>
  1148.  
  1149. <table border="0">
  1150.     <tr>
  1151.         <td width="10%"> </td>
  1152.         <td>No return value.</td>
  1153.     </tr>
  1154. </table>
  1155.  
  1156. <p><strong>Remarks<br>
  1157. </strong>Use <strong>SpriteMove </strong>to move a sprite a
  1158. specified distance in a specified direction.</p>
  1159.  
  1160. <hr>
  1161.  
  1162. <p><a name="SpriteDefineCollisionRect Method"><font
  1163. color="#0000FF" size="4"><strong>SpriteDefineCollisionRect Method</strong></font></a></p>
  1164.  
  1165. <p>Defines a more precise collision rectangle for a sprite.</p>
  1166.  
  1167. <p><br>
  1168. <strong>Syntax</strong><br>
  1169. ASprite.<strong>SpriteDefineCollisionRect(long lSpriteNum, long
  1170. lLeft, long lTop, long lRight, long lBottom) </strong><br>
  1171. </p>
  1172.  
  1173. <p><strong>Parameters</strong></p>
  1174.  
  1175. <table border="0">
  1176.     <tr>
  1177.         <td><strong>lSpriteNum<br>
  1178.         </strong></td>
  1179.         <td>The number of the sprite you are defining a collision
  1180.         rectangle for. <br>
  1181.         </td>
  1182.     </tr>
  1183.     <tr>
  1184.         <td><strong>lLeft,lTop,lRight,lBottom <br>
  1185.         </strong></td>
  1186.         <td>The coordinates of the collision rectangle for the
  1187.         sprite.</td>
  1188.     </tr>
  1189. </table>
  1190.  
  1191. <p><strong>Return Values</strong></p>
  1192.  
  1193. <table border="0">
  1194.     <tr>
  1195.         <td width="10%"> </td>
  1196.         <td>No return value.</td>
  1197.     </tr>
  1198. </table>
  1199.  
  1200. <p><strong>Remarks<br>
  1201. </strong>Use <strong>SpriteDefineCollisionRect </strong>to create
  1202. more precise collision determinations between sprites. For
  1203. example, you may have a sprite which is 50 pixels high by 50
  1204. pixels wide, but much of this area is transparent background. You
  1205. wouldn't want a collision detected on this background area, so
  1206. you can use this method to make a diminished rectangle on the
  1207. sprite's surface.</p>
  1208.  
  1209. <p><strong>Example<br>
  1210. </strong><font size="2" face="Courier New">ASprite1.hWnd =
  1211. Form1.hWnd<br>
  1212. ASprite1.DrawInit 640, 480, 8, 0<br>
  1213. ASprite1.SpriteLoad "example.bmp", 2, 11<br>
  1214. </font><font color="#008000" size="2" face="Courier New">'Define
  1215. a sprite which is 60 pixels wide by 50 pixels high.<br>
  1216. </font><font size="2" face="Courier New">ASprite1.SpriteDefine 0,
  1217. 1, 1, 0, 0, 60, 50, 72, 9, 1, 1<br>
  1218. </font><font color="#008000" size="2" face="Courier New">'Set the
  1219. collision rectangle to (20,2,38,42). If this was not done,</font><font
  1220. size="2" face="Courier New"><br>
  1221. </font><font color="#008000" size="2" face="Courier New">'then a
  1222. collision would be detected within (0,0,60,50).</font><font
  1223. size="2" face="Courier New"><br>
  1224. ASprite1.SpriteDefineCollisionRect 0, 20, 2, 38, 42<br>
  1225. </font></p>
  1226.  
  1227. <hr>
  1228.  
  1229. <p><a name="SpriteGetDirection Method"><font color="#0000FF"
  1230. size="4"><strong>SpriteGetDirection Method</strong></font></a></p>
  1231.  
  1232. <p>Gets the last direction sprite was moved in with a call to <a
  1233. href="#SpriteMove Method">SpriteMove</a>.</p>
  1234.  
  1235. <p><br>
  1236. <strong>Syntax</strong><br>
  1237. lDirection = ASprite.<strong>SpriteGetDirection(long lSpriteNum) </strong><br>
  1238. </p>
  1239.  
  1240. <p><strong>Parameters</strong></p>
  1241.  
  1242. <table border="0">
  1243.     <tr>
  1244.         <td><strong>lSpriteNum <br>
  1245.         </strong></td>
  1246.         <td>The number of the sprite you want the last moved
  1247.         direction for.<br>
  1248.         </td>
  1249.     </tr>
  1250. </table>
  1251.  
  1252. <p><strong>Return Values</strong></p>
  1253.  
  1254. <table border="0">
  1255.     <tr>
  1256.         <td width="10%"> </td>
  1257.         <td width="400">The last direction sprite was moved in:<table
  1258.         border="0">
  1259.             <tr>
  1260.                 <td>1 </td>
  1261.                 <td>Sprite was last moved right.</td>
  1262.             </tr>
  1263.             <tr>
  1264.                 <td>2</td>
  1265.                 <td>Sprite was last moved down and right.</td>
  1266.             </tr>
  1267.             <tr>
  1268.                 <td>3</td>
  1269.                 <td>Sprite was last moved down.</td>
  1270.             </tr>
  1271.             <tr>
  1272.                 <td>4</td>
  1273.                 <td>Sprite was last moved down and left.</td>
  1274.             </tr>
  1275.             <tr>
  1276.                 <td>5</td>
  1277.                 <td>Sprite was last moved left.</td>
  1278.             </tr>
  1279.             <tr>
  1280.                 <td>6</td>
  1281.                 <td>Sprite was last moved up and left.</td>
  1282.             </tr>
  1283.             <tr>
  1284.                 <td>7</td>
  1285.                 <td>Sprite was last moved up.</td>
  1286.             </tr>
  1287.             <tr>
  1288.                 <td>8</td>
  1289.                 <td>Sprite was last moved up and right.</td>
  1290.             </tr>
  1291.         </table>
  1292.         </td>
  1293.     </tr>
  1294. </table>
  1295.  
  1296. <p><strong>Remarks<br>
  1297. </strong>Use SpriteGetDirection to get the last direction the
  1298. sprite was moved in with a call to <a href="#SpriteMove Method">SpriteMove</a>.
  1299. This is useful for movement algorithms of sprites.</p>
  1300.  
  1301. <hr>
  1302.  
  1303. <p><a name="SpriteGetFrame Method"><font color="#0000FF" size="4"><strong>SpriteGetFrame
  1304. Method</strong></font></a></p>
  1305.  
  1306. <p>Gets a sprite's current animation frame.</p>
  1307.  
  1308. <p><br>
  1309. <strong>Syntax</strong><br>
  1310. ASprite.<strong>SpriteGetFrame(long lSpriteNum) </strong><br>
  1311. </p>
  1312.  
  1313. <p><strong>Parameters</strong></p>
  1314.  
  1315. <table border="0">
  1316.     <tr>
  1317.         <td><strong>lSpriteNum<br>
  1318.         </strong></td>
  1319.         <td>The number of the sprite you are getting the current
  1320.         animation frame number for.<br>
  1321.         </td>
  1322.     </tr>
  1323. </table>
  1324.  
  1325. <p><strong>Return Values</strong></p>
  1326.  
  1327. <table border="0">
  1328.     <tr>
  1329.         <td width="10%"> </td>
  1330.         <td>returns the number of the current animation frame.</td>
  1331.     </tr>
  1332. </table>
  1333.  
  1334. <p><strong>Remarks<br>
  1335. </strong>Sprites can have multiple frames to provide animation
  1336. capabilities. Use SpriteDefine to set up animation frames for a
  1337. sprite.</p>
  1338.  
  1339. <hr>
  1340.  
  1341. <p><a name="SpriteGetXPosition, SpriteGetYPosition Methods"><font
  1342. color="#0000FF" size="4"><strong>SpriteGetXPosition,
  1343. SpriteGetYPosition Methods</strong></font></a></p>
  1344.  
  1345. <p>Gets the X,Y coordinates of a sprite.</p>
  1346.  
  1347. <p><br>
  1348. <strong>Syntax</strong><br>
  1349. ASprite.<strong>SpriteGetXPosition(long lSpriteNum) </strong><br>
  1350. </p>
  1351.  
  1352. <p><strong>Parameters</strong></p>
  1353.  
  1354. <table border="0">
  1355.     <tr>
  1356.         <td><strong>lSpriteNum<br>
  1357.         </strong></td>
  1358.         <td>The number of the sprite you are getting X,Y
  1359.         coordinates for.<br>
  1360.         </td>
  1361.     </tr>
  1362. </table>
  1363.  
  1364. <p><strong>Return Values</strong></p>
  1365.  
  1366. <table border="0">
  1367.     <tr>
  1368.         <td width="10%"> </td>
  1369.         <td>returns the X or Y screen coordinate of a sprite.</td>
  1370.     </tr>
  1371. </table>
  1372.  
  1373. <hr>
  1374.  
  1375. <p><a name="SpriteSetFrame Method"><font color="#0000FF" size="4"><strong>SpriteSetFrame
  1376. Method</strong></font></a></p>
  1377.  
  1378. <p>Sets the current animation frame for a sprite.</p>
  1379.  
  1380. <p><br>
  1381. <strong>Syntax</strong><br>
  1382. ASprite.<strong>SpriteSetFrame(long lSpriteNum, short lFrameNum) </strong><br>
  1383. </p>
  1384.  
  1385. <p><strong>Parameters</strong></p>
  1386.  
  1387. <table border="0">
  1388.     <tr>
  1389.         <td><strong>lSpriteNum<br>
  1390.         </strong></td>
  1391.         <td>The number of the sprite you are setting the
  1392.         animation frame for.<br>
  1393.         </td>
  1394.     </tr>
  1395.     <tr>
  1396.         <td><strong>lFrameNum <br>
  1397.         </strong></td>
  1398.         <td>The number of the animation frame you wish to go to.</td>
  1399.     </tr>
  1400. </table>
  1401.  
  1402. <p><strong>Return Values</strong></p>
  1403.  
  1404. <table border="0">
  1405.     <tr>
  1406.         <td width="10%"> </td>
  1407.         <td>No return value.</td>
  1408.     </tr>
  1409. </table>
  1410.  
  1411. <p><strong>Remarks<br>
  1412. </strong>Use <strong>SpriteSetNextFrame </strong>and<strong>
  1413. SpriteSetPrevFrame </strong>to automatically go to the next or
  1414. previous animation frames for a sprite.<font size="2"
  1415. face="Courier New"><br>
  1416. </font></p>
  1417.  
  1418. <hr>
  1419.  
  1420. <p><a name="SpriteGetActive Method"><font color="#0000FF"
  1421. size="4"><strong>SpriteGetActive Method</strong></font></a></p>
  1422.  
  1423. <p>Gets the active state for a sprite.</p>
  1424.  
  1425. <p><br>
  1426. <strong>Syntax</strong><br>
  1427. ASprite.<strong>SpriteGetActive(long lSpriteNum) </strong><br>
  1428. </p>
  1429.  
  1430. <p><strong>Parameters</strong></p>
  1431.  
  1432. <table border="0">
  1433.     <tr>
  1434.         <td><strong>lSpriteNum<br>
  1435.         </strong></td>
  1436.         <td>The number of the sprite you want the active state
  1437.         of.<br>
  1438.         </td>
  1439.     </tr>
  1440. </table>
  1441.  
  1442. <p><strong>Return Values</strong></p>
  1443.  
  1444. <table border="0">
  1445.     <tr>
  1446.         <td width="10%">TRUE </td>
  1447.         <td>The sprite is active</td>
  1448.     </tr>
  1449.     <tr>
  1450.         <td>FALSE </td>
  1451.         <td>The sprite is inactive</td>
  1452.     </tr>
  1453. </table>
  1454.  
  1455. <p><strong>Remarks<br>
  1456. </strong>Setting the active state of a sprite is useful for
  1457. destroying sprites (e.g. a spaceship blows up an asteroid). If a
  1458. sprite is Inactive, it is not displayed when SpriteDisplay is
  1459. called.</p>
  1460.  
  1461. <hr>
  1462.  
  1463. <p><a name="SpriteSetActive Method"><font color="#0000FF"
  1464. size="4"><strong>SpriteSetActive Method</strong></font></a></p>
  1465.  
  1466. <p>Sets the active state for a sprite.</p>
  1467.  
  1468. <p><br>
  1469. <strong>Syntax</strong><br>
  1470. ASprite.<strong>SpriteSetActive(long lSpriteNum, BOOL bActive) </strong><br>
  1471. </p>
  1472.  
  1473. <p><strong>Parameters</strong></p>
  1474.  
  1475. <table border="0">
  1476.     <tr>
  1477.         <td><strong>lSpriteNum<br>
  1478.         </strong></td>
  1479.         <td>The number of the sprite you want to set the active
  1480.         state of.<br>
  1481.         </td>
  1482.     </tr>
  1483.     <tr>
  1484.         <td><strong>bActive</strong></td>
  1485.         <td>TRUE for setting sprite active, FALSE for setting
  1486.         inactive</td>
  1487.     </tr>
  1488. </table>
  1489.  
  1490. <p><strong>Return Values</strong></p>
  1491.  
  1492. <table border="0">
  1493.     <tr>
  1494.         <td width="10%"> </td>
  1495.         <td>No return value.</td>
  1496.     </tr>
  1497. </table>
  1498.  
  1499. <p><strong>Remarks<br>
  1500. </strong>Setting the active state of a sprite is useful for
  1501. destroying sprites (e.g. a spaceship blows up an asteroid). If a
  1502. sprite is Inactive, it is not displayed when SpriteDisplay is
  1503. called.</p>
  1504.  
  1505. <hr>
  1506.  
  1507. <p><a name="SpriteSetNextFrame, SpriteSetPrevFrame Methods"><font
  1508. color="#0000FF" size="4"><strong>SpriteSetNextFrame,
  1509. SpriteSetPrevFrame Methods</strong></font></a></p>
  1510.  
  1511. <p>Increments or decrements the current animation frame number
  1512. for a sprite.</p>
  1513.  
  1514. <p><br>
  1515. <strong>Syntax</strong><br>
  1516. ASprite.<strong>SpriteSetNextFrame(long lSpriteNum) </strong><br>
  1517. ASprite.<strong>SpriteSetPrevFrame(long lSpriteNum) </strong><br>
  1518. </p>
  1519.  
  1520. <p><strong>Parameters</strong></p>
  1521.  
  1522. <table border="0">
  1523.     <tr>
  1524.         <td><strong>lSpriteNum<br>
  1525.         </strong></td>
  1526.         <td>The number of the sprite you want to set the
  1527.         animation frame for.<br>
  1528.         </td>
  1529.     </tr>
  1530. </table>
  1531.  
  1532. <p><strong>Return Values</strong></p>
  1533.  
  1534. <table border="0">
  1535.     <tr>
  1536.         <td width="10%"> </td>
  1537.         <td>No return value.</td>
  1538.     </tr>
  1539. </table>
  1540.  
  1541. <p><strong>Remarks<br>
  1542. </strong>Use these methods to easily increment the animation
  1543. frame for a sprite. When the animation hits the last frame, it
  1544. will automatically go back to the first frame (or vice-versa for
  1545. SpriteSetPrevFrame).</p>
  1546.  
  1547. <hr>
  1548.  
  1549. <p><a name="SpriteSetPosition Method"><font color="#0000FF"
  1550. size="4"><strong>SpriteSetPosition Method</strong></font></a></p>
  1551.  
  1552. <p><strong>Remarks<br>
  1553. </strong>This method is duplicated by the <a
  1554. href="#SpriteMove Method">SpriteMove</a> method.</p>
  1555.  
  1556. <p> </p>
  1557.  
  1558. <hr>
  1559.  
  1560. <p><a name="SpriteTestCollision Method"><font color="#0000FF"
  1561. size="4"><strong>SpriteTestCollision Method</strong></font></a></p>
  1562.  
  1563. <p>Determines whether two sprites collide.</p>
  1564.  
  1565. <p><br>
  1566. <strong>Syntax</strong><br>
  1567. ASprite.<strong>SpriteTestCollision(long lSprite1, long lSprite2)
  1568. </strong><br>
  1569. </p>
  1570.  
  1571. <p><strong>Parameters</strong></p>
  1572.  
  1573. <table border="0">
  1574.     <tr>
  1575.         <td><strong>lSprite1 <br>
  1576.         </strong></td>
  1577.         <td>The number of the first sprite in the collision test.<br>
  1578.         </td>
  1579.     </tr>
  1580.     <tr>
  1581.         <td><strong>lSprite2</strong></td>
  1582.         <td>The number of the seconds sprite in the collision
  1583.         test.</td>
  1584.     </tr>
  1585. </table>
  1586.  
  1587. <p><strong>Return Values</strong></p>
  1588.  
  1589. <table border="0">
  1590.     <tr>
  1591.         <td width="10%">TRUE </td>
  1592.         <td>The sprites collide.</td>
  1593.     </tr>
  1594.     <tr>
  1595.         <td>FALSE </td>
  1596.         <td>The sprites do not collide.</td>
  1597.     </tr>
  1598. </table>
  1599.  
  1600. <p><strong>Remarks<br>
  1601. </strong>Two sprites collide if their frames occupy the same
  1602. space on the screen. However, you can make this frame area more
  1603. precise by using <a href="#SpriteDefineCollisionRect Method"><strong>SpriteDefineCollisionRect</strong></a><strong>.</strong></p>
  1604.  
  1605. <hr>
  1606.  
  1607. <p><a name="TextSetAttributes Method"><font color="#0000FF"
  1608. size="4"><strong>TextSetAttributes Method</strong></font></a></p>
  1609.  
  1610. <p>Sets the attributes for text displayed on the back buffer.</p>
  1611.  
  1612. <p><br>
  1613. <strong>Syntax</strong><br>
  1614. ASprite.<strong>TextSetAttributes(long lWidth, long lHeight, <br>
  1615. LPCTSTR lpctstrFace, long lFontSize, <br>
  1616. double dForeColor, double dBackColor) </strong><br>
  1617. </p>
  1618.  
  1619. <p><strong>Parameters</strong></p>
  1620.  
  1621. <table border="0">
  1622.     <tr>
  1623.         <td><strong>lWidth <br>
  1624.         </strong></td>
  1625.         <td>The width, in pixels, of the text window.<br>
  1626.         </td>
  1627.     </tr>
  1628.     <tr>
  1629.         <td><strong>lHeight</strong></td>
  1630.         <td>The height, in pixels, of the text window.</td>
  1631.     </tr>
  1632.     <tr>
  1633.         <td><strong>lpctstrFace</strong></td>
  1634.         <td>The font name to use, e.g. "Arial"</td>
  1635.     </tr>
  1636.     <tr>
  1637.         <td><strong>lFontSize</strong></td>
  1638.         <td>The font size to use, in points.</td>
  1639.     </tr>
  1640.     <tr>
  1641.         <td><strong>dForeColor </strong></td>
  1642.         <td>The forecolor of the text to display.</td>
  1643.     </tr>
  1644.     <tr>
  1645.         <td><strong>dBackColor <br>
  1646.         </strong></td>
  1647.         <td>The backcolor of the text to display. To make the
  1648.         background transparent, you should use RGB(0,0,0).</td>
  1649.     </tr>
  1650. </table>
  1651.  
  1652. <p><strong>Return Values</strong></p>
  1653.  
  1654. <table border="0">
  1655.     <tr>
  1656.         <td width="10%"> </td>
  1657.         <td>no return value.</td>
  1658.     </tr>
  1659. </table>
  1660.  
  1661. <p><strong>Remarks<br>
  1662. </strong>You can think of displaying text as making a window onto
  1663. the back buffer. You should re-use these windows whenever
  1664. possible, to save resources.<br>
  1665. <br>
  1666. <strong>Example<br>
  1667. </strong><font size="2" face="Courier New">ASprite1.hWnd =
  1668. Form1.hWnd<br>
  1669. ASprite1.DrawInit 640, 480, 8, 0<br>
  1670. </font><font color="#008000" size="2" face="Courier New">'Define
  1671. a text window which is 320 pixels wide by 30 pixels high.<br>
  1672. 'it will use Arial 16 point font colored white, and the
  1673. background<br>
  1674. 'will be transparent.<br>
  1675. </font><font size="2" face="Courier New">ASprite1.TextSetAttributes
  1676. 320, 30, "Arial", 16, _<br>
  1677. RGB(255, 255, 255), RGB(0, 0, 0)<br>
  1678. ASprite1.DrawFloodFill 0<br>
  1679. ASprite1.TextDisplay "This text will be at the upper left
  1680. corner", 1, 1<br>
  1681. ASprite1.TextDisplay "You should re-use your text
  1682. windows!", 1, 200<br>
  1683. ASprite1.DrawFlipBackBuffer<br>
  1684. <br>
  1685. </font></p>
  1686.  
  1687. <hr>
  1688.  
  1689. <p><a name="TextDisplay Method"><font color="#0000FF" size="4"><strong>TextDisplay
  1690. Method</strong></font></a></p>
  1691.  
  1692. <p>Displays a text window to the back buffer.</p>
  1693.  
  1694. <p><br>
  1695. <strong>Syntax</strong><br>
  1696. ASprite.<strong>TextDisplay(string lpctstrString, long lX, long
  1697. lY) </strong><br>
  1698. </p>
  1699.  
  1700. <p><strong>Parameters</strong></p>
  1701.  
  1702. <table border="0">
  1703.     <tr>
  1704.         <td><strong>lpctstrString <br>
  1705.         </strong></td>
  1706.         <td>The text string you wish to display.<br>
  1707.         </td>
  1708.     </tr>
  1709.     <tr>
  1710.         <td><strong>lX</strong></td>
  1711.         <td>The X coordinate you wish to place the text window
  1712.         at.</td>
  1713.     </tr>
  1714.     <tr>
  1715.         <td><strong>lY</strong></td>
  1716.         <td>The Y coordinate you wish to place the text window
  1717.         at.</td>
  1718.     </tr>
  1719. </table>
  1720.  
  1721. <p><strong>Return Values</strong></p>
  1722.  
  1723. <table border="0">
  1724.     <tr>
  1725.         <td width="10%"> </td>
  1726.         <td>No return value.</td>
  1727.     </tr>
  1728. </table>
  1729.  
  1730. <p><strong>Remarks<br>
  1731. </strong>See the <a href="#TextSetAttributes Method"><strong>TextSetAttributes</strong></a><strong>
  1732. </strong>for information and an example.</p>
  1733.  
  1734. <hr>
  1735.  
  1736. <p><a name="SoundInit Method"><font color="#0000FF" size="4"><strong>SoundInit
  1737. Method</strong></font></a></p>
  1738.  
  1739. <p>Initializes DirectSound sound services.</p>
  1740.  
  1741. <p><br>
  1742. <strong>Syntax</strong><br>
  1743. ASprite.<strong>SoundInit()</strong><br>
  1744. </p>
  1745.  
  1746. <p><strong>Return Values</strong></p>
  1747.  
  1748. <table border="0">
  1749.     <tr>
  1750.         <td width="10%">0</td>
  1751.         <td>Success.</td>
  1752.     </tr>
  1753.     <tr>
  1754.         <td>1</td>
  1755.         <td>DSOUND.DLL not found; DirectSound not installed.</td>
  1756.     </tr>
  1757.     <tr>
  1758.         <td>2</td>
  1759.         <td>Could not create DirectSound object.</td>
  1760.     </tr>
  1761.     <tr>
  1762.         <td>3</td>
  1763.         <td>Could not get exclusive access.</td>
  1764.     </tr>
  1765. </table>
  1766.  
  1767. <p><strong>Remarks<br>
  1768. </strong>You must call SoundInit prior to any other Sound
  1769. methods.</p>
  1770.  
  1771. <hr>
  1772.  
  1773. <p><a name="SoundDisable Method"><font color="#0000FF" size="4"><strong>SoundDisable
  1774. Method</strong></font></a></p>
  1775.  
  1776. <p>Disables DirectSound sound services and frees any associated
  1777. resources.</p>
  1778.  
  1779. <p><br>
  1780. <strong>Syntax</strong><br>
  1781. ASprite.<strong>SoundDisable()</strong><br>
  1782. </p>
  1783.  
  1784. <p><strong>Return Values</strong></p>
  1785.  
  1786. <table border="0">
  1787.     <tr>
  1788.         <td width="10%">0 </td>
  1789.         <td>Success.</td>
  1790.     </tr>
  1791. </table>
  1792.  
  1793. <p><strong>Remarks<br>
  1794. </strong>You should always call SoundDisable after completing all
  1795. sound processing. This releases resources which SoundInit
  1796. collected.<br>
  1797. </p>
  1798.  
  1799. <hr>
  1800.  
  1801. <p><a name="SoundLoad Method"><font color="#0000FF" size="4"><strong>SoundLoad
  1802. Method</strong></font></a></p>
  1803.  
  1804. <p>Loads a WAV file into memory for playback using the SoundPlay
  1805. method.</p>
  1806.  
  1807. <p><br>
  1808. <strong>Syntax</strong><br>
  1809. ASprite.<strong>SoundLoad(long lSoundNum, string lpctstrFileName)
  1810. </strong><br>
  1811. <br>
  1812. </p>
  1813.  
  1814. <p><strong>Parameters</strong></p>
  1815.  
  1816. <table border="0">
  1817.     <tr>
  1818.         <td><strong>lSoundNum <br>
  1819.         </strong></td>
  1820.         <td>The sound number to assign. You should start at 0 and
  1821.         increment for each sound you load.<br>
  1822.         </td>
  1823.     </tr>
  1824.     <tr>
  1825.         <td><strong>lpctstrFileName</strong></td>
  1826.         <td>The filename of the WAV file you wish to load.</td>
  1827.     </tr>
  1828. </table>
  1829.  
  1830. <p><strong>Return Values</strong></p>
  1831.  
  1832. <table border="0">
  1833.     <tr>
  1834.         <td width="10%">0 </td>
  1835.         <td>Success.</td>
  1836.     </tr>
  1837.     <tr>
  1838.         <td>1</td>
  1839.         <td>Could not load WAV file.</td>
  1840.     </tr>
  1841. </table>
  1842.  
  1843. <p><strong>Remarks<br>
  1844. </strong>You should always call SoundDisable after completing all
  1845. sound processing. This releases resources which SoundInit
  1846. collected.</p>
  1847.  
  1848. <hr>
  1849.  
  1850. <p><a name="SoundPlay Method"><font color="#0000FF" size="4"><strong>SoundPlay
  1851. Method</strong></font></a></p>
  1852.  
  1853. <p>Plays a sound previously loaded with the SoundLoad method.</p>
  1854.  
  1855. <p><br>
  1856. <strong>Syntax</strong><br>
  1857. ASprite.<strong>SoundPlay(long lSoundNum) </strong></p>
  1858.  
  1859. <p><strong>Parameters</strong></p>
  1860.  
  1861. <table border="0">
  1862.     <tr>
  1863.         <td><strong>lSoundNum <br>
  1864.         </strong></td>
  1865.         <td>The number of the sound you want to play.<br>
  1866.         </td>
  1867.     </tr>
  1868. </table>
  1869.  
  1870. <p><strong>Return Values</strong></p>
  1871.  
  1872. <table border="0">
  1873.     <tr>
  1874.         <td width="10%">0 </td>
  1875.         <td>Success</td>
  1876.     </tr>
  1877.     <tr>
  1878.         <td>1</td>
  1879.         <td>Sound not loaded.</td>
  1880.     </tr>
  1881.     <tr>
  1882.         <td>2</td>
  1883.         <td>Error while playing.</td>
  1884.     </tr>
  1885. </table>
  1886.  
  1887. <p><strong>Remarks<br>
  1888. </strong>Use the SoundPlay method to play a sound in a buffered
  1889. manner. Buffered sounds are mixed together to provide better
  1890. sound. For example, you can buffer the sound of a gun blast
  1891. followed by an explosion, and both sounds will continue to play
  1892. for a realistic effect.<br>
  1893. <br>
  1894. <strong>Example<br>
  1895. </strong><font color="#008000" size="2" face="Courier New">'Initialize
  1896. sound services, load a wave file, and play it in the buffer.<br>
  1897. 'note that gun.wav must exist in the current working directory.<br>
  1898. </font><font size="2" face="Courier New">ASprite1.hWnd =
  1899. Form1.hWnd<br>
  1900. ASprite1.SoundInit<br>
  1901. ASprite1.SoundLoad 0, "gun.wav"<br>
  1902. ...<br>
  1903. ASprite1.SoundPlay 0<br>
  1904. ...<br>
  1905. ASprite1.SoundDisable<br>
  1906. </font></p>
  1907.  
  1908. <hr>
  1909.  
  1910. <p><a name="SoundPlayLoop Method"><font color="#0000FF" size="4"><strong>SoundPlayLoop
  1911. Method</strong></font></a></p>
  1912.  
  1913. <p>Starts playing a sound in a looping manner. When the sound
  1914. reaches its end, it will automatically begin replaying at its
  1915. beginning. The sound must have been previously loaded with the
  1916. SoundLoad method.</p>
  1917.  
  1918. <p><br>
  1919. <strong>Syntax</strong><br>
  1920. ASprite.<strong>SoundPlayLoop(long lSoundNum) </strong></p>
  1921.  
  1922. <p><strong>Parameters</strong></p>
  1923.  
  1924. <table border="0">
  1925.     <tr>
  1926.         <td><strong>lSoundNum <br>
  1927.         </strong></td>
  1928.         <td>The number of the sound you want to play.<br>
  1929.         </td>
  1930.     </tr>
  1931. </table>
  1932.  
  1933. <p><strong>Return Values</strong></p>
  1934.  
  1935. <table border="0">
  1936.     <tr>
  1937.         <td width="10%">0 </td>
  1938.         <td>Success</td>
  1939.     </tr>
  1940.     <tr>
  1941.         <td>1</td>
  1942.         <td>Sound not loaded.</td>
  1943.     </tr>
  1944.     <tr>
  1945.         <td>2</td>
  1946.         <td>Error while playing.</td>
  1947.     </tr>
  1948. </table>
  1949.  
  1950. <p><strong>Remarks<br>
  1951. </strong>Use the SoundStopLoop method to STOP a sound started
  1952. with the SoundPlayLoop method. These functions are useful for
  1953. "background" noises that are repetitive, such as a
  1954. helicopter whoop or cheers from a crowd.</p>
  1955.  
  1956. <hr>
  1957.  
  1958. <p><a name="SoundStopLoop Method"><font color="#0000FF" size="4"><strong>SoundStopLoop
  1959. Method</strong></font></a></p>
  1960.  
  1961. <p>Stops playing a sound which was started looping with
  1962. SoundPlayLoop. </p>
  1963.  
  1964. <p><br>
  1965. <strong>Syntax</strong><br>
  1966. ASprite.<strong>SoundStopLoop(long lSoundNum) </strong></p>
  1967.  
  1968. <p><strong>Parameters</strong></p>
  1969.  
  1970. <table border="0">
  1971.     <tr>
  1972.         <td><strong>lSoundNum <br>
  1973.         </strong></td>
  1974.         <td>The number of the sound you want to stop looping.<br>
  1975.         </td>
  1976.     </tr>
  1977. </table>
  1978.  
  1979. <p><strong>Return Values</strong></p>
  1980.  
  1981. <table border="0">
  1982.     <tr>
  1983.         <td width="10%">0 </td>
  1984.         <td>Success</td>
  1985.     </tr>
  1986.     <tr>
  1987.         <td>1</td>
  1988.         <td>Sound not loaded.</td>
  1989.     </tr>
  1990.     <tr>
  1991.         <td>2</td>
  1992.         <td>Error while playing.</td>
  1993.     </tr>
  1994. </table>
  1995.  
  1996. <p><strong>Remarks<br>
  1997. </strong>Use the SoundStopLoop method to STOP a sound started
  1998. with the SoundPlayLoop method. </p>
  1999.  
  2000. <hr>
  2001.  
  2002. <p><a name="SoundPlayFile Method"><font color="#0000FF" size="4"><strong>SoundPlayFile
  2003. Method</strong></font></a></p>
  2004.  
  2005. <p>Plays a WAV file from disk, without using DirectSound to
  2006. provide buffering.</p>
  2007.  
  2008. <p><br>
  2009. <strong>Syntax</strong><br>
  2010. ASprite.<strong>SoundPlayFile(string sFileName) </strong></p>
  2011.  
  2012. <p><strong>Parameters</strong></p>
  2013.  
  2014. <table border="0">
  2015.     <tr>
  2016.         <td><strong>sFileName <br>
  2017.         </strong></td>
  2018.         <td>the filename of the WAV file you want to play.<br>
  2019.         </td>
  2020.     </tr>
  2021. </table>
  2022.  
  2023. <p><strong>Return Values</strong></p>
  2024.  
  2025. <table border="0">
  2026.     <tr>
  2027.         <td width="10%"> </td>
  2028.         <td>no return value</td>
  2029.     </tr>
  2030. </table>
  2031.  
  2032. <p><strong>Remarks<br>
  2033. </strong>Use the SoundPlayFile method to play a sound from a WAV
  2034. file without using the overhead of DirectSound. SoundPlayFile
  2035. utilizes the older, unbuffered Windows multimedia command. This
  2036. means you cannot "mix" sounds together like you can by
  2037. using <a href="#SoundInit Method">SoundInit</a>, <a
  2038. href="#SoundLoad Method">SoundLoad</a>, and <a
  2039. href="#SoundPlay Method">SoundPlay</a> which do use the newer
  2040. DirectSound API to buffer the sounds.</p>
  2041.  
  2042. <hr>
  2043.  
  2044. <p><a name="SoundSetVolume Method"><font color="#0000FF" size="4"><strong>SoundSetVolume
  2045. Method</strong></font></a></p>
  2046.  
  2047. <p>Sets the volume for playing back sounds with the SoundPlay
  2048. method.<br>
  2049. <br>
  2050. <strong>Syntax</strong><br>
  2051. ASprite.<strong>SoundSetVolume(long lVolume)</strong></p>
  2052.  
  2053. <p><strong>Parameters</strong></p>
  2054.  
  2055. <table border="0">
  2056.     <tr>
  2057.         <td><strong>lVolume <br>
  2058.         </strong></td>
  2059.         <td>New volume requested for this sound buffer. Values
  2060.         range <br>
  2061.         from 0 (no volume adjustment) to -10,000 (-100 dB, <br>
  2062.         essentially silent). Amplification is NOT supported.</td>
  2063.     </tr>
  2064. </table>
  2065.  
  2066. <p><strong>Return Values</strong></p>
  2067.  
  2068. <table border="0">
  2069.     <tr>
  2070.         <td width="10%">0</td>
  2071.         <td>Success</td>
  2072.     </tr>
  2073.     <tr>
  2074.         <td>1</td>
  2075.         <td>lVolume is out of range.</td>
  2076.     </tr>
  2077. </table>
  2078.  
  2079. <p><strong>Remarks<br>
  2080. </strong>Note that a value of Zero for lVolume will play the
  2081. sound at it's normal level, and a negative value will play the
  2082. sound at lower than normal level. Amplification is NOT supported.<br>
  2083. </p>
  2084.  
  2085. <p><strong>Example</strong><br>
  2086. <font color="#008000" size="2" face="Courier New">'Decrease the
  2087. volume by 100</font><font size="2" face="Courier New"><br>
  2088. ASprite1.SoundSetVolume (ASprite1.SoundGetVolume() - 100)<br>
  2089. </font><font color="#008000" size="2" face="Courier New">'Any
  2090. subsequent sounds played will be affected!</font><font size="2"
  2091. face="Courier New"><br>
  2092. ASprite1.SoundPlay 1</font></p>
  2093.  
  2094. <hr>
  2095.  
  2096. <p><a name="SoundGetVolume Method"><font color="#0000FF" size="4"><strong>SoundGetVolume
  2097. Method</strong></font></a></p>
  2098.  
  2099. <p>Returns the current volume for playing back sounds with the
  2100. SoundPlay method.<br>
  2101. <br>
  2102. <strong>Syntax</strong><br>
  2103. lSoundLevel = ASprite1.<strong>SoundGetVolume()</strong></p>
  2104.  
  2105. <p><strong>Parameters</strong></p>
  2106.  
  2107. <table border="0">
  2108.     <tr>
  2109.         <td><strong>none.</strong></td>
  2110.         <td> </td>
  2111.     </tr>
  2112. </table>
  2113.  
  2114. <p><strong>Return Values<br>
  2115. </strong>Returns the current sound level for playing back sounds.
  2116. Values range from 0 (no volume adjustment) to -10,000 (-100 dB,
  2117. essentially silent). </p>
  2118.  
  2119. <p><strong>Remarks<br>
  2120. </strong>Use the SoundGetVolume function in conjunction with
  2121. SoundSetVolume to control the level at which a wav file is played
  2122. back.<br>
  2123. </p>
  2124.  
  2125. <p><strong>Example</strong><br>
  2126. <font color="#008000" size="2" face="Courier New">'Decrease the
  2127. volume by 100</font><font size="2" face="Courier New"><br>
  2128. ASprite1.SoundSetVolume (ASprite1.SoundGetVolume() - 100)<br>
  2129. </font><font color="#008000" size="2" face="Courier New">'Any
  2130. subsequent sounds played will be affected!</font><font size="2"
  2131. face="Courier New"><br>
  2132. ASprite1.SoundPlay 1</font></p>
  2133.  
  2134. <hr>
  2135.  
  2136. <p><a name="TimerGetTickCount Method"><font color="#0000FF"
  2137. size="4"><strong>TimerGetTickCount Method</strong></font></a></p>
  2138.  
  2139. <p>Returns the number of milliseconds which have passed since
  2140. Windows was started.</p>
  2141.  
  2142. <p><br>
  2143. <strong>Syntax</strong><br>
  2144. lTickCount = ASprite.<strong>TimerGetTickCount</strong></p>
  2145.  
  2146. <p><strong>Return Values</strong></p>
  2147.  
  2148. <table border="0">
  2149.     <tr>
  2150.         <td width="10%">0 </td>
  2151.         <td>Returns the number of milliseconds which have passed
  2152.         since Windows was started.</td>
  2153.     </tr>
  2154. </table>
  2155.  
  2156. <p><strong>Remarks<br>
  2157. </strong>Use the <strong>TimerGetTickCount</strong> method to
  2158. emulate a clean timer. Some development tools such as Visual
  2159. Basic provide a timer which is not adequate (e.g. too
  2160. "choppy") for multimedia programming. By using this
  2161. method, you can ensure your game's frame rate is smooth and
  2162. consistent.<br>
  2163. <br>
  2164. </p>
  2165. </body>
  2166. </html>
  2167.