I have been working on a 2d gauntlet type game and just “finished” the level editor. It seems to run fine up until it hits the “
If FILE EXIST(LevelName$)= 1 then DELETE FILE LevelName$” line. If the file exists it does not delete it so I get an error at the next line telling me the file already exists. If the file does exist it continues to make them but won’t actually write anything to them. I can’t figure it out so any help is appreciated.
Here is the code...
Rem *Name Undecided* Level Maker
Rem Level Name --------------------------
LevelName$ = "Level.map"
Rem End Name ----------------------------
Rem Map Tiles ---------------------------
WallTile$ = "Wall.bmp"
FloorTile$ = "Floor.bmp"
ExitTile$ = "Exit.bmp"
DoorTile$ = "Door.bmp"
EGenerator$ = "Generator.bmp"
KeyTile$ = "Key.bmp"
FoodTile$ = "Food.bmp"
FoodRes = 1
PotionTile$ = "Potion.bmp"
MagicRes = 1
HPTile$ = "HPTile.bmp"
HPUp = 10
MPTile$ = "MPTile.bmp"
MPUp = 10
AttackTile$ = "AttackTile.bmp"
AttackUp = 1
BowTile$ = "BowTile.bmp"
BowUp = 1
MagicTile$ = "MagicTile.bmp"
MagicUp = 1
DefenseTile$ = "DefenseTile.bmp"
DefenseUp = 1
Rem Map Tile End --------------------------
Rem Map -----------------------------------
XLevelSize = 20
YLevelSize = 20
Remstart
Tile Type: Array Number:
Wall 00
Floor 01
Start 02
Exit 03
Door 04
Enemy Generator 05
Key 06
Food 07
Potion 08
Hp Up 09
Mp Up 10
Attack Up 11
Bow Attack Up 12
Magic Up 13
Defense Up 14
Remend
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Data 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
Rem Make Array From Data
Dim LevelMap(XLevelSize,YLevelSize)
For X = 1 to XLevelSize
For Y = 1 to YLevelSize
Read Z
LevelMap(X,Y) = Z
Next Y
Next X
Rem Map End--------------------------------
Rem Enemy Bitmaps/Stats -------------------
MonsterLevelName$ = "Monsters" + LevelName$
Enemy0$ = "Enemy0.bmp"
Enemy1$ = "Enemy1.bmp"
Enemy2$ = "Enemy2.bmp"
Enemy3$ = "Enemy3.bmp"
Enemy4$ = "Enemy4.bmp"
Enemy5$ = "Enemy5.bmp"
Enemy6$ = "Enemy6.bmp"
Enemy7$ = "Enemy7.bmp"
Enemy8$ = "Enemy8.bmp"
Enemy9$ = "Enemy9.bmp"
Rem Enemy HP
Data 00,00,00,00,00,00,00,00,00,00
Rem Enemy Defense
Data 00,00,00,00,00,00,00,00,00,00
Rem Enemy Attack
Data 00,00,00,00,00,00,00,00,00,00
Rem Make Array From Monster Data
Dim MonsterData(10,3)
For Y = 1 to 3
For X = 1 to 10
Read Z
MonsterData(X,Y) = Z
Next X
Next Y
Rem End Enemy -----------------------------
Rem Data File -----------------------------------------------
Rem Check Files
If FILE EXIST(LevelName$)= 1 then DELETE FILE LevelName$
Make File LevelName$
If FILE EXIST(MonsterLevelName$)= 1 then DELETE FILE MonsterLevelName$
Make File MonsterLevelName$
Rem End Check Files
Rem Write Level Data ----------------
Open To Write 1,LevelName$
Write String 1,WallTile$
Write String 1,FloorTile$
Write String 1,ExitTile$
Write String 1,DoorTile$
Write String 1,EGenerator$
Write String 1,KeyTile$
Write String 1,FoodTile$
Write Byte 1,FoodRes
Write String 1,PotionTile$
Write Byte 1,MagicRes
Write String 1,HPTile$
Write Byte 1,HPUp
Write String 1,MPTile$
Write Byte 1,MPUp
Write String 1,AttackTile$
Write Byte 1,AttackUp
Write String 1,BowTile$
Write Byte 1,BowUp
Write String 1,MagicTile$
Write Byte 1,MagicUp
Write String 1,DefenseTile$
Write Byte 1,DefenseUp
Write Byte 1,XLevelSize
Write Byte 1,YLevelSize
For X = 1 to XLevelSize
For Y = 1 to YLevelSize
Write Byte 1,LevelMap(X,Y)
Next Y
Next X
Close File 1
Rem End Write Level Data -------------
Rem Write Monster Data ---------------
Open To Write 2,MonsterLevelName$
Write String 2,Enemy0$
Write String 2,Enemy1$
Write String 2,Enemy2$
Write String 2,Enemy3$
Write String 2,Enemy4$
Write String 2,Enemy5$
Write String 2,Enemy6$
Write String 2,Enemy7$
Write String 2,Enemy8$
Write String 2,Enemy9$
For Y = 1 to 3
For X = 1 to 10
Write Byte 2,MonsterData(X,Y)
Next X
Next Y
Close File 2
Rem End Write Monster Data -----------
Rem End Data File -------------------------------------------
A picture is worth a thousand words...in basic