Hey, I'm trying to make a small RPG to learn the basics of them before making a larger one. I'm currently working on a battle system, but no matter what I try, I can't get it to do what I want it do do. The enemy won't attack, and the HP-type variables don't change.
I've posted what I've got (without some of my attempts to make it work). (And this is still a work in progress, so some of the options do nothing)
rem opening stuff
sync on : sync rate 60
hide mouse
backdrop on
color backdrop rgb(0,0,200)
rem matrix stuff
make matrix 1,300,300,20,20
load image "grass1.bmp",1
prepare matrix texture 1,1,1,1
fill matrix 1,0,1
position matrix 1,0,0,0
rem some color stuff
red as dword
black as dword
blue as dword
white as dword
red=rgb(255,0,0)
black=rgb(0,0,0)
blue=rgb(0,0,255)
white=rgb(255,255,255)
ink rgb(255,255,255),0
rem characters
rem hero
load object "h-ninja-attack1.x",1
position object 1,85,0,100
yrotate object 1,250
scale object 1,600,600,600
rem enemy
load object "h-knight-attack1.x",2
position object 2,115,0,100
yrotate object 2,90
scale object 2,600,600,600
rem camera
position camera 100,40,80
point camera 100,0,100
rem some variables for the menu
up#=0
downpound=0
menu#=0
rem MAIN LOOP***************************
do
rem some variables
hp#=500
ehp#=500
mp#=100
dmg#=0
mpdmg#=0
action#=0
if dmg# > hp# then lose()
if mpdmg# > mp# then mpdmg#=mp#
rem tell us what our health stuff is
box 0,350,screen width(),600,blue,black,blue,black
set cursor 0,350
print "HP:";hp#-dmg#;"/";hp#
set cursor 0,380
print "MP:";mp#-mpdmg#;"/";mp#
rem OUR TURN
if action#=0
rem put up what our options are
box 180,350,275,screen height(),white,red,red,white
set cursor 200, 350
print "Attack"
set cursor 200,375
print "Magic"
set cursor 200,400
Print "Item"
set cursor 200,450
print "Flee"
rem menu workings
if menu#=0 then menu0()
if menu#=1 then menu1()
if menu#=2 then menu2()
if menu#=3 then menu3()
rem controls
if upkey()=1 then inc up#,1
if downkey()=1 then inc down#,1
if up#=4 then dec menu#,1 : up#=0
if down#=4 then inc menu#,1 : down#=0
if menu#>3 then menu#=0
if menu#<0 then menu#=3
rem what happens when we select the options
if menu#=0 and returnkey()=1 then attack() : sleep 1000
endif
rem THE ENEMY'S TURN
if action#=1
enatk()
action#=0
endif
sync
loop
rem END OF MAIN LOOP************************
rem functions for selecting our options
function menu0
circle 190,355,4
endfunction
function menu1
circle 190,380,4
endfunction
function menu2
circle 190,405,4
endfunction
function menu3
circle 190,455,4
endfunction
rem functions for after we have hit "enter" with our options
function attack
play object 1
set object speed 1,40
ehp#=ehp#-100
up#=0
down#=0
action#=1
endfunction
function lose
ink red,0
center text screen width()/2,screen height()/2, "YOU LOSE"
end
endfunction
function enatk
play object 2
set object speed 2,40
dmg#= dmg# +100
up#=0
down#=0
sleep 1000
action#=0
endfunction
Any help you guys could give me to help fix these problems would be very much appreciated.
Life IS pain, anyone who tells you otherwise is selling something.