*sigh* have to make another post...
Anyway, my code right now is about 310 lines, but i realized just now that you cant exactly turn, you can only move forwards, backwards, and strafe either way. i want to add a feature where you can actually turn, by using..well for now just make it the "G' key for turning left, and the "H" key for turning right (rotating). How do i do this? I know I have to use wrapvalue (from the 3d monster hunt tutorial) but its not doing anything. can someone help me? Here my code.
Rem Project: RPG
Rem Created: 26/06/2004 15:48:37
Rem ***** Main Source File *****
autocam off
hide mouse
randomize 4
rem set variables for player location to the coordinates
player_x#=0
player_y#=0
player_z#=0
rem set the speed variables
rem the speed of the player can be changed by increasing or decreasing this value
player_z_speed#=0.1
player_x_speed#=0.1
player_y_speed#=0.1
rem define money variable
money=0
rem define flyingability
flyingability=0
`the default value for flying ability is 0, meaning that by default the player
`cannot fly
rem set initial camera coordinates
camera_x#=0
camera_y#=17.5
camera_z#=-10
rem set camera speed variables
rem this MUST be the same as the player speeds
camera_x_speed#=0.1
camera_y_speed#=0.1
camera_z_speed#=0.1
rem the camerachange1 is the variable for the initial/default camera view
camerachange=1
`get floor texture
`load image "floortexture.bmp",7
rem create floor
make matrix 6,250,250,10,10
rem create player and house
make object sphere 1,5
make object box 2,8,6,6
`create thing that puts you in the house when you break in
make object box 8,7.9,5.9,5.9
rem crete thing that gives ya flying ability
make object sphere 5,2
scale object 5,50,50,50
rem create money
make object sphere 3,2
make object sphere 4,2
rem position objects
position object 1,player_x#,player_y#,player_z#
position object 2,10,2,10
position object 3,0,0,5
position object 4,-13,0,6
position object 5, 10,0,14
position matrix 6, -75,-2.3,-75
position object 8,10,2,10
`colour house and money and floor
color object 2,rgb(255,0,0)
color object 3,rgb (0,255,0)
color object 4,rgb (0,0,255)
color object 5,rgb (255,0,255)
color object 8,rgb (0,0,0)
prepare matrix texture 6,7,2,2
SET MATRIX TEXTURE 6,0,1
`Flying timer
fly=0
```MAIN LOOP```
do
rem if the "1" key is pressed, the camerachangevalue is changed to 1, the default view
if scancode()=2
camerachange=1
endif
rem if the "2" key is pressed, the camerachangevalue is changed to 2, the close-up view
if scancode()=3
camerachange=2
endif
rem if camerachange is 1, then the camera is positioned
rem effectively, 17.5 units higher than the player and 10 units behind
if camerachange=1
`position camera
position camera camera_x#,camera_y#,camera_z#
rem the camera is rotated so it "points" at the player
rotate camera 40,0,0
endif
rem if camerachange is 2, then the camera is positioned
rem 5 units behind the player and 10 units behind
if camerachange=2
position camera player_x#,player_y#+5,player_z#-10
rem the camera is not rotated because it is pretty much directly behind the player
rotate camera 0,0,0
endif
`move player
if upkey()=1
player_z#=player_z#+player_z_speed#
camera_z#=camera_z#+camera_z_speed#
endif
if downkey()=1
player_z#=player_z#-player_z_speed#
camera_z#=camera_z#-camera_z_speed#
endif
if leftkey()=1
player_x#=player_x#-player_x_speed#
camera_x#=camera_x#-camera_x_speed#
endif
if rightkey()=1
player_x#=player_x#+player_x_speed#
camera_x#=camera_x#+camera_x_speed#
endif
rem moving upwards
if spacekey()=1
if flyingability=1
player_y#=player_y#+player_y_speed#
camera_y#=camera_y#+camera_y_speed#
endif
endif
if controlkey()=1
if flyingability=1
`so it will ONLY move down if
`the players Y value is greater than 0
`basically, if he is ABOVE ground
if object position y(1)>0
player_y#=player_y#-player_y_speed#
camera_y#=camera_y#-camera_y_speed#
endif
endif
endif
`reposition the player-object-thingy
position object 1,player_x#,player_y#,player_z#
`set object collision to boxes for the house
Set object collision to boxes 2
`set object collision to spheres for the character
Set object collision to spheres 1
rem COLLISION WITH HOUSE
````````````````````
`````````````````````
`````from front of the box
If Object collision(1,2)>0 and upkey()=1
player_z_speed#=0
camera_z_speed#=0
endif
if downkey()=1 and Object collision(1,2)>0
position object 1,player_x#,player_y#, player_z#-0.1
endif
if object collision(1,2)=0 and player_z_speed=0
player_z_speed#=0.1
camera_z_speed#=0.1
endif
````````````
````````from the left of the box
If Object collision(1,2)>0 and rightkey()=1
player_x_speed#=0
camera_x_speed#=0
endif
if leftkey()=1 and Object collision(1,2)>0
position object 1,player_x#-0.1,player_y#, player_z#
endif
if object collision(1,2)=0 and player_x_speed=0
player_x_speed#=0.1
camera_x_speed#=0.1
endif
```````````````
````````from the right of the box
If Object collision(1,2)>0 and leftkey()=1
player_x_speed#=0
camera_x_speed#=0
endif
if rightkey()=1 and Object collision(1,2)>0
position object 1,player_x#+0.1,player_y#, player_z#
endif
if object collision(1,2)=0 and player_x_speed=0
player_x_speed#=0.1
camera_x_speed#=0.1
endif
```````````````
````````from the back of the box
If Object collision(1,2)>0 and downkey()=1
player_z_speed#=0
camera_z_speed#=0
endif
if upkey()=1 and Object collision(1,2)>0
position object 1,player_x#,player_y#, player_z#+0.1
endif
if object collision(1,2)=0 and player_z_speed=0
player_z_speed#=0.1
camera_z_speed#=0.1
endif
```````````````
````````from the top of the box
If Object collision(1,2)>0 and controlkey()=1
player_y_speed#=0
camera_y_speed#=0
endif
if spacekey()=1 and Object collision(1,2)>0
position object 1,player_x#,player_y#+0.1, player_z#
endif
if object collision(1,2)=0 and player_y_speed=0
player_y_speed#=0.1
camera_y_speed#=0.1
endif
```````````````
`this is simply to write the Door is Locked Message
if object collision (1,2)
if Object collision(1,2)>0
text 10,50,"The Door is Locked"
endif
endif
if object exist (5)
if object collision (1,5)
flyingability=1
delete object 5
`timer()=starttime
endif
endif
`pick-up money
if object exist (3)
if object collision (1,3)
money=money+50
delete object 3
endif
endif
if object exist (4)
if object collision (1,4)
money=money+100
delete object 4
endif
endif
`print info
`text 10,10,"player_x#"+str$(player_x#)
text 0,10,"cash "+str$(money)
if flyingability=1
text 0,430, "You can now fly!"
fly=fly+1
endif
if player_y#=0
fly=0
endif
if fly= 5481
flyingability=0
player_y#=player_y#-player_y_speed#
camera_y#=camera_y#-camera_y_speed#
endif
loop