|
Post by tsh73 on Feb 1, 2022 14:30:55 GMT -5
Interesting place to run around  . I guess that black box just replaces Windows "X" top right. By the way, if you use window_popup, the window title "Open World PIXEL RPG 4.0" is not visible at all! Add #main.map, "discard" right after [endLEVEL] Also it really bothered me that 6 special squares were repainted every x,y So I move it out of loop and put IF which prevents them being repainted inside of loop. ' Touch the green case = victory ; Touch the red case = Game over ; Black case for exit the game
' Creat By Atomose Studio 2022 with LibertyBasic 4.51 pro
nomainwin
dim p(x,y) : global dy,dx : WindowWidth = 1600 : WindowHeight = 900 : UpperLeftX=int((DisplayWidth-WindowWidth)/2) : UpperLeftY=int((DisplayHeight-WindowHeight)/2) : x= 90 : y= 60 : valIniX = 21 : valIniY = 10 : perso1x = 30 : perso1y = 15 : ennemi1x = 36 : ennemi1y = 17 : ennemi2x = 41 : ennemi2y = 25 : ennemi3x = 19 : ennemi3y = 33 : ennemi4x = 50 : ennemi4y = 40 : ennemi5x = 55 : ennemi5y = 30
graphicbox #main.map, 0+10, 0+10, WindowWidth-20, WindowHeight-20
open "Open World PIXEL RPG 4.0" for window_popup as #main
#main, "trapclose [quit]"
#main.map, "setfocus; down; fill white; when leftButtonDown [close]"
' map du jeu ou les 0 representent les zones ou l'ont peut marcher
redim p(x,y)
data 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,4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,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
data 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
for b=0 to y-1
for a=0 to x-1
read valeur : p(a,b)= valeur
next a
next b
[endLEVEL]
#main.map, "discard"
timer 0
' mouvements des ennemis , 4 possibilitees pour 4 directions avec conditions de detections d'obstables
ennemi1moove = int(rnd(1)*4+1)
select case ennemi1moove
case 1
if p((ennemi1x+1),(ennemi1y)) = 0 and ennemi1x <88 then ennemi1x = ennemi1x + 1
case 2
if p((ennemi1x-1),(ennemi1y)) = 0 and ennemi1x >2 then ennemi1x = ennemi1x - 1
case 3
if p((ennemi1x),(ennemi1y+1)) = 0 and ennemi1y <58 then ennemi1y = ennemi1y + 1
case 4
if p((ennemi1x),(ennemi1y-1)) = 0 and ennemi1y >2 then ennemi1y = ennemi1y - 1
end select
ennemi2moove = int(rnd(1)*4+1)
select case ennemi2moove
case 1
if p((ennemi2x+1),(ennemi2y)) = 0 and ennemi2x <88 then ennemi2x = ennemi2x + 1
case 2
if p((ennemi2x-1),(ennemi2y)) = 0 and ennemi2x >2 then ennemi2x = ennemi2x - 1
case 3
if p((ennemi2x),(ennemi2y+1)) = 0 and ennemi2y <58 then ennemi2y = ennemi2y + 1
case 4
if p((ennemi2x),(ennemi2y-1)) = 0 and ennemi2y >2 then ennemi2y = ennemi2y - 1
end select
ennemi3moove = int(rnd(1)*4+1)
select case ennemi3moove
case 1
if p((ennemi3x+1),(ennemi3y)) = 0 and ennemi3x <88 then ennemi3x = ennemi3x + 1
case 2
if p((ennemi3x-1),(ennemi3y)) = 0 and ennemi3x >2 then ennemi3x = ennemi3x - 1
case 3
if p((ennemi3x),(ennemi3y+1)) = 0 and ennemi3y <58 then ennemi3y = ennemi3y + 1
case 4
if p((ennemi3x),(ennemi3y-1)) = 0 and ennemi3y >2 then ennemi3y = ennemi3y - 1
end select
ennemi5moove = int(rnd(1)*4+1)
select case ennemi5moove
case 1
if p((ennemi5x+1),(ennemi5y)) = 0 and ennemi5x <88 then ennemi5x = ennemi5x + 1
case 2
if p((ennemi5x-1),(ennemi5y)) = 0 and ennemi5x >2 then ennemi5x = ennemi5x - 1
case 3
if p((ennemi5x),(ennemi5y+1)) = 0 and ennemi5y <58 then ennemi5y = ennemi5y + 1
case 4
if p((ennemi5x),(ennemi5y-1)) = 0 and ennemi5y >2 then ennemi5y = ennemi5y - 1
end select
ennemi4moove = int(rnd(1)*4+1)
select case ennemi4moove
case 1
if p((ennemi4x+1),(ennemi4y)) = 0 and ennemi4x <88 then ennemi4x = ennemi4x + 1
case 2
if p((ennemi4x-1),(ennemi4y)) = 0 and ennemi4x >2 then ennemi4x = ennemi4x - 1
case 3
if p((ennemi4x),(ennemi4y+1)) = 0 and ennemi4y <58 then ennemi4y = ennemi4y + 1
case 4
if p((ennemi4x),(ennemi4y-1)) = 0 and ennemi4y >2 then ennemi4y = ennemi4y - 1
end select
' boucle qui genere la map
' personnage
#main.map, "color brown; backcolor cyan ; place ";int(WindowWidth/2)-(WindowWidth/31);" ";int(WindowHeight/2)-(WindowHeight/28);"; boxfilled ";int((WindowWidth/2)+(WindowWidth/48));" ";int(WindowHeight/2)+(WindowHeight/17)
' ennemis
#main.map, "backcolor red ; color yellow"
#main.map, "place ";int((ennemi1x-valIniX)*((WindowWidth/19)-1));" ";int((ennemi1y-valIniY)*((WindowHeight/11)+1.85));"; boxfilled ";int((ennemi1x-valIniX)*((WindowWidth/19)-1)+82);" ";int((ennemi1y-valIniY)*((WindowHeight/11)+1.85)+82)
#main.map, "place ";int((ennemi2x-valIniX)*((WindowWidth/19)-1));" ";int((ennemi2y-valIniY)*((WindowHeight/11)+1.85));"; boxfilled ";int((ennemi2x-valIniX)*((WindowWidth/19)-1)+82);" ";int((ennemi2y-valIniY)*((WindowHeight/11)+1.85)+82)
#main.map, "place ";int((ennemi3x-valIniX)*((WindowWidth/19)-1));" ";int((ennemi3y-valIniY)*((WindowHeight/11)+1.85));"; boxfilled ";int((ennemi3x-valIniX)*((WindowWidth/19)-1)+82);" ";int((ennemi3y-valIniY)*((WindowHeight/11)+1.85)+82)
#main.map, "place ";int((ennemi5x-valIniX)*((WindowWidth/19)-1));" ";int((ennemi5y-valIniY)*((WindowHeight/11)+1.85));"; boxfilled ";int((ennemi5x-valIniX)*((WindowWidth/19)-1)+82);" ";int((ennemi5y-valIniY)*((WindowHeight/11)+1.85)+82)
' pion a atteindre pour gagner
#main.map, "backcolor green ; color black ; place ";int((ennemi4x-valIniX)*((WindowWidth/19)-1));" ";int((ennemi4y-valIniY)*((WindowHeight/11)+1.85));"; boxfilled ";int((ennemi4x-valIniX)*((WindowWidth/19)-1)+82);" ";int((ennemi4y-valIniY)*((WindowHeight/11)+1.85)+82)
for y=int(0+valIniY) to int(valIniY+10)
'redraw this exit square every line ' case fermeture du jeu
#main.map, "BACKCOLOR BLACK; place ";int(WindowWidth-90);" ";10;"; boxfilled ";int(WindowWidth-90)+50;" ";60
for x= int(0+valIniX) to int(valIniX+18)
'do not repaint special squares if (x = ennemi1x and y = ennemi1y) or _ (x = ennemi2x and y = ennemi2y) or _ (x = ennemi3x and y = ennemi3y) or _ (x = ennemi4x and y = ennemi4y) or _ (x = ennemi5x and y = ennemi5y) or _ (perso1x= x and perso1y = y) _ then [skip]
select case p(x,y)
case 0
' terrain accecible
#main.map, "color lightgray; backcolor lightgray; place ";valX;" ";valY;"; boxfilled ";valX+((WindowWidth/19)-1);" ";valY+((WindowHeight/11)+1.85)
case 1
' murs
#main.map, "color black ; backcolor darkgray; place ";valX;" ";valY;"; boxfilled ";valX+((WindowWidth/19)-1.05);" ";valY+((WindowHeight/11)+1.85)
case 2,3,4
' textures en dehors des limites
#main.map, "color blue ; backcolor blue; place ";valX;" ";valY;"; boxfilled ";valX+((WindowWidth/19)-1.05);" ";valY+((WindowHeight/11)+1.85)
end select [skip] valX = valX + ((WindowWidth/19)-1.05)
next
valX = 0 : valY = valY + ((WindowHeight/11)+1.85)
next
valX = 0 : valY = 0
' condition de victoire ou de defaite
if (ennemi1x = perso1x and ennemi1y = perso1y) or (ennemi2x = perso1x and ennemi2y = perso1y) or (ennemi3x = perso1x and ennemi3y = perso1y) or (ennemi5x = perso1x and ennemi5y = perso1y) then notice " " + chr$(13) + "Game Over" : close #main : end
if (ennemi4x = perso1x and ennemi4y = perso1y) then notice " " + chr$(13) + "Victory !" : close #main : end
' commandes qui interprete les touches du joueur (deplacement)
dx = 0 : dy = 0 : call readJStick 1 : if dy <> 0 then dx = 0
valIniX = valIniX+(1*dx) : perso1x = perso1x +(1*dx) : valIniY = valIniY+(1*dy) : perso1y = perso1y +(1*dy)
select case p(perso1x,perso1y)
case 1
if dx = -1 then dx = 0 : valIniX = valIniX +1 : perso1x = perso1x +1
if dx = 1 then dx = 0 : valIniX = valIniX -1 : perso1x = perso1x -1
if dy = 1 then dy = 0 : valIniY = valIniY -1 : perso1y = perso1y -1
if dy = -1 then dy = 0 : valIniY = valIniY +1 : perso1y = perso1y +1
end select
timer 40, [endLEVEL] 'timer 300, [endLEVEL]
wait
[close]
mX = MouseX : mY = MouseY
if mX > int(WindowWidth-90) and mX < int(WindowWidth-90)+50 and mY > 10 and mY < 60 then goto [quit]
wait
[quit]
timer 0 : close #main : end
' les deux fonctions ci dessous sont a utiliser avec le call pour avoir un deplacement avec les touches sans delais
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
|
|