spookyln
Member
hi all,
i rewriting my game spokoban to fenix but some bug in my LevelEdit code.
whats wrong?
btw: im totally new in fenix. pls be tolerant
when i hit __START and save block number to Tiles[x][y], many others are filled too
thanks for help
i used 0.92a version of Fenix compiled on Ubuntu Feisty
CODE
/*
Level editor pro novou verzi spokobanu
*/
program LevelEdit;
global
// control keys for gp2x and keyboard
__A = _control;
__B = _alt;
__SELECT = _space;
__START = _enter;
__R = _tab;
__L = _backspace;
fpg;
struct Level
string name; // jmeno levelu
string autor; // jmeno autora
string poznamky; // poznamky k levelu
string tileset; // jaky tileset je pouzit v levelu
int completed; // jestli byl level dohran
word hiscore; // nejvyssi dosazene skore
int Tiles[20][14]; // 20 sloupcu na level 14 rad
end
begin
set_mode(320, 240, 16, 0);
//RenderLevel();
MakeLevel();
repeat
frame;
until(key(_esc))
unload_fpg(fpg);
let_me_alone();
end
process RenderLevel();
private
xp;
yp;
pnt;
begin
/*
load("level.spo", Level);
fpg = load_fpg("gfx/New.fpg");
from pnt=1 to 3
set_point(fpg,pnt,0,0,0);
end
*/
clear_screen();
from xp = 0 to 19
from yp = 0 to 13
put(fpg, Level.Tiles[xp][yp], xp << 4, yp << 4);
end
end
frame;
end
process MakeLevel();
private
block=1;
xpos=0;
ypos=0;
pnt;
begin
graph=block;
fpg = load_fpg("gfx/New.fpg");
from pnt=1 to 3
set_point(fpg,pnt,0,0,0);
end
write_int(0,0,230,0,&xpos);
write_int(0,50,230,0,&ypos);
write_int(0,100,230,0,&block);
loop
//RenderLevel();
if (key(_left))
xpos = xpos - 1;
if (xpos<=0) xpos=0; end
x=xpos << 4;
while(key(_left)) frame; end
end
if (key(_right))
xpos = xpos + 1;
if (xpos>=19) xpos=19; end
x = xpos << 4;
while(key(_right)) frame; end
end
if (key(_up))
ypos = ypos - 1;
if(ypos<=0) ypos=0; end
y=ypos << 4;
while(key(_up)) frame; end
end
if (key(_down))
ypos = ypos + 1;
if(ypos>=13) ypos=13; end
y=ypos << 4;
while(key(_down)) frame; end
end
if (key(_esc))
save("level.spo", Level);
exit("",0);
end
if (key(__SELECT))
block=(block %3)+1;
graph=block;
while(key(__SELECT)) frame; end
end
if (key(__START))
Level.Tiles[xpos][ypos] = block;
RenderLevel();
while(key(__START)) frame; end
end
if (key(__B))
Level.name = "test lvl";
Level.autor = "spooky.ln";
Level.poznamky = "bez poznamek";
Level.tileset="winter";
Level.completed = 0;
Level.hiscore = 3000;
save("level.spo", Level);
end
frame;
end
end
i rewriting my game spokoban to fenix but some bug in my LevelEdit code.
whats wrong?
btw: im totally new in fenix. pls be tolerant
when i hit __START and save block number to Tiles[x][y], many others are filled too
thanks for help
i used 0.92a version of Fenix compiled on Ubuntu Feisty
CODE
/*
Level editor pro novou verzi spokobanu
*/
program LevelEdit;
global
// control keys for gp2x and keyboard
__A = _control;
__B = _alt;
__SELECT = _space;
__START = _enter;
__R = _tab;
__L = _backspace;
fpg;
struct Level
string name; // jmeno levelu
string autor; // jmeno autora
string poznamky; // poznamky k levelu
string tileset; // jaky tileset je pouzit v levelu
int completed; // jestli byl level dohran
word hiscore; // nejvyssi dosazene skore
int Tiles[20][14]; // 20 sloupcu na level 14 rad
end
begin
set_mode(320, 240, 16, 0);
//RenderLevel();
MakeLevel();
repeat
frame;
until(key(_esc))
unload_fpg(fpg);
let_me_alone();
end
process RenderLevel();
private
xp;
yp;
pnt;
begin
/*
load("level.spo", Level);
fpg = load_fpg("gfx/New.fpg");
from pnt=1 to 3
set_point(fpg,pnt,0,0,0);
end
*/
clear_screen();
from xp = 0 to 19
from yp = 0 to 13
put(fpg, Level.Tiles[xp][yp], xp << 4, yp << 4);
end
end
frame;
end
process MakeLevel();
private
block=1;
xpos=0;
ypos=0;
pnt;
begin
graph=block;
fpg = load_fpg("gfx/New.fpg");
from pnt=1 to 3
set_point(fpg,pnt,0,0,0);
end
write_int(0,0,230,0,&xpos);
write_int(0,50,230,0,&ypos);
write_int(0,100,230,0,&block);
loop
//RenderLevel();
if (key(_left))
xpos = xpos - 1;
if (xpos<=0) xpos=0; end
x=xpos << 4;
while(key(_left)) frame; end
end
if (key(_right))
xpos = xpos + 1;
if (xpos>=19) xpos=19; end
x = xpos << 4;
while(key(_right)) frame; end
end
if (key(_up))
ypos = ypos - 1;
if(ypos<=0) ypos=0; end
y=ypos << 4;
while(key(_up)) frame; end
end
if (key(_down))
ypos = ypos + 1;
if(ypos>=13) ypos=13; end
y=ypos << 4;
while(key(_down)) frame; end
end
if (key(_esc))
save("level.spo", Level);
exit("",0);
end
if (key(__SELECT))
block=(block %3)+1;
graph=block;
while(key(__SELECT)) frame; end
end
if (key(__START))
Level.Tiles[xpos][ypos] = block;
RenderLevel();
while(key(__START)) frame; end
end
if (key(__B))
Level.name = "test lvl";
Level.autor = "spooky.ln";
Level.poznamky = "bez poznamek";
Level.tileset="winter";
Level.completed = 0;
Level.hiscore = 3000;
save("level.spo", Level);
end
frame;
end
end