home *** CD-ROM | disk | FTP | other *** search
/ Amiga Computing 66 / ac066b.adf / AMOS.DMS / AMOS.adf / amos_3d_demos / TD_View.AMOS / TD_View.amosSourceCode
AMOS Source Code  |  1991-07-30  |  3KB  |  134 lines

  1. ' ****************************************************** 
  2. ' *        TD_View.AMOS by Richard Vanner              *   
  3. ' *                                                    * 
  4. ' * 1 Move mouse up, down, left and right              * 
  5. ' * 2 Press left mouse and move up and down for height * 
  6. ' * 3 Press right mouse button to view spinning disc   * 
  7. ' ****************************************************** 
  8. Double Buffer 
  9. Autoback 0
  10. '
  11. 'Set up 3D to use 200 pixels in Y
  12. '
  13.  Extension_4_0054 200
  14. '    
  15. 'Load the 3 objects for the demo 
  16. '
  17.  Extension_4_04D6 ":AMOS_3D_demos/objects"
  18.  Extension_4_0016 "disc"
  19.  Extension_4_0016 "amiga"
  20.  Extension_4_0016 "monitor"
  21. '
  22. ' Position objects within the 3D world 
  23. '
  24. ' Notice that disc has been used twice 
  25. '
  26.  Extension_4_0036 1,"disc",-2000,800,-3700,16384,0,0
  27.  Extension_4_0036 2,"disc",-3600,20,-3700,-16384,-16384,0
  28.  Extension_4_0036 3,"amiga",-2000,0,-3000,0,0,0
  29.  Extension_4_0036 4,"monitor",-2000,650,-5000,-2000,32768,0
  30. '
  31. ' Position the view point (object 0) so that it looks towards the
  32. ' physical objects 
  33. '
  34.  Extension_4_00EC 0,-2159,1000,-2204
  35.  Extension_4_01A6 0,0,32100,0
  36. '
  37. 'Set the palette and remove cursor etc 
  38. '
  39. Paper 0 : Flash Off : Curs Off 
  40. Palette 0,$FFF,,,,,,,,$FFF,$F,$AAA,$BB9,0,$996
  41. Hide 
  42. '
  43. ' OX, OY, XD and YD are used to work out how far the mouse has moved 
  44. ' and in which direction every loop
  45. '
  46. ' Main redraw loop 
  47. '
  48. Repeat 
  49.    '
  50.    ' Set OX and OY to the same as the current mouse X,Y position
  51.    ' Also set the mouse into the centre of the screen so that a relative
  52.    ' movement can be monitored. 
  53.    '
  54.    OX=X Hard(160) : X Mouse=OX : OY=Y Hard(100) : Y Mouse=OY
  55.    '
  56.    ' Movement of the viewpoint. Depends on user's input via the mouse   
  57.    '
  58.    ' Turn Viewpoint left and right
  59.    '
  60.     Extension_4_018C 0,0,LR,0
  61.    '
  62.    ' Move Viewpoint forward 
  63.    '
  64.     Extension_4_0100 0,FB
  65.    '
  66.    ' Move Viewpoint up and down (if left mouse button pressed)
  67.    '
  68.     Extension_4_00D4 0,0,UD,0
  69.    '
  70.    ' Spin the disc in front of the monitor
  71.    '
  72.     Extension_4_01A6 1,A,B,C
  73.    A=A+1000
  74.    B=B+600
  75.    C=C+750
  76.    '
  77.    ' Clear the screen and draw all objects
  78.    '
  79.    Cls 0
  80.     Extension_4_0318 
  81.    '
  82.    'Get coordinates and angles of the viewpoint and display them
  83.    'onto the screen. (This helps you set start points in games and demos) 
  84.    '
  85.    PX= Extension_4_0114(0)
  86.    PY= Extension_4_0128(0)
  87.    PZ= Extension_4_013C(0)
  88.    PA= Extension_4_01BC(0)
  89.    PB= Extension_4_01D0(0)
  90.    PC= Extension_4_01E4(0)
  91.    Print At(0,0);"X:";PX;At(13,0);" Y:";PY;At(26,0);" Z:";PZ
  92.    Print At(0,1);"A:";PA;At(13,1);" B:";PB;At(26,1);" C:";PC
  93.    '
  94.    ' Sync the screen redraw with the next vertical blank
  95.    '
  96.    Screen Swap 
  97.    Wait Vbl 
  98.    '
  99.    ' Check to see if the user has moved the mouse for the next update 
  100.    '
  101.    XD=X Mouse-X Hard(160)
  102.    YD=Y Mouse-Y Hard(100)
  103.    '
  104.    ' If mouse has been moved left and right, set XD (X direction) 
  105.    '
  106.    If XD<>OX
  107.       LR=XD*50
  108.    End If 
  109.    '
  110.    ' If mouse moved up or down
  111.    '
  112.    If YD<>OY
  113.       '
  114.       ' If left mouse pressed, set FB (forward and backward) 
  115.       '
  116.       If Mouse Key=0
  117.          FB=YD*10*-1
  118.          UD=0
  119.       End If 
  120.       '
  121.       'If right mouse pressed, set UD (up and down)
  122.       '
  123.       If Mouse Key=1
  124.          UD=YD*10
  125.          FB=0
  126.       End If 
  127.    End If 
  128.    '  
  129.    ' If right button pressed, view point to face spinning disc
  130.    '
  131.    If Mouse Key=2
  132.        Extension_4_01F8 0,1
  133.    End If 
  134. Until False