Ok now i have bigger proplem when i am on battle player and enemy dosent go back their position when they hitted...
here is my source code
battle:
#include "***.dba"
delete object 1
delete object 301
load object "models/*******.x",302
position object 302,50,10,220
rotate object 302,0,180,0
objground#=get ground height(1000,300,200)
load object "models/*******.x",303
scale object 303,40,40,40
position object 303,50,objground#+5,260
`rotate object 303,0,90,0
play object 303,0,4
playerlife#=100
enemylife#=100
position camera 10,33,239
yrotate camera 90
load music "**********.***",1
play music 1
` ink colors
white=RGB(255,255,255)
blue=RGB(0,128,255)
`EXP and levels
Restore Level
For i = 1 to 23
Read v
If xp#>v
level=level+1
maxhealth=maxhealth+2
health=maxhealth
Endif
Next i
Level:
Data 100, 200, 400, 700, 1000, 1500, 2250, 4000, 7000, 10000, 17500, 32000, 50000, 90000
Data 150000, 230000, 290000, 400000, 690000, 1000000, 50000000, 1000000000, 10000000000000000000000
l#=50
fl#=50
e#=80
a#=10
spell1=-60
`your attack
repeat
` timer
tim#=tim#+1
sync
position object 303,50,objground#+5,260
if tim#=100 then gosub mothattack
if tim#<100 then gosub box
position object 303,50,objground#+5,270
until playerlife#=0 OR enemylife#=0
` if you win or die
gosub game
`moth
mothattack:
sync
` makemoth appear to fly - moth attack pattern
position object 303,50,objground#+5,270
wait 200
position object 303,50,objground#+5,270
wait 500
playerlife#=playerlife#-5
position object 303,50,objground#+5,230
play object 303,5,6
tim#=tim#-tim#
move#=Move#-1
return
`player attack
playerattack:
sync
sync rate 0
position object 302,50,10,220
wait 0
position object 302,50,10,220
wait 100
enemylife#=enemylife#-5
position object 302,50,10,257
tim#=tim#-tim#
move#=Move#-1
return
` creating the attack box structure
box:
selectedItem=1
do
if move#=1 then gosub mothattack
if move#=2 then gosub playerattack
if e#=0 then end
`print menu items
if selectedItem=1 then ink blue,0 else ink white,0
text 410,400,"Attack"
if selectedItem=2 then ink blue,0 else ink white,0
text 410,450,"Spells"
if selectedItem=3 then ink blue,0 else ink white,0
text 410,500,"Potions"
if selectedItem=4 then ink blue,0 else ink white,0
text 410,550,"Escape"
text 250,550,"HP"+STR$(playerlife#)
`select menu items
if upkey()=1 and hold=0 then dec selectedItem : hold=1
if downkey()=1 and hold=0 then inc selectedItem : hold=1
if upkey()=0 and downkey()=0 then hold=0
if selectedItem>4 then selectedItem=1
if selectedItem<1 then selectedITem=4
` to select items
if returnkey()=1
`attack opponent
if selectedItem=1 then enemylife#=enemylife#-a# : sync : move#=1
if selectedItem=1 then enemylife#=enemylife#-a# : sync : move#=2
`spells
if selectedItem=2
text 200,10,"Firey Grave Spell!"
e#=e#-spell1
sync : sync
`clear up after myself
endif
`display information about the game
if selectedItem=3
l#=l#+50
sync : sync
`clear up after myself
endif
`quit the game
if selectedItem=4
gosub game
endif
endif
sync
loop
return