hello everyone!
I have been working on this RPG for a while now and i have collision and
some other cool stuff implemented like naming your character and it is a pretty
good engine currently. The things i want to add next are:
(1) jumping
(2) make it so when you click with left mouse button your sword (pike.x) moves down and then back up.
(3) create collision with enemys so you lose health.
(4) (Not completely needed), but it be nice to get better collision cause mine sucks.
I was working on an RPG before but i stopped and made a PONG and SNAKE game.
so i am ready to start back up at it.
here is my current source:
Rem Project: RPG
Rem Created: 1/5/2006 8:22:46 PM
Rem ***** Main Source File *****
`--------------------------
`Chapter 1-Create world
`--------------------------
load music "music1.wav",1
gosub menu
Menu:
` MENU LOOP
loop music 1
do:cls
set text font "arial"
ink rgb(150,0,0),0
set text to bold
set text size 32
center text screen width()/2,screen height()/2-130,"-Battles within-"
center text screen width()/2,screen height()/2-100,"-Spheres of Doom-"
set text to normal
set text size 16
center text screen width()/2,screen height()/2-70,"Created by: Marlin Studios"
buttonpressed=0
if makebutton(screen width()/2,screen height()/2,"NEW GAME")>0 then buttonselected=1
if makebutton(screen width()/2,screen height()/2+50,"OPTIONS")>0 then buttonselected=2
if makebutton(screen width()/2,screen height()/2+100,"CREDITS")>0 then buttonselected=3
if makebutton(screen width()/2,screen height()/2+150,"QUIT")>0 then buttonselected=4
if buttonselected=1 then gosub _Get_name
if buttonselected=2 then gosub options
if buttonselected=3 then gosub credits
if buttonselected=4 then end
sync:loop
options:
buttonselected=0
do:cls
buttonpressed=0
if makebutton(100,200,"Video")>0 then buttonselected=7
if makebutton(100,250,"Music")>0 then buttonselected=6
if makebutton(100,350,"Back")>0 then goto menu
if buttonselected=6
if makebutton(300,225,"ON")>0 then buttonselected=8
if makebutton(300,275,"OFF")>0 then buttonselected=9
if buttonselected=9 then music=0
if buttonselected=8 then music=1
line 200,225,220,225:line 200,275,220,275:line 180,250,200,250:line 200,225,200,275
endif
if buttonselected=7
if makebutton(300,150,"640 x 480")>0 then buttonselected=10
if makebutton(300,200,"800 x 600")>0 then buttonselected=11
if makebutton(300,250,"1024 x 768")>0 then buttonselected=12
if buttonselected=10 then set display mode 640,480,16
if buttonselected=11 then set display mode 800,600,16
if buttonselected=12 then set display mode 1024,768,16
line 200,150,220,150:line 180,200,220,200:line 200,250,220,250:line 200,150,200,250
endif
sync:loop
credits:
cls:texty#=screen height()
do:cls
texty#=texty#-0.45
set text to bold
set text size 20
center text screen width()/2,texty#,"3D RPG"
set text to normal
set text size 15
center text screen width()/2,texty#+20,"Created by: Marlin Studios"
set text size 12
center text screen width()/2,texty#+60,"Programmer: Marlin Studios"
center text screen width()/2,texty#+75,"2D Arts: Marlin Studios, TGC, DBpro"
center text screen width()/2,texty#+90,"3D Arts: Marlin Studios, DBpro"
center text screen width()/2,texty#+105,"Programming language: DarkBASIC PRo"
center text screen width()/2,texty#+120,""
set text size 15
set text to bold
center text screen width()/2,texty#+135,"Press the return key to continue"
if returnkey()=1:buttonpressed=0:buttonselected=0:goto menu:endif
if texty#+120<0 then texty#=500
sync
loop
function makebutton(x,y,name$)
buttonpressed=0
ink rgb(255,255,255),0
mx=mousex() : my=mousey()
if mx>x-80 and mx<x+80
if my>y-15 and my<y+15
buttonpressed=1
endif
endif
if buttonpressed=1
ink rgb(120,0,0),0
endif
box x-80,y-15,x+80,y+15
ink rgb(200,0,0),0
box x-78,y-13,x+78,y+13
ink rgb(255,255,255),0
set text size 12 : set text font "courier" : center text x,y-8,name$
if mouseclick()=0 then buttonpressed=0
endfunction buttonpressed
_Get_name:
CLS
set text size 16
set text to normal
input "Please name your sphere: ", name$
gosub _get_stats
return
STATS_:
CLS
set text to normal
print "Hello ",name$,", Welcome."
print "Before you can be brought into the world you must chose you stats."
print "Press any key to re-roll you stats and when you are prepared to enter"
print "the world, hit the [Return] Key."
print "---------------------------------------------------------------------------------------------------"
randomize timer()
totalhealth = RND(9) + 1
totalhealth = totalhealth * 100
totalmana = RND(9) + 1
totalmana = totalmana * 100
health = totalhealth
mana = totalmana
Dim race$(5)
race$(1) = "Marlin sphere"
race$(2) = "Shosho sphere"
race$(3) = "Foshe sphere"
race$(4) = "Lokeyosho sphere"
race$(5) = "Cooko sphere"
racenum = rnd(4) + 1
set text to normal
Randomize timer()
ink rgb(255,0,0),0
print "HEALTH :",totalhealth,"/1000"
ink rgb(0,0,255),0
print "MANA :",totalmana,"/1000"
ink rgb(0,255,0),0
print "INTELLIGENCE :",intell,"/100"
ink rgb(255,255,0),0
PRINT "RACE : ", race$(racenum)
print ""
set text to bold
set text size 16
ink rgb(255,255,255),0
print "Press the return key to accept your stats"
print "Press any other key to re-roll your stats"
suspend for key
return
_Wait_For_Key:
if returnkey()=1 then gosub _START
return
_Get_Stats:
do
gosub STATS_
gosub _Wait_For_Key
loop
_START:
`Set text size and set up
set text size 12
`set sync
sync on
rem color backround
color backdrop 0
rem make landscape
make matrix 1,10000,10000,50,50
randomize matrix 1,80
update matrix 1
`----------------------------
`Chapter 2-Load all media |
`----------------------------
rem Load snowy floor bitmap into image
load bitmap "MEDIAtexturesgrass09.bmp",1
load image "MEDIAtexturesplayer.bmp",2
load image "MEDIAtexturescottag02.bmp",3
load image "MEDIAtexturessword_handel.bmp",4
load image "MEDIAtexturesblade.bmp",5
load image "MEDIAtextureshat.bmp",6
load image "MEDIAtexturesHUD.jpg",7
get image 1,0,0,128,128
delete bitmap 1
rem Texture landscape
prepare matrix texture 1,1,1,1
rem Activate and distance fogging
fog on
fog color rgb (0,0,0)
fog distance 1000
Rem Make sphere
player=10
Make object sphere player,50
position object player, 445,61,356
Set object collision to spheres player
texture object player,2
`Make the hat
MAKE OBJECT CONE 11,30
rotate object 11,0,0,0
MAKE MESH FROM OBJECT 1,11
DELETE OBJECT 11
ADD LIMB player,1,1
OFFSET LIMB player,1,0,27,0
texture limb player,1,6
`Make the arms
MAKE OBJECT cylinder 12,10
rotate object 12,0,50,0
MAKE MESH FROM OBJECT 2,12
DELETE OBJECT 12
ADD LIMB player,2,2
OFFSET LIMB player,2,30,0,0
color limb player,2, rgb (255,0,0)
`Load the sword
load object "MEDIAModelspike.x",13
scale object 13,5000,5000,5000
rotate object 13,0,40,0
MAKE MESH FROM OBJECT 3,13
DELETE OBJECT 13
ADD LIMB player,3,3
OFFSET LIMB player,3,8,-73,0
texture limb player,3,4
Rem Make Cubes and place randomly
For boxes = 1 to 5
Make object box boxes,100,200,100
Position object boxes,Rnd(2000),0,Rnd(2000)
Set object collision to boxes boxes
texture object boxes,3
Next boxes
`Set up variables
health = totalhealth
mana = totalmana
XP = 0
level = 1
light1 = 1
block1 = 101
block2 = 102
block3 = 103
block4 = 104
block5 = 105
block6 = 106
block7 = 107
`Set up obsticles
make light light1
position light light1,445,68,544
make object box block1,70,300,70
make object box block2,70,300,70
make object box block3,70,240,30
make object box block4,70,300,70
make object box block5,70,300,70
position object block1,550,5,550
position object block2,357,68,533
position object block3,453,200,544
position object block4,615,34,553
position object block5,646,49,651
rotate object block3, 320,100,200
texture object block1,3
texture object block2,3
texture object block3,3
texture object block4,3
texture object block5,3
`Position Character at starting POS
position object player, 445,61,356
` SETUP
hide mouse
CLS 0
set text to normal
`Main Loop
do
`Print health
set cursor 0,0
ink rgb(255,0,0),0
set text size 18
set cursor screen width()/2,texty#+10
print name$
set cursor 485,0
print "Time : ",get time$()
set cursor 0,0
print "Current Health: ",health,"/",totalhealth
ink rgb(0,0,255),0
print "Current Mana: ",mana,"/",totalmana
ink rgb(255,255,255),0
print "-----------------------------------------"
ink rgb(255,255,0),0
print "Current Level : ",level
print "Current XP : ",XP
ink rgb(255,255,255),0
print "-----------------------------------------"
print "FPS :",Screen fps()
print "X-cords: ",X#
print "Y-cords: ",Y#
print "Z-cords: ",Z#
Rem Store Object angle Y in aY#
aY# = Object angle Y(player)
`player movement and turning
If keystate(17) then Move object player,.3
if keystate(30) then yrotate object player,object angle y(player)-.1
if keystate(32) then yrotate object player,object angle y(player)+.1
If keystate(31) then Move object player,-.3
Rem Detect collision
If Object collision(player,0)>0 then position object player,X#,0,Z#
`make it so that the character stays above the matrix
y# = get ground height(1,x#,z#)+16
X# = Object position x(player)
Z# = Object position z(player)
Rem get new camera position and store in cZ# and cX#
cZ# = Newzvalue(Z#,aY#-180,100)
cX# = Newxvalue(X#,aY#-180,100)
`render all of above X# Y# and Z#
position object player,x#,y#,z#
Rem position camera
Position Camera cX#,160,cZ#
`set camera back to players angles and move it behind him
`set camera to object orientation 1
rotate camera object angle x(player), object angle y(player), object angle z(player)
move camera -170
`draw changes
sync
`end loop
loop
return
(i used Lee Bambers menu code
)
If you could help with any of my 4 needs, well 3 needs 1 want
, It would
be so much appriciated.
thank you so much in advanced,
-Marlin Studios