home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1991-07-30 | 3.5 KB | 140 lines |
- ' ******************************************************
- ' * TD_View2.AMOS by Richard Vanner *
- ' * *
- ' * 1 Move mouse up, down, left and right *
- ' * 2 Press left mouse and move up and down for height *
- ' * 3 Press right mouse button to view spinning disc *
- ' ******************************************************
- Double Buffer
- Autoback 0
- '
- 'Set up 3D to use 200 pixels in Y
- '
- Extension_4_0054 200
- '
- 'Load the 3 objects for the demo
- '
- Extension_4_04D6 ":AMOS_3D_Demos/objects"
- Extension_4_0016 "disc"
- Extension_4_0016 "amiga"
- Extension_4_0016 "monitor"
- '
- ' Position objects within the 3D world
- '
- ' Notice that disc has been used twice
- '
- Extension_4_0036 1,"disc",-2000,800,-3700,16384,0,0
- Extension_4_0036 2,"disc",-3600,20,-3700,-16384,-16384,0
- Extension_4_0036 3,"amiga",-2000,0,-3000,0,0,0
- Extension_4_0036 4,"monitor",-2000,650,-5000,-2000,32768,0
- '
- ' Position the view point (object 0) so that it looks towards the
- ' physical objects
- '
- Extension_4_00EC 0,-2159,1000,-2204
- Extension_4_01A6 0,0,32100,0
- '
- 'Set the palette and remove cursor etc
- '
- Paper 0 : Flash Off : Curs Off
- Palette 0,$FFF,,,,,,,,$FFF,$F,$AAA,$BB9,0,$996
- Hide
- '
- ' OX, OY, XD and YD are used to work out how far the mouse has moved
- ' and in which direction every loop
- '
- ' Main redraw loop
- '
- Repeat
- '
- ' Set OX and OY to the same as the current mouse X,Y position
- ' Also set the mouse into the centre of the screen so that a relative
- ' movement can be monitored.
- '
- OX=X Hard(160) : X Mouse=OX : OY=Y Hard(100) : Y Mouse=OY
- '
- ' Movement of the viewpoint. Depends on user's input via the mouse
- '
- ' Turn Viewpoint left and right
- '
- Extension_4_018C 0,0,LR,0
- '
- ' Move Viewpoint forward
- '
- Extension_4_0100 0,FB
- '
- ' Move Viewpoint up and down (if left mouse button pressed)
- '
- Extension_4_00D4 0,0,UD,0
- '
- ' Spin the disc in front of the monitor
- '
- Extension_4_01A6 1,A,B,C
- A=A+1000
- B=B+600
- C=C+750
- '
- ' Clear the screen and draw all objects
- '
- Cls 0
- Extension_4_0318
- Extension_4_00D4 0,-2700,0,0
- '
- ' Draw the scene again but this time from another viewpoint
- '
- Extension_4_0318
- Extension_4_00D4 0,2700,0,0
- '
- 'Get coordinates and angles of the viewpoint and display them
- 'onto the screen. (This helps you set start points in games and demos)
- '
- PX= Extension_4_0114(0)
- PY= Extension_4_0128(0)
- PZ= Extension_4_013C(0)
- PA= Extension_4_01BC(0)
- PB= Extension_4_01D0(0)
- PC= Extension_4_01E4(0)
- Print At(0,0);"X:";PX;At(13,0);" Y:";PY;At(26,0);" Z:";PZ
- Print At(0,1);"A:";PA;At(13,1);" B:";PB;At(26,1);" C:";PC
- '
- ' Sync the screen redraw with the next vertical blank
- '
- Screen Swap
- Wait Vbl
- '
- ' Check to see if the user has moved the mouse for the next update
- '
- XD=X Mouse-X Hard(160)
- YD=Y Mouse-Y Hard(100)
- '
- ' If mouse has been moved left and right, set XD (X direction)
- '
- If XD<>OX
- LR=XD*50
- End If
- '
- ' If mouse moved up or down
- '
- If YD<>OY
- '
- ' If left mouse pressed, set FB (forward and backward)
- '
- If Mouse Key=0
- FB=YD*10*-1
- UD=0
- End If
- '
- 'If right mouse pressed, set UD (up and down)
- '
- If Mouse Key=1
- UD=YD*10
- FB=0
- End If
- End If
- '
- ' If right button pressed, view point to face spinning disc
- '
- If Mouse Key=2
- Extension_4_01F8 0,1
- End If
- Until False