Hi everybody, its nice to meet u all.
I am a 19 year old who just dreams, but i always dream of the same thing, being in a fantasy world, being a lone hero and all the usual. I've played many rpg's and very few of them hit all the right spots. So im making my own.lol I know it will be long, hard and not recomended but it has to be done.lol
Im gonna keep daily updates on where i am on the project (if im aloud-if theres any problems let me know) i know most people stop but i still wanna try.
At the minute this is what i have.
`Starting Project
`Created by <RPG DREAMER>
`Date Started: <06-June-2007/04.02am>
SYNC ON
SYNC RATE 60
hide mouse
set gamma 511,511,511
if check display mode(1024,768,32)=1
SET DISPLAY MODE 1024,768,32
endif
autocam off
randomize timer()
global radius# as double float : radius# = 7.0
rem summons function makeLevel()
makeLevel()
rem summons function makePlayer()
makePlayer()
rem code for jumping and gravity
global vx# as double float
global vy# as double float
global vz# as double float
global gravity# as double float : gravity# = -0.1
global slope# as double float : slope# = 0.5
global ground as integer : ground = 1
global jumptimer as integer : jumptimer = 0
global syncmode as integer : syncmode = 60
global view as integer : view = 1
global hide as integer : hide = 0
rem Load environment
load object "media\Sky\ml.x",1
scale object 1,30,30,30
set object cull 1,0
set object light 1,0
set object texture 1,2,1
rem Setup camera, light
set point light 0,256,300,256
set ambient light 50
do
rem the next few lines are for the camera
POSITION CAMERA OBJECT POSITION X(2),OBJECT POSITION Y(2),OBJECT POSITION Z(2)
rem - this is to enable view surroundings with mouse
CAMY#=CAMY#+MOUSEMOVEX()*.1
CAMX#=CAMX#+MOUSEMOVEY()*.1
IF CAMX#>90 AND CAMX#<135 THEN CAMX#=90
IF CAMX#>270 AND CAMX#<225 THEN CAMX#=90
YROTATE CAMERA CAMY#
XROTATE CAMERA CAMX#
YROTATE OBJECT 2,CAMY#
XROTATE OBJECT 2,CAMX#
rem rotate the skysphere
yrotate object 1,object angle y(1)+.01
rem summons function "movePlayer()"
MovePlayer()
rem displays Frames Per Second On Screen
text 0,40,"FPS: "+str$(screen fps())
sync
loop
REM ------ CODE TO MAKE LEVEL ------ REM
function makeLevel()
make object box 3,50,250,10
position object 3,-20,0,30
XROTATE OBJECT 3,-90
sc_setupObject 3,1,2
make object box 4,50,250,10
position object 4,-20,100,250
XROTATE OBJECT 4,-145
sc_setupObject 4,1,2
make object box 5,50,250,10
position object 5,-20,100,530
XROTATE OBJECT 5,-90
sc_setupObject 5,1,2
make object box 6,50,250,10
position object 6,-20,140,780
XROTATE OBJECT 6,-90
sc_setupObject 6,1,2
make object box 7,50,50,10
position object 7,-100,170,880
XROTATE OBJECT 7,-90
sc_setupObject 7,1,2
make object box 8,50,50,10
position object 8,-150,200,880
XROTATE OBJECT 8,-90
sc_setupObject 8,1,2
rem all level objects are group 1
endfunction
REM ------ CODE TO MAKE PLAYER ------ REM
function makePlayer()
make object sphere 2,radius#*5.0
position object 2,-10,10,40
sc_setupObject 2,0,1
set alpha mapping on 2,50
disable object zwrite 2
rem player has no group
endfunction
REM ------ CODE TO MOVE PLAYER ------ REM
function movePlayer()
rem rotate player with mouse
yrotate object 2,object angle y(2)+mousemovex()/3.0
xrotate object 2,object angle x(2)+mousemovey()/3.0
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
rem apply gravity, and user changes to movement
angy# = object angle y(2)
vx# = 0
vz# = 0
rem if player is jumping or falling then apply 'normal' gravity
rem if not attempt to keep the player stuck to the floor
if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(32)=1 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#)
if keystate(30)=1 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#)
if keystate(31)=1 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#)
if keystate(17)=1 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#)
rem only jump if on ground, and a certain time after last jump
if ground=1
rem the code for how high you jump
if spacekey()=1 and jumptimer=0 then vy# = vy# + 4.0 : jumptimer = 20
endif
rem this would be the player's final position without collision
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
rem first handle gravity - seperated from horizontal movement
rem to achieve a more realistic effect
rem Method: simple - cast a sphere vertically down, if it hits the level then
rem position the object there (sticky collision) then move
rem on to horizontal movement
rem more complex - if we were to only use the simple method the player would be
rem allowed to climb almost vertical slopes. Alternative is to
rem get the normalY direction to work out how flat the gorund
rem below the player is, 0-slope# is flatter, slope#-1 is steeper.
rem if it's flat, use sticky collision, if it's steep slide the
rem player down the slope. Changing slope# determines how steep the
rem player can climb. NOTE: this also effects stairs.
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
if collide>0
rem how flat is this ground
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
rem FLAT, stick
oldy# = sc_getStaticCollisionY()
else
rem STEEP, slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
rem ny#<0 means the player has hit a ceiling rather than a floor
if ny#>slope#
rem only on ground if standing on flat ground
ground = 1
vy# = 0
else
ground = 0
rem if player has hit a flat ceiling then stop vy# movement
if ny#<-slope# then vy# = gravity#
endif
else
rem nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
endif
rem jumptimer will decrease only when player is back on ground
rem creates a pause between two successive jumps
if ground = 1 and jumptimer>0 then dec jumptimer
rem handle horizontal movement as sliding
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
rem possible code for giving the player a jumping help up stairs...
rem might be useful if slope# is set very high but stairs are still required
`dy# = oldy#-sc_getStaticCollisionY()
`if dy#<slope# and dy#>0 and ground=1 then vy# = 0.5
endif
rem position the player
position object 2,x#,oldy#,z#
sc_updateObject 2
endfunction
REM ------ MEMBLOCK FOR COLLISIONS ------ REM
if memblock exist(1) then delete memblock 1
i kinda have a problem, its the skysphere. i dont know why but when i make the skyshere bigger than 30,30,30(scale it) a big hole appears where it it should be. Can anybody please help me resolve this issue please.
The media is attached.
Also i was wondering if anybody wanted to team up with me on this project. Well let me know anyway. thank-you
My ultimate wet dream has always been to build an rpg.lol
Please help me fulfil it... Thank-You