[edit] I just re-read your post an realized that you didn't want the code. If you don't mind, I would like to leave it here for anyone else that is sor-of having similar problems but would like to see a simple of example of how it can be done. If you do not want it here under your post, just say so and I will edit it out. I will try to post some helpful suggestions later tonight without the actual code.
Thanks Zenassem
Here is the basic tile engine code. The only thing that you will need to do is create 4 solid color tiles, asnd save them in your projects directory. You can either name them as I have in the "load images" lines, or change the filenames in the code to match your names
remstart
The Tile Engine: Programmed by Edward Jomisko 2/2003
remend
goto init
rem //////////////////////////////////////////////////////////////
rem // //
rem // Initialize Game variables & objects //
rem // //
rem //////////////////////////////////////////////////////////////
rem --------------------------------------------------------------
rem ////////////////////// INIT //////////////////////////////
init:
rem //// game flags ////
rem boolean logic: 0=FALSE a 1=TRUE
FL_GameDone=0 ; rem flag to end game
frame=0;
sync rate 60; rem sets frame rate to 30 frames per second
sync on
rem **** Index into world array to be displayed ****
LeftMost=0
TopMost=0
RightMost=9
BottomMost=9
rem **** The max limits for the 10x10 grid ****
MaxRight=7
MaxLeft=2
MaxUp=2
MaxDown=7
rem **** WORLD DATA ****
TileSize=39; rem Size of each tile is 40 (0-39)
sx=0; rem sx is starting x position of tilebox
sy=0; rem sy is starting y position of tilebox
ex=TileSize; rem ex is ending x position of tilebox
ey=TileSize; rem ey is ending y position of tilebox
WorldSizeX=20; rem amount of tiles in the x-axis of world
WorldSizeY=20; rem amount of tiles in the y-axis of world
dim Ar_World(WorldSizeX,WorldSizeY)
rem **** LOAD TILE-WORLD BMP'S ****
load image "ice01.bmp" ,500
load image "mossy01.bmp" ,502
load image "grass.bmp" ,501
load image "pave11.bmp",503
rem **** LOAD WORLD FROM DATA ****
restore worlddata; rem restore data pointer to label worlddata
for IndexY=0 to 19
for IndexX=0 to 19
read Val
Ar_World(IndexX,IndexY) =Val
next IndexX
next IndexY
rem **** PLAYERS STARTING POSITION ****
CurrSpr=1; rem Current Sprite on world map
PWLocX=3; rem Players X World location
PWLocY=2; rem Players Y World location
PGridLocX=3;
PGridLocY=2;
PLocX=125; rem Players x pixel location
PLocY=80; rem Players y pixel location
rem !!!!!!!!!!!!!!!!!!!!!!! JUMPS to (MAIN)
goto main
set current bitmap 0
rem ////////////////// END OF INIT /////////////////////////
rem --------------------------------------------------------------
rem /////////////////////////////////////////////////////////////////
rem // //
rem // F U N C T I O N S //
rem // //
rem /////////////////////////////////////////////////////////////////
rem drawtile function
function draw_tile(TileNum,sx,sy)
paste image TileNum,sx,sy
endfunction drawtile
rem ////////////// Screen & Dialogue Functions ////////////////
rem ***** Messagebox function ****
function pop_up_box(Message$)
length=len(Message$)*15
ink rgb(255,255,255),1
box 100,320,290,380
ink rgb(40,40,255),1
box 102,322,288,378
ink rgb(255,255,255),1
text 105,330, Message$
endfunction pop_up_box
rem ***** Screen fade_out function ****
function fade_out()
rem Fade picture out
for f=0 to 255 step 8
r=255-f
g=255-f
b=255-f
set gamma r,g,b
next f
rem Short wait
sleep 500
endfunction fade_out
rem **** Screen fade_in function ****
function fade_in()
for f=0 to 255 step 8
r=f
g=f
b=f*2
set gamma r,g,b
next f
rem Short wait
sleep 500
rem Restore and End
set gamma 255,255,255
endfunction fade_in
rem ///////// END OF SCREEN & DIALOGUE FUNCTIONS //////////
rem -----------------------------------------------------------------
rem ///////////////// M A I N ///////////////////////////
main:
while FL_GameDone<>1
rem ------------------------------------------------------------------
rem ==================================================================
rem ////////////////////////////////////////////////////////
rem //
rem // GAME LOOP ACTAULLY BEGINS HERE!!!! //
rem //
rem ////////////////////////////////////////////////////////
rem **** Turn sync on to set framerate ****
rem **** Count frames up to 4 then reset to 0
frame=frame+1
if frame=2 then frame=0
sync
rem **** Draw the game world ****
for IndexY=TopMost to BottomMost
for IndexX=LeftMost to RightMost
tile=Ar_World(IndexX,IndexY)
select tile
case 0: TileNum=500: endcase
case 1: TileNum=501: endcase
case 2: TileNum=502: endcase
case 3: TileNum=503: endcase
draw_tile(TileNum,sx,sy)
endselect
sx=sx+TileSize; ex=ex+TileSize
next IndexX
sx=0; ex=39
sy=sy+39; ey=ey+39
next IndexY
rem **** Draw Border ****
ink rgb(255,255,255),1
line 0,0,0,391
line 0,0,391,0
line 0,391,391,391
line 391,0,391,391
rem **** Update player locationc ****
rem **** only allow movement every 4th loop cycle
if frame>0 then gosub getinput
rem **** Reset data for next frame ****
sx=0
sy=0
ex=39
ey=39
FL_Moved=0
endwhile
end
rem /////////////////////////////////////////////////////////////////
rem // //
rem // END OF GAME LOOP //
rem // //
rem /////////////////////////////////////////////////////////////////
rem
rem ======================================================================
rem ----------------------------------------------------------------------
rem //////// Subroutines ///////////////////////////////////////////
rem **** Display character Attributes ****
rem **** Check for user input *****
getinput:
if upkey()=1 then gosub chupmov
if downkey()=1 then gosub chdwmov
if leftkey()=1 then gosub chltmov
if rightkey()=1 then gosub chrtmov
if escapekey()=1 then end
return
rem **** Verify that player can move up *****
chupmov:
if Ar_World(PWLocX,PWLocY-1)>=1 then FL_Walkable=1
if PGridLocY=MaxUp and FL_Walkable=1
TopMost=TopMost-1
BottomMost=BottomMost-1
PWLocY=PWLocY-1
endif
if FL_Walkable=1 and PGridLocY>MaxUp
PWLocY=PWLocY-1
PGridLocY=PGridLocY-1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move down ****
chdwmov:
if Ar_World(PWLocX,PWLocY+1)>=1 then FL_Walkable=1
if PGridLocY=MaxDown and FL_Walkable=1
TopMost=TopMost+1
BottomMost=BottomMost+1
PWLocY=PWLocY+1
endif
if FL_Walkable=1 and PGridLocY<MaxDown
PWLocY=PWLocY+1
PGridLocY=PGridLocY+1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move left ****
chltmov:
if Ar_World(PWLocX-1,PWLocY)>=1 then FL_Walkable=1
if PGridLocX=MaxLeft and FL_Walkable=1
LeftMost=LeftMost-1
RightMost=RightMost-1
PWLocX=PWLocX-1
endif
if FL_Walkable=1 and PGridLocX>MaxLeft
PWLocX=PWLocX-1
PGridLocX=PGridLocX-1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move right ****
chrtmov:
if Ar_World(PWLocX+1,PWLocY)>=1 then FL_Walkable=1
if PGridLocX=MaxRight and FL_Walkable=1
LeftMost=LeftMost+1
RightMost=RightMost+1
PWLocX=PWLocX+1
endif
if FL_Walkable=1 and PGridLocX<MaxRight
PWLocX=PWLocX+1
PGridLocX=PGridLocX+1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Player Run ****
plrun:
FL_BattleOver=1
return
rem --------------------------------------------------------------------
rem -- --
rem -- G A M E D A T A --
rem -- --
rem --------------------------------------------------------------------
worlddata:
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,1,2,2,0,0,2,2,1,1,1,1,1,0,0
data 0,0,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,0,0
data 0,0,1,1,1,2,2,3,3,2,2,3,3,2,2,1,1,1,0,0
data 0,0,1,1,2,2,2,3,3,3,3,3,3,2,2,2,1,1,0,0
data 0,0,1,1,2,2,2,2,3,3,3,3,2,2,2,2,1,1,0,0
data 0,0,1,1,1,2,2,2,2,3,3,2,2,2,2,1,1,1,0,0
data 0,0,1,2,1,1,1,2,2,3,3,2,2,1,1,1,2,1,0,0
data 0,0,0,2,2,1,1,1,2,3,3,2,1,1,1,2,2,0,0,0
data 0,0,0,0,2,2,1,1,2,3,3,2,1,1,2,2,0,0,0,0
data 0,0,0,2,1,1,1,2,2,3,3,2,2,1,1,1,2,0,0,0
data 0,0,1,1,1,2,2,2,2,3,3,2,2,2,2,1,1,1,0,0
data 0,0,1,1,2,2,2,2,3,3,3,3,2,2,2,2,1,1,0,0
data 0,0,1,1,2,2,2,3,3,3,3,3,3,2,2,2,1,1,0,0
data 0,0,1,1,1,2,2,3,3,2,2,3,3,2,2,1,1,1,0,0
data 0,0,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,0,0
data 0,0,1,1,1,1,1,2,2,0,0,2,2,1,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
This is the code that uses more media, such as animated character and music. To get this to work, you will need to do the above + have a character animation of 12 frames, and a music file. It also contains backdrops for the battle engine, monster encounters, 5 layer world array etc... etc... Again if you want me to send you the media, e-mail me at zenassem@hotmail.com
remstart
The Craft: Programmed by Edward Jomisko 2/2003
The Craft version 1.0: A program adapted from the d20 RPG system
This version will setup the core Attributes for player creation
and a simple tile-based world & battle system.
features:
10*10 world
1 character Ar_Class
3 different tiles
3 different monsters
Future additions:
version 1.1 will add bitmap graphics to the battle system
version 1.2 add bitmaps graphics to world map
add sprite/bitmp graphics for player
remend
goto init
rem //////////////////////////////////////////////////////////////
rem // //
rem // Initialize Game variables & objects //
rem // //
rem //////////////////////////////////////////////////////////////
rem --------------------------------------------------------------
rem ////////////////////// INIT //////////////////////////////
init:
rem //// game flags ////
rem boolean logic: 0=FALSE a 1=TRUE
FL_GameDone=0 ; rem flag to end game
FL_BattleOver=0; rem flag to end battle mode
FL_Success=0; rem flag to signify a FL_Successful attack
FL_Moved=0; rem flag to signify if the player was able to move
FL_Walkable=0; rem flag to signify if the tile the player is moving to is FL_Walkable
sync rate 60; rem sets frame rate to 30 frames per second
sync on
rem **** Index into world array to be displayed ****
LeftMost=0
TopMost=0
RightMost=9
BottomMost=9
rem **** The max limits for the 10x10 grid ****
MaxRight=7
MaxLeft=2
MaxUp=2
MaxDown=7
rem **** PLAYER AttributeS ****
rem Core Player Attributes
Class$="Fighter"; rem this version has only 1 Class
PLev=1; rem Level
PStr=0; rem Strength
PDex=0; rem Dexterity
PCon=0; rem Constitution
PInt=0; rem Intelligence
PWis=0; rem Wisdom
PCha=0; rem Charisma
PVit=0; rem Vitality
PWou=0; rem Wounds
PDef=0; rem Defense
PMag=100; rem Magic %
PHp=32; rem Hit Points
PGol=0; rem Gold
PExp=0; rem Experience
rem Player Weapon Attributes
dim Ar_PWeaponDb(10,20); rem Weapons the player has
PWeapon=0; rem Currently selected weapon(c.s.w)
PWeaponDam=0; rem c.s.w. Damage
PWeaponErr=0; rem error
PWeaponBon=0; rem bonus
rem **** WEAPON AttributeS ****
rem Games Weapon Database
dim Ar_Weapon$(10,20)
rem gosub playercreation
rem **** CHARACTER/NPC IMAGE CONSTANTS ****
SpriteSizeX=24
SpriteSizeY=32
rem **** WORLD CONSTANTS ****
TileSize=39; rem Size of each tile is 40 (0-39)
sx=0; rem sx is starting x position of tilebox
sy=0; rem sy is starting y position of tilebox
ex=TileSize; rem ex is ending x position of tilebox
ey=TileSize; rem ey is ending y position of tilebox
WorldSizeX=20; rem amount of tiles in the x-axis of world
WorldSizeY=20; rem amount of tiles in the y-axis of world
WorldHeightZ=5; rem amount of layers in the z-axis of world
dim Ar_World(WorldSizeX,WorldSizeY,WorldHeightZ)
Rem **** Load character animation frames ****
load bitmap "Chubby1.bmp", 1
rem **** Images 1-12 Main character animation frames
ImageNum=1
for ImageSY=0 to 96 step SpriteSizeY
for ImageSX=144 to 192 step SpriteSizeX
get image ImageNum,ImageSX,ImageSY,ImageSX+24,ImageSY+32
ImageNum=ImageNum+1
next ImageSX
next ImageSY
rem **** Images 13-24 "$" animation frames
ImageNum=13
for ImageSY=0 to 96 step SpriteSizeY
for ImageSX=0 to 72 step SpriteSizeX
get image ImageNum,ImageSX,ImageSY,ImageSX + SpriteSizeX - 1,ImageSY +SpriteSizeY -1
ImageNum=ImageNum+1
next ImageSX
next ImageSY
delete bitmap 1
rem **** LOAD TILE-WORLD BMP'S ****
load image "ice01.bmp" ,500
load image "mossy01.bmp" ,502
load image "grass.bmp" ,501
load image "pave11.bmp",503
rem **** LOAD BACKDROP BMP,S
PLAINS=8000
FOREST=8001
PAVE=8002
load image "plainsG.bmp", PLAINS
load image "pave.bmp", PAVE
load image "forest1.bmp", FOREST
rem **** LOAD WORLD FROM DATA ****
restore worlddata; rem restore data pointer to label worlddata
for IndexZ=0 to WorldHeightZ-1
for IndexY=0 to WorldSizeY-1
for IndexX=0 to WorldSizeX-1
read Val
Ar_World(IndexX,IndexY,IndexZ) =Val
next IndexX
next IndexY
next IndexZ
rem **** MONSTER DATA ****
MAXMONSTERS=2
MAXATTRS=3
dim Ar_MonName$(MAXMONSTERS)
dim Ar_MonAttr(MAXMONSTERS,4)
rem **** LOAD MONSTER BITMAPS ****
WOLF = 900
SNAKE = 901
OGRE = 902
load bitmap "wolf.bmp",1
get image WOLF,0,0,71,71
delete bitmap 1
load bitmap "snake.bmp",1
get image SNAKE,0,0,71,54
delete bitmap 1
load bitmap "ogre.bmp",1
get image OGRE,0,0,62,64
delete bitmap 1
rem **** LOAD MONSTER DATA ****
restore monsterdata
for Index=0 to MAXMONSTERS
read MonsterName$
Ar_MonName$(Index)=MonsterName$
for Attrs=0 to MAXATTRS
read Attribute
Ar_MonAttr(Index,Attrs)=Attribute
next Attrs
next Index
load music "aphrodit.mid",1
load music "myFFBatt.mid",2
loop music 1
rem **** PLAYERS STARTING POSITION ****
CurrSpr=1; rem Current Sprite on world map
PWLocX=3; rem Players X World location
PWLocY=2; rem Players Y World location
PGridLocX=3;
PGridLocY=2;
PLocX=125; rem Players x pixel location
PLocY=80; rem Players y pixel location
sprite CurrSpr,PLocX,PLocY,1
rem !!!!!!!!!!!!!!!!!!!!!!! JUMPS to (MAIN)
goto main
set current bitmap 0
rem ////////////////// END OF INIT /////////////////////////
rem --------------------------------------------------------------
rem /////////////////////////////////////////////////////////////////
rem // //
rem // F U N C T I O N S //
rem // //
rem /////////////////////////////////////////////////////////////////
rem drawtile function
function draw_tile(TileNum,sx,sy)
if TileNum<>500
paste image TileNum,sx,sy
endif
endfunction drawtile
rem draws a player 10x10
function draw_player(PLocX,PLocY)
rem ink rgb(200,200,0),1
rem box PLocX,PLocY,PLocX+10,PLocY+10
rem sprite CurrSpr,PLocX,PLocY,lastmov
endfunction draw_player
rem //////////////// Dice Roll Functions ///////////////
remstart
These functions simulateValues of rolling dice
The function names are in the form:
xdy where x is the number of times a y sided die is rolled
i.e.
3d6 is equivalent to rolling a 6-sided die 3 times
remend
function 1d4()
Value=rnd(3)+1
endfunction Value
rem returns aValue from 1-6
function 1d6()
Value=rnd(5)+1
endfunction Value
function 2d6()
Value=rnd(11)+1
endfunction Value
rem returns aValue from 3-18
function 3d6()
Value=(rnd(5)+1)+(rnd(5)+1)+(rnd(5)+1)
endfunction Value
function 1d8()
Value=rnd(7)+1
endfunction Value
rem //////////////// End Dice Roll Functions /////////////////
rem ////////////// Screen & Dialogue Functions ////////////////
rem ***** Messagebox function ****
function pop_up_box(Message$)
length=len(Message$)*15
ink rgb(255,255,255),1
box 100,320,290,380
ink rgb(40,40,255),1
box 102,322,288,378
ink rgb(255,255,255),1
text 105,330, Message$
endfunction pop_up_box
rem ***** Screen fade_out function ****
function fade_out()
rem Fade picture out
for f=0 to 255 step 8
r=255-f
g=255-f
b=255-f
set gamma r,g,b
next f
rem Short wait
sleep 500
endfunction fade_out
rem **** Screen fade_in function ****
function fade_in()
for f=0 to 255 step 8
r=f
g=f
b=f*2
set gamma r,g,b
next f
rem Short wait
sleep 500
rem Restore and End
set gamma 255,255,255
endfunction fade_in
rem ///////// END OF SCREEN & DIALOGUE FUNCTIONS //////////
function mon_attack(DieSelect)
select DieSelect
case 4: Damage=1d4(): endcase
case 8: Damage=1d8(): endcase
endselect
ink rgb(255,255,255),1
text 380,360, "Success!!!"
ink rgb(200,0,0),1
text 380,380, "Causes "+str$(Damage)+" damage to player"
wait 2000
endfunction Damage
rem ------------------------------------------------------------------
rem =========================================================================================================
rem =========================================================================================================
rem ////////////////////////////////////////////////////////
rem //
rem // GAME LOOP ACTAULLY BEGINS HERE!!!! //
rem //
rem ////////////////////////////////////////////////////////
rem ------------------------------------------------------------------
rem ///////////////// M A I N ///////////////////////////
main:
while FL_GameDone<>1
rem **** Turn sync on to set framerate ****
sync
rem **** Draw the game world ****
for IndexZ=0 to WorldHeightZ-1
for IndexY=TopMost to BottomMost
for IndexX=LeftMost to RightMost
tile=Ar_World(IndexX,IndexY,IndexZ)
select tile
case 0: TileNum=500: endcase
case 1: TileNum=501: endcase
case 2: TileNum=502: endcase
case 3: TileNum=503: endcase
draw_tile(TileNum,sx,sy)
endselect
sx=sx+TileSize; ex=ex+TileSize
next IndexX
sx=0; ex=39
sy=sy+39; ey=ey+39
next IndexY
sy=0
next IndexZ
rem **** Draw Border ****
ink rgb(255,255,255),1
line 0,0,0,391
line 0,0,391,0
line 0,391,391,391
line 391,0,391,391
rem **** Display character info ****
gosub chattrdisp
rem **** Update player locationc ****
gosub getinput
rem **** Check for monster encounter ****
if FL_Moved=1 then gosub chencounter
rem **** Reset data for next frame ****
sx=0
sy=0
ex=39
ey=39
FL_Moved=0
endwhile
end
rem /////////////////////////////////////////////////////////////////
rem // //
rem // END OF GAME LOOP //
rem // //
rem /////////////////////////////////////////////////////////////////
rem
rem ===========================================================================================================
rem ===========================================================================================================
rem ----------------------------------------------------------------------
rem //////// Subroutines ///////////////////////////////////////////
rem **** Display character Attributes ****
chattrdisp:
set text size 18
set text font "monotype corsiva"
ink rgb(150,150,0),1
box 398,0,632,82
ink rgb(120,20,40),1
box 400,2,630,80
ink rgb(255,255,255),1
text 405,4, "Neenie"
set text size 16
text 405,30, "HP = "
text 490,30, "Magic = "
text 405,45, "Level = "
text 490,45, "Exp ="
ink rgb(255,255,0),1
set cursor 440,30; print PHp
set cursor 540,30; print PMag, "%"
set cursor 445,45; print PLev
set cursor 540,45; print PExp
set cursor 405,60; print PGol, " gp."
rem sprite 2,575,20,1
return
rem **** Display monster Attributes in battlemode ****
MonAttrdisp:
set text size 18
set text font "monotype corsiva"
ink rgb(150,150,150),1
box 398,0,639,82
ink rgb(20,120,40),1
box 400,2,637,80
ink rgb(255,255,255),1
text 405,4, monster$
set text size 16
text 405,30, "HP = "
text 490,30, "Magic = "
ink rgb(255,255,0),1
set cursor 440,30; print monhp
set cursor 540,30; print PMag, "%"
return
rem **** Display character Attributes in battlemode ****
chattrdisp2:
set text size 18
set text font "monotype corsiva"
ink rgb(150,150,0),1
box 0,0,234,82
ink rgb(120,20,40),1
box 2,2,232,80
ink rgb(255,255,255),1
text 5,4, "Neenie"
set text size 16
text 5,30, "HP = "
text 90,30, "Magic = "
text 5,45, "Level = "
text 90,45, "Exp ="
ink rgb(200,200,0),1
set cursor 40,30; print PHp
set cursor 140,30; print PMag, "%"
set cursor 45,45; print PLev
set cursor 140,45; print PExp
set cursor 5,60; print PGol, " gp."
return
rem **** Check for user input *****
getinput:
if upkey()=1 then gosub chupmov
if downkey()=1 then gosub chdwmov
if leftkey()=1 then gosub chltmov
if rightkey()=1 then gosub chrtmov
if escapekey()=1 then end
return
rem **** Verify that player can move up *****
chupmov:
if Ar_World(PWLocX,PWLocY-1,2)>=1 then FL_Walkable=1
if PGridLocY=MaxUp and FL_Walkable=1
TopMost=TopMost-1
BottomMost=BottomMost-1
PWLocY=PWLocY-1
for anim=1 to 3
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
sprite CurrSpr,PLocX,PLocY, 2
endif
if FL_Walkable=1 and PGridLocY>MaxUp
PWLocY=PWLocY-1
PGridLocY=PGridLocY-1
for anim=1 to 3
sprite CurrSpr,PLocX,PLocY,anim
wait 60
PLocY=PLocY-13
next anim
sprite CurrSpr,PLocX,PLocY, 2
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move down ****
chdwmov:
if Ar_World(PWLocX,PWLocY+1,2)>=1 then FL_Walkable=1
if PGridLocY=MaxDown and FL_Walkable=1
TopMost=TopMost+1
BottomMost=BottomMost+1
PWLocY=PWLocY+1
for anim=7 to 9
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
sprite CurrSpr,PLocX,PLocY,8
endif
if FL_Walkable=1 and PGridLocY<MaxDown
PWLocY=PWLocY+1
PGridLocY=PGridLocY+1
for anim=7 to 9
sprite CurrSpr,PLocX,PLocY,anim
wait 60
PLocY=PLocY+13
next anim
sprite CurrSpr,PLocX,PLocY,8
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move left ****
chltmov:
if Ar_World(PWLocX-1,PWLocY,2)>=1 then FL_Walkable=1
if PGridLocX=MaxLeft and FL_Walkable=1
for anim=10 to 12
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
LeftMost=LeftMost-1
RightMost=RightMost-1
PWLocX=PWLocX-1
endif
if FL_Walkable=1 and PGridLocX>MaxLeft
for anim=10 to 12
PLocX=PLocX-13
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
PWLocX=PWLocX-1
PGridLocX=PGridLocX-1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Verify that player can move right ****
chrtmov:
if Ar_World(PWLocX+1,PWLocY,2)>=1 then FL_Walkable=1
if PGridLocX=MaxRight and FL_Walkable=1
LeftMost=LeftMost+1
RightMost=RightMost+1
PWLocX=PWLocX+1
for anim=4 to 6
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
endif
if FL_Walkable=1 and PGridLocX<MaxRight
for anim=4 to 6
PLocX=PLocX+13
sprite CurrSpr,PLocX,PLocY,anim
wait 60
next anim
PWLocX=PWLocX+1
PGridLocX=PGridLocX+1
endif
FL_Walkable=0
FL_Moved=1
return
rem **** Check for random monster encounter ****
chencounter:
battle=3d6()
if battle >= 7 then return
stop music 1
loop music 2
ink rgb(255,255,255),1
set text size 16
set text font "teletype"
bMessage$= "Entering Battle Mode..."
pop_up_box(bMessage$)
wait 600
chosenmonster=rnd(MAXMONSTERS)
monster$=Ar_MonName$(chosenmonster)
CurrMon=Ar_MonAttr(chosenmonster,0)
monattk=Ar_MonAttr(chosenmonster,1)
monhp=Ar_MonAttr(chosenmonster,2)
monexp=Ar_MonAttr(chosenmonster,3)
turn=rnd(2)+1
fade_out()
Area=Ar_World(PWLocX,PWLocY,2)
select Area
case 1: CurrBackDrop=PLAINS: endcase
case 2: CurrBackDrop=FOREST: endcase
case 3: CurrBackDrop=PAVE: endcase
endselect
rem *** add battle code here
cls
gosub battlescrn
fade_in()
while FL_BattleOver=0
gosub battlescrn
if turn=1
gosub monsterturn
else
gosub playerturn
endif
endwhile
fade_out()
delete sprite 2
delete sprite CurrMon
show sprite CurrSpr
gosub chupmov
gosub chdwmov
stop music 2
loop music 1
cls
fade_in()
FL_BattleOver=0
return
rem **** Draw The Battle Screen ****
battlescrn:
hide sprite CurrSpr
gosub chattrdisp2
gosub MonAttrdisp
ink rgb(200,200,200),1
paste image CurrBackDrop,160,130
sprite 2,230,230,5
sprite CurrMon,340,210,CurrMon
box 0,330,639,479
ink rgb(0,0,100),1
box 3,333,636,476
return
rem **** Monsters Turn ****
monsterturn:
turn=2
ink rgb(0,0,100),1
box 3,333,636,476
ink rgb(255,255,255),1
set text size 24
text 305,340, ">>"
ink rgb(255,255,255),1
set text size 18
text 380,340, monster$+" attacks"
hitFL_Success=rnd(9)+1
if hitFL_Success>3 then FL_Success=1
if FL_Success=0 then ink rgb(200,0,0),1; text 380,360, "Missed!!!"; sleep 2000; return
plDamage=mon_attack(monattk)
PHp=PHp-plDamage
if PHp<=0
FL_GameDone=1
FL_BattleOver=1
endif
FL_Success=0
return
rem **** Players Turn ****
playerturn:
turn=1
ink rgb(0,0,100),1
box 3,333,636,476
ink rgb(255,255,255),1
set text size 24
text 305,340, "<<"
set text size 18
set cursor 4,340
input pchoice$
select pchoice$
case "A": gosub plattack: endcase
case "M": endcase
case "S": endcase
case "R": gosub plrun: endcase
case default: goto playerturn: endcase
endselect
wait 2000
return
rem **** Player Attack ****
plattack:
monDamage=2d6()
ink rgb(255,255,255),1
offset sprite 2, -20, 0
wait 150
offset sprite 2, 20, 0
WAIT 50
text 10,340, " ...:::: ATTACK ::::..."
text 10,360, "Success!!!"
text 10,380, "Causes "+str$(monDamage)+" Damage to "+monster$
monhp=monhp-monDamage
if monhp<=0
monhp=0
FL_BattleOver=1
set text font "pegasus"
set text size 18
ink rgb(200,200,0),1
text 10,420, "YOU HAVE DEFEATED THE "+monster$+" !!!"
for times=1 to 4
for anim=4 to 6
sprite 2,230,230,anim
wait 100
next anim
sprite 2,230,230,5
next times
wait 1000
expp=Ar_MonAttr(chosenmonster,2)
ink rgb(0,200,0),1
text 10,440, "You gain "+str$(expp)+" Experience points."
PExp=PExp+expp
wait 2000
endif
return
rem **** Player Run ****
plrun:
FL_BattleOver=1
return
rem ///////////////////// PLAYER CREATION ////////////////////////
playercreation:
ink rgb(255,0,0),1
box 0,0,150,20
ink rgb(255,255,255),1
print " Character Generation"
print "-------------------------------------------------------------------"
print
print "Generating Character Attributes"
PStr=3d6()+3 ; rem +3 modifier for fighter Ar_Class
PDex=3d6()+2
PCon=3d6()
PInt=3d6()
PWis=3d6()
PCha=3d6()
PVit=3d6()+2
ink rgb(0,100,0),1
box 0,80,150,200
ink rgb(200,200,0),1
print
print " Strength - "; PStr
print " Dexterity - "; PDex
print " Constitution - "; PCon
print " Intelligence - "; PInt
print " Wisdom - "; PWis
print " Charisma - "; PCha
print " Vitality - "; PVit
print
ink rgb(255,255,255),1
rem stub place choice code here!!!
return
rem //////// END PLAYER CREATION /////////////////
rem --------------------------------------------------------------------
rem -- --
rem -- G A M E D A T A --
rem -- --
rem --------------------------------------------------------------------
worlddata:
rem layer 0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,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0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
monsterdata:
data "Tiger Snake", 901, 4, 6, 10
data "Grey Wolf", 900, 4, 8, 15
data "Ogre", 902, 8, 8, 20