Post by atomose on May 14, 2020 16:04:51 GMT -5
Hi !
here is a new really simple rpg game ^^ ... 3 game level, with boss at the last.
Take the blue point and fight agains the red points =)
on the same case, you creat a fight. After some rounds, if you win, you can have a level up with more hp and power.
Its really simple game, no picture just code lines and imagination.
OPEN SOURCE CODE HERE (NEW CODE REMASTER 2024 100% TRANSLATED)
EDIT : A large code optimisation with key moove add and info/quest when you click on your character.
Have fun =)
here is a new really simple rpg game ^^ ... 3 game level, with boss at the last.
Take the blue point and fight agains the red points =)
on the same case, you creat a fight. After some rounds, if you win, you can have a level up with more hp and power.
Its really simple game, no picture just code lines and imagination.
OPEN SOURCE CODE HERE (NEW CODE REMASTER 2024 100% TRANSLATED)
EDIT : A large code optimisation with key moove add and info/quest when you click on your character.
' pixel adventure remaster 2024 by Alexandre Lomuto
nomainwin
on error goto [file]
[fileBack]
gosub [input]
if pass$ <> "1" then end
pass$ = "0" : gosub [print]
if save = 1 then goto [loaded]
tailleDuneCase = 21 : x = 30 : y = 20 : dim p(x,y)
perso1x = tailleDuneCase * 4 : perso1y = tailleDuneCase * 3 : mX = perso1x : mY = perso1y : level = 0
Clevel = 1 : Cxp = 0 : CxpTOTAL = 8 : Catk = 3 : Clife = 11 : ClifeTOTAL = Clife : regen = 1
[loaded]
on error goto [quit]
dim AIalive(10),AIhp(10),AIdmg(10),AIx(10),AIy(10),AIcompteur(10), AIxp(10), AIlvl(10)
WindowWidth = 638 : WindowHeight = 451 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2)
tailleDuneCase =21 : x= 30 : y= 20 : dim p(x,y) : global dy, dx
graphicbox #main.map, 0, 0, WindowWidth, WindowHeight
open "Pixel Aventure v18 by Alexandre Lomuto - Liberty Basic 4.51 Pro" for window_nf as #main
#main, "trapclose [quit]"
#main.map, "setfocus;down;fill white;when leftButtonDown [move]"
goto [UPLEVEL]
[move]
#main.map, "when leftButtonDown [w]"
mX = MouseX : mY = MouseY
uplevel = 0 : downlevel = 0 : direction = 0 : mX = int(mX/21) : mX = int(mX*21) : mY = int(mY/21) : mY = int(mY*21)
if mX > perso1x-10 and mX < perso1x+20 and mY > perso1y-10 and mY < perso1y +20 then goto [perso]
if mX > perso1x then goto [marcheDROITE2]
if mX < perso1x then goto [marcheGAUCHE2]
if mY < perso1y then goto [marcheHAUT2]
if mY > perso1y then goto [marcheBAS2]
[w]
wait
[perso]
popupmenu "Character", [Info],_
"Quests", [quest]
wait
[Info]
POURCENTAGE = int(Cxp/(CxpTOTAL/100))
notice "Character info" + chr$(13)+_
"Level : ";Clevel;" (";POURCENTAGE;"%)" + chr$(13)+_
"Life : ";Clife;"/";ClifeTOTAL;"" + chr$(13)+_
"Power : ";Catk
wait
[quest]
notice "Quest" + chr$(13) + "Kill the Boss (B) on the last level" : wait
[UPcarac]
Clevel = Clevel + 1 : Cxp = Cxp - CxpTOTAL : CxpTOTAL = int(CxpTOTAL + 3*Clevel*Clevel) : Catk = Catk + int(rnd(1)*2+1) : lifeBONUS = int(rnd(1)*4+1) : regen = regen + 0.5 : ClifeTOTAL = ClifeTOTAL + lifeBONUS : Clife = ClifeTOTAL
if Cxp >= CxpTOTAL then goto [UPcarac]
return
[marcheDROITE2]
direction = 1 : perso1xOLD = perso1x : perso1yOLD = perso1y : modeMOOVE = 1
if p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 0 then perso1x = perso1x + tailleDuneCase
if p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 2 then uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 3 then downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
GOTO [marcheEXIT]
[marcheGAUCHE2]
direction = 2 : perso1xOLD = perso1x : perso1yOLD = perso1y : modeMOOVE = 1
if p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 0 then perso1x = perso1x - tailleDuneCase
if p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 2 then uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 3 then downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
GOTO [marcheEXIT]
[marcheHAUT2]
direction = 3 : perso1xOLD = perso1x : perso1yOLD = perso1y : modeMOOVE = 1
if p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 0 then perso1y = perso1y - tailleDuneCase
if p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 2 then uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 3 then downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
GOTO [marcheEXIT]
[marcheBAS2]
direction = 4 : perso1xOLD = perso1x : perso1yOLD = perso1y : modeMOOVE = 1
if p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 0 then perso1y = perso1y + tailleDuneCase
if p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 2 then uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 3 then downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
[marcheEXIT]
#main.map, "color white; backcolor white; set ";perso1xOLD;" ";perso1yOLD
#main.map, "boxfilled ";perso1xOLD+21;" ";perso1yOLD+21
#main.map, "color blue; size 15; set ";perso1x+10;" ";perso1y+10
#main.map, "font Couriel_New 6; color WHITE; backcolor blue" : #main.map, "place ";perso1x+8;" ";perso1y+13;" ;\"; Clevel : #main.map, "size 1"
goto [mooveAI2]
[mooveAI]
dy = 0 : dx = 0 : modeMOOVE = 2
call readJStick 1
if nomoove = 1 then dy = 0 : dx = 0 : nomoove = 0 : timer 200, [refreshENDmoove] : wait
[refreshENDmoove]
timer 0
perso1xOLD = perso1x : perso1yOLD = perso1y
if dx = 1 and p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 0 then perso1x = perso1x + tailleDuneCase
if dx = 1 and p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 2 then nomoove = 1 : uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if dx = 1 and p(int((perso1x+tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 3 then nomoove = 1 : downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
if dx = -1 and p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 0 then perso1x = perso1x - tailleDuneCase
if dx = -1 and p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 2 then nomoove = 1 : uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if dx = -1 and p(int((perso1x-tailleDuneCase)/tailleDuneCase),int(perso1y/tailleDuneCase)) = 3 then nomoove = 1 : downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
if dy = -1 and p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 0 then perso1y = perso1y - tailleDuneCase
if dy = -1 and p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 2 then nomoove = 1 : uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if dy = -1 and p(int(perso1x/tailleDuneCase),int((perso1y-tailleDuneCase)/tailleDuneCase)) = 3 then nomoove = 1 : downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
if dy = 1 and p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 0 then perso1y = perso1y + tailleDuneCase
if dy = 1 and p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 2 then nomoove = 1 : uplevel = 1 : level = level + 1 : timer 0 : goto [UPLEVEL]
if dy = 1 and p(int(perso1x/tailleDuneCase),int((perso1y+tailleDuneCase)/tailleDuneCase)) = 3 then nomoove = 1 : downlevel = 1 : level = level - 1 : timer 0 : goto [UPLEVEL]
goto [marcheEXIT]
[mooveAI2]
scan : timer 0
if initialFIGHT = 1 then goto [endLEVEL]
#main.map, "color black; backcolor white; size 1; when leftButtonDown [move]"
for t = 1 to 6
if AIalive(t) = 0 then goto [nextE2]
rndDIR = int(rnd(1)*50+1)
#main.map, "color white; backcolor white" : #main.map, "set ";AIx(t)+1;" ";AIy(t)+1 : #main.map, "boxfilled ";AIx(t)+19;" ";AIy(t)+19
select case rndDIR
case 1
if p(int((AIx(t)+tailleDuneCase)/tailleDuneCase),int(AIy(t)/tailleDuneCase)) = 0 then AIx(t) = AIx(t) + tailleDuneCase
case 2
if p(int((AIx(t)-tailleDuneCase)/tailleDuneCase),int(AIy(t)/tailleDuneCase)) = 0 then AIx(t) = AIx(t) - tailleDuneCase
case 3
if p(int(AIx(t)/tailleDuneCase),int((AIy(t)-tailleDuneCase)/tailleDuneCase)) = 0 then AIy(t) = AIy(t) - tailleDuneCase
case 4
if p(int(AIx(t)/tailleDuneCase),int((AIy(t)+tailleDuneCase)/tailleDuneCase)) = 0 then AIy(t) = AIy(t) + tailleDuneCase
end select
IAx = AIx(t) : IAy = AIy(t)
if AIx(t) = perso1x and AIy(t) = perso1y then
initialFIGHT = 1
#main.map, "when leftButtonDown [move]; color black ; set ";perso1x+40;" ";perso1y+32 : #main.map, "boxfilled ";perso1x-20;" ";perso1y-14
#main.map, "font Couriel_New 8 bold; place ";IAx+3;" ";IAy+13;" ;\"; "Vs"
[boucle]
timer 0
for n = 1 to 6
if AIx(n) = perso1x and AIy(n) = perso1y then
if AIalive(n) = 0 then goto [nextE]
dmg = int(rnd(1)*Catk+0)
#main.map, "font Couriel_New 7; color red; place ";perso1x-5;" ";perso1y+26;" ;\"; "- ";dmg;" [";AIhp(n);"] "
AIhp(n) = AIhp(n) - dmg
if AIhp(n) <= 0 then
AIhp(n) = 0 : AIalive(n) = 0
Cxp = Cxp + AIxp(n) : if Cxp >= CxpTOTAL then gosub [UPcarac]
initialFIGHT = 0 : GOTO [endLEVEL]
end if
dmgE = int(rnd(1)*AIdmg(n)+0)
#main.map, "color blue ; place ";perso1x-5;" ";perso1y-2;" ;\"; "- ";dmgE;" [";Clife;"] "
Clife = Clife - dmgE : if Clife < 0 then Clife = 0
on error goto [end]
if Clife <=0 then #main.map, "color red; font Couriel_New 30 bold" : #main.map, "place 200 220 ;\"; "GAME OVER" : kill "GameCore.data" : #main.map, "when leftButtonDown [w]" : TIMER 1000, [end] : wait
timer 700, [boucle] : wait
end if
[nextE]
next n
end if
#main.map, "color RED; size 15" : #main.map, "set ";AIx(t)+10;" ";AIy(t)+10 : #main.map, "font Couriel_New 6; color WHITE; backcolor RED" : #main.map, "size 1"
if level = 2 and t = 4 then
#main.map, "place ";AIx(t)+7;" ";AIy(t)+13;" ;\"; "B"
ELSE
#main.map, "place ";AIx(t)+8;" ";AIy(t)+13;" ;\"; AIlvl(t)
end if
[nextE2]
next t
#main.map, "color blue; backcolor white; size 15; set ";perso1x+10;" ";perso1y+10
#main.map, "font Couriel_New 6; color white; backcolor blue" : #main.map, "place ";perso1x+8;" ";perso1y+13;" ;\"; Clevel : #main.map, "size 1"
compteur = compteur +1
if compteur = 20 then compteur = 0 : Clife = int(Clife + regen) : if Clife > ClifeTOTAL then Clife = ClifeTOTAL
for c = 1 to 6
if AIalive(c) > 0 then goto [nextE3]
AIcompteur(c) = AIcompteur(c) + 1
if AIcompteur(c) >= 200 then AIcompteur(c) = 0 : AIalive(c) = 1 : AIlvl(c) = int(rnd(1)*level+(2+level)) : AIdmg(c) = int(rnd(1)*5+AIlvl(c)) : AIhp(c) = int(rnd(1)*12+(5*AIlvl(c))+1): AIxp(c) = int(rnd(1)*5+(AIlvl(c)*2))
[nextE3]
next c
if modeMOOVE = 1 then
if direction = 1 then
if mY < perso1y then timer 100, [marcheHAUT2] : wait
if mY > perso1y then timer 100, [marcheBAS2] : wait
if mX > perso1x then timer 100, [marcheDROITE2] : wait
end if
if direction = 2 then
if mY < perso1y then timer 100, [marcheHAUT2] : wait
if mY > perso1y then timer 100, [marcheBAS2] : wait
if mX < perso1x then timer 100, [marcheGAUCHE2] : wait
end if
if direction = 3 then
if mX > perso1x then timer 100, [marcheDROITE2] : wait
if mX < perso1x then timer 100, [marcheGAUCHE2] : wait
if mY < perso1y then timer 100, [marcheHAUT2] : wait
end if
if direction = 4 then
if mX > perso1x then timer 100, [marcheDROITE2] : wait
if mX < perso1x then timer 100, [marcheGAUCHE2] : wait
if mY > perso1y then timer 100, [marcheBAS2] : wait
end if
end if
direction = 0 : timer 100, [mooveAI] : wait
[dataUNITS]
for w = 1 to 6
AIlvl(w) = int(rnd(1)*Clevel+(level+1))
AIxp(w) = int(rnd(1)*(5*AIlvl(w))+Clevel)
AIdmg(w) = int(rnd(1)*AIlvl(w)+Clevel)
AIhp(w) = int(rnd(1)*(5*AIlvl(w))+(5*Clevel))
if level = 2 and w = 4 then AIlvl(w) = int(rnd(1)*(Clevel*3)+(level+5)) : AIxp(w) = int(rnd(1)*(5*AIlvl(w))+Clevel) : AIdmg(w) = int(rnd(1)*AIlvl(w)+(2*Clevel)) : AIhp(w) = int(rnd(1)*(5*AIlvl(w))+(5*Clevel))
AIalive(w) = 1
next w
return
[level0]
redim p(x,y)
data 4,4,1,1,1,1,4,1,1,1,4,4,4,4,4,4,4,4,4,4,1,1,1,1,1,4,4,4,4,4
data 4,1,0,0,0,0,4,0,0,0,1,1,4,4,4,4,4,4,4,1,0,0,0,0,0,1,4,1,4,4
data 4,0,0,0,1,0,4,0,0,0,0,0,1,4,4,4,4,4,1,0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,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
restore [level0]
for b=0 to y-1
for a=0 to x-1
read valeur : p(a,b)= valeur
next a
next b
AIx(1) = tailleDuneCase * 3 : AIy(1) = tailleDuneCase * 10 : AIx(2) = tailleDuneCase * 10 : AIy(2) = tailleDuneCase * 14 : AIx(3) = tailleDuneCase * 6 : AIy(3) = tailleDuneCase * 8 : AIx(4) = tailleDuneCase * 27 : AIy(4) = tailleDuneCase * 15 : AIx(5) = tailleDuneCase * 9 : AIy(5) = tailleDuneCase * 2 : AIx(6) = tailleDuneCase * 20 : AIy(6) = tailleDuneCase * 8 : AIlvl(6) = int(rnd(1)*level+1+level) : AIxp(6) = int(rnd(1)*5+(AIlvl(6)*2)) : AIdmg(6) = int(rnd(1)*4+AIlvl(6)) : AIalive(6) = 1 : AIhp(6) = int(rnd(1)*8+(4*AIlvl(6))+1)
gosub [dataUNITS] : goto [endLEVEL]
[level1]
redim p(x,y)
data 4,1,1,1,4,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,4
data 4,0,0,0,4,0,0,0,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,4
data 4,0,1,0,1,0,4,0,0,0,4,0,1,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,4
data 4,0,0,0,0,0,4,1,1,1,4,0,0,0,1,4,0,1,1,1,1,0,1,1,1,1,1,1,0,4
data 4,1,0,4,1,1,1,0,0,0,1,0,1,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,4
data 4,0,0,4,0,0,0,0,4,0,0,0,0,0,0,4,0,4,0,1,1,1,4,0,4,1,1,1,0,4
data 4,0,1,4,0,0,4,1,1,1,1,1,0,1,1,1,0,4,0,0,0,0,4,0,4,0,0,0,0,4
data 4,0,0,4,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,4,1,0,1,0,4,0,0,0,0,4
data 4,1,0,4,1,1,1,0,4,1,1,1,1,1,1,4,0,0,0,4,0,0,0,0,4,0,4,0,0,4
data 4,0,0,4,0,0,0,0,4,0,0,0,0,0,0,4,0,4,0,4,0,0,4,1,1,0,1,1,1,4
data 4,0,4,1,0,0,0,0,1,0,4,1,1,1,0,1,0,4,0,4,0,0,4,0,0,0,0,0,0,4
data 4,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,1,1,1,4,0,0,0,0,0,0,4
data 4,0,4,0,0,0,0,0,4,1,1,0,1,4,1,1,1,4,0,0,0,0,4,0,0,0,0,0,0,4
data 4,0,1,1,1,1,1,1,4,0,0,0,0,4,0,0,0,4,0,1,4,0,1,1,0,1,1,1,1,4
data 4,0,0,0,0,0,0,0,4,0,0,0,0,4,0,1,0,4,0,0,4,0,0,0,0,0,0,0,0,3
data 4,0,1,0,1,0,1,0,1,1,4,0,1,1,0,0,0,4,0,0,1,1,4,0,4,1,1,1,1,4
data 4,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,4,0,1,0,0,0,0,4
data 4,0,1,0,1,0,1,0,4,0,1,1,1,1,0,1,0,4,0,1,1,1,1,0,0,0,0,0,0,4
data 4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,4
data 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
restore [level1]
for b=0 to y-1
for a=0 to x-1
read valeur : p(a,b)= valeur
next a
next b
AIx(1) = tailleDuneCase * 3 : AIy(1) = tailleDuneCase * 18 : AIx(2) = tailleDuneCase * 15 : AIy(2) = tailleDuneCase * 15 : AIx(3) = tailleDuneCase * 12 : AIy(3) = tailleDuneCase * 9 : AIx(4) = tailleDuneCase * 15 : AIy(4) = tailleDuneCase * 2 : AIx(5) = tailleDuneCase * 18 : AIy(5) = tailleDuneCase * 6 : AIx(6) = tailleDuneCase * 5 : AIy(6) = tailleDuneCase * 12 : AIlvl(6)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,1,0,4
data 4,0,4,0,0,0,0,0,0,0,0,4,0,0,0,0,4,0,0,0,0,0,4,0,4,0,0,0,0,4
data 4,0,1,1,0,1,1,1,4,1,1,1,1,1,0,1,4,0,0,0,4,1,1,0,4,0,1,1,1,4
data 4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,0,0,4,1,0,0,0,4,0,0,0,0,4
data 4,0,1,1,1,1,1,1,1,0,0,0,4,0,0,0,1,1,0,4,0,0,1,1,1,1,1,1,0,4
data 4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,4
data 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
restore [level2]
for b=0 to y-1
for a=0 to x-1
read valeur : p(a,b)= valeur
next a
next b
AIx(1) = tailleDuneCase * 4 : AIy(1) = tailleDuneCase * 10 : AIx(2) = tailleDuneCase * 8 : AIy(2) = tailleDuneCase * 8 : AIx(3) = tailleDuneCase * 15 : AIy(3) = tailleDuneCase * 2 : AIx(4) = tailleDuneCase * 26 : AIy(4) = tailleDuneCase * 6 : AIx(5) = tailleDuneCase * 20 : AIy(5) = tailleDuneCase * 18 : AIx(6) = tailleDuneCase * 4 : AIy(6) = tailleDuneCase * 18 : AIlvl(6) = int(rnd(1)*level+2+level) : AIxp(6) = int(rnd(1)*5+(AIlvl(6)*2)) : AIdmg(6) = int(rnd(1)*9+AIlvl(6)) : AIalive(6) = 1 : AIhp(6) = int(rnd(1)*20+(8*AIlvl(6))+1)
gosub [dataUNITS] : goto [endLEVEL]
[UPLEVEL]
timer 0
if direction = 1 then mX = mX - 21
if direction = 2 then mX = mX + 21
if direction = 3 then mY = mY + 21
if direction = 4 then mY = mY - 21
if level <= 0 then IA1alive = 1 : IA2alive = 1 : IA3alive = 1 : IA4alive = 1 : IA5alive = 1 : IA6alive = 1 : goto [level0]
if level = 1 then IA1alive = 1 : IA2alive = 1 : IA3alive = 1 : IA4alive = 1 : IA5alive = 1 : IA6alive = 1 : goto [level1]
if level >= 2 then IA1alive = 1 : IA2alive = 1 : IA3alive = 1 : IA4alive = 1 : IA5alive = 1 : IA6alive = 1 : goto [level2]
[endLEVEL]
#main.map, "when leftButtonDown [w]; down; fill white"
valX = 1 : valY = 1 : initialFIGHT = 0
for y=0 to 19
valX = 1
for x=0 to 29
select case p(x,y)
case 0
#main.map, "color WHITE; backcolor WHITE"
#main.map, "set ";valX;" ";valY;"; boxfilled ";valX+tailleDuneCase-1;" ";valY+tailleDuneCase-1
case 1
#main.map, "color BLACK; backcolor ";160;" ";160;" ";160
#main.map, "set ";valX;" ";valY;"; boxfilled ";valX+tailleDuneCase-1;" ";valY+tailleDuneCase-6
#main.map, "color black; backcolor ";220;" ";220;" ";220
#main.map, "set ";valX;" ";valY+6;"; boxfilled ";valX+tailleDuneCase-1;" ";valY+tailleDuneCase-1
#main.map, "color BLACK; backcolor ";100;" ";100;" ";100
#main.map, "set ";valX+2;" ";valY+2;"; boxfilled ";valX+tailleDuneCase-3;" ";valY+tailleDuneCase-16
case 4
#main.map, "color BLACK; backcolor ";160;" ";160;" ";160
#main.map, "set ";valX;" ";valY;"; boxfilled ";valX+tailleDuneCase-1;" ";valY+tailleDuneCase-1
#main.map, "color BLACK; backcolor ";100;" ";100;" ";100
#main.map, "set ";valX+2;" ";valY+2;"; boxfilled ";valX+tailleDuneCase-3;" ";valY+tailleDuneCase-3
case 2,3
#main.map, "color red; backcolor black"
#main.map, "set ";valX;" ";valY;"; boxfilled ";valX+tailleDuneCase-1;" ";valY+tailleDuneCase-1
end select
valX = valX + 21
next
valX = 0 : valY = valY + 21
next
valX = 0 : valY = 0
#main.map, "color blue; backcolor white; size 15; set ";perso1x+10;" ";perso1y+10
#main.map, "font Couriel_New 6; color WHITE; backcolor blue; place ";perso1x+8;" ";perso1y+13;" ;\"; Clevel
#main.map, "flush"
GOTO [mooveAI2]
[quit]
pass$ = "1" : save = 1 : gosub [print]
[end]
timer 0 : close #main : end
[file]
pass$ = "1" : save = 0 : perso1x = 0 : perso1y = 0 : Clevel = 0 : Cxp = 0 : CxpTOTAL = 0 : Catk = 0 : Clife = 0 : ClifeTOTAL = 0 : regen = 0 : level = 0 : gosub [print] : goto [fileBack]
[print]
open "GameCore.data" for output as #secu2
print #secu2, pass$
print #secu2, save
print #secu2, perso1x
print #secu2, perso1y
print #secu2, Clevel
print #secu2, Cxp
print #secu2, CxpTOTAL
print #secu2, Catk
print #secu2, Clife
print #secu2, ClifeTOTAL
print #secu2, regen
print #secu2, level
print #secu2, bossDEFEATED
close #secu2
return
[input]
open "GameCore.data" for input as #secu
input #secu, pass$
input #secu, save
input #secu, perso1x
input #secu, perso1y
input #secu, Clevel
input #secu, Cxp
input #secu, CxpTOTAL
input #secu, Catk
input #secu, Clife
input #secu, ClifeTOTAL
input #secu, regen
input #secu, level
close #secu
return
function GetAsyncKeyState(key)
calldll #user32, "GetAsyncKeyState",key as long,GetAsyncKeyState as long
if GetAsyncKeyState<>0 then GetAsyncKeyState=1
end function
sub readJStick n
if GetAsyncKeyState(asc("Z")) or GetAsyncKeyState(_VK_UP) then dy = -1
if GetAsyncKeyState(asc("W")) or GetAsyncKeyState(_VK_UP) then dy = -1
if GetAsyncKeyState(asc("S")) or GetAsyncKeyState(_VK_DOWN) then dy = 1
if GetAsyncKeyState(asc("Q")) or GetAsyncKeyState(_VK_LEFT) then dx = -1
if GetAsyncKeyState(asc("A")) or GetAsyncKeyState(_VK_LEFT) then dx = -1
if GetAsyncKeyState(asc("D")) or GetAsyncKeyState(_VK_RIGHT) then dx = 1
end sub
Have fun =)