HomeRadioPortalCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 A game in free basic

View previous topic View next topic Go down 
AuthorMessage
Letiger
888.com
888.com
avatar

Posts : 906
Prestige : 4098
Verve-Fame : 17
Join date : 2009-12-23
Age : 24
Location : Russia.

PostSubject: A game in free basic   9/28/2010, 9:28 pm

THIS, is a real rpg.

option explicit
'$include:'fmod.bi'

Declare Sub LoadMap (map$, p%, wx%, wy%)
Declare Sub quit ()
Declare Sub killer ()
Declare Sub Shop1 ()
Declare Sub Shop2 ()
Declare Sub Shop3 ()
Declare Sub Shop4 ()
Declare Sub GotAItem ()
Declare Sub Death ()
Declare Sub Story ()
Declare Sub LoadEnemies ()
Declare Sub Fight ()
Declare Sub LoadGame ()
Declare Sub MenuStatus ()
Declare Sub MenuItems ()
Declare Sub Menu1 ()
Declare Sub MenuSaveGame ()
Declare Sub Info ()
Declare Sub WhatsUp (FileName$)
Declare Sub NpcTalk (FileName$)
Declare Sub CheckFig ()
Declare Sub CheckMusic ()
Declare Sub LoadShit ()
Declare Sub TEXT (a$, C as integer, XCoordinate as integer, YCoordinate as integer, Size as integer)
Declare Sub delay (Seconds as integer)
Declare Sub box (X, y, x2, y2)
Declare Sub ChangeAnim ()
Declare Sub InitVars ()
Declare Sub LoadTiles ()
Declare Sub waitkey ()
Declare Sub Begin ()
Declare Sub Loadfont ()
Declare Sub ShowMap ()
Declare Sub SetupPalette ()
Declare Sub MoveDown ()
Declare Sub MoveLeft ()
Declare Sub MoveRight ()
Declare Sub MoveUp ()
Declare Sub putPlayerPic ()
Declare Sub PutTile (Ico, Jco, MapNo)
Declare Sub TheEnd
Declare Sub LoopMIDI

Declare Function Fixed$ (Num%)


Type WorldDataType
Rows As Integer
Cols As Integer
TopRow As Integer
TopCol As Integer
Action As Integer
Place As Integer
AnimCycle As Integer
Direc As Integer
PlayerY As Integer
Terreng As Integer
NPC As Integer
Inside As Integer
End Type

Type MapType
Tile As Integer
Walkon As Integer
End Type

Type Playerdata
frame as integer
nextframe as integer
dir as integer
end type

Const North = 1, South = 2, East = 3, West = 4
Const true = -1, false = 0

Dim Shared CharSet(128, 8, 6) as integer, kbd$, RndNum1, RndNum2
Dim Shared HowMany, Enemy1Name$, Enemy1Hp, Enemy1Attack, Enemy1Defence, Enemy1Poison, Enemy1Gold
Dim Shared Enemy2Name$, Enemy2Hp, Enemy2Attack, Enemy2Defence, Enemy2Poison, Enemy2Gold
Dim Shared Enemy3Name$, Enemy3Hp, Enemy3Attack, Enemy3Defence, Enemy3Poison, Enemy3Gold
Dim Shared kills, Runa, Hp, MaxHp, chrname as string, gold%, Poisoned, PHerb, Fpot, SPot, AHerb, Wep$, Arm$, WepB, ArmB, ItemWepB, ItemArmB, O1, O2, O3, O4, O5, Q1, Q2, Q3, Q4, Q5
Dim Shared PlayerLeft1(129), PlayerUp1(129), PlayerDown1(129), PlayerRight1(129)
Dim Shared PlayerLeft2(129), PlayerUp2(129), PlayerDown2(129), PlayerRight2(129)
Dim Shared PlayerLeft1Mask(129), PlayerUp1Mask(129), PlayerDown1Mask(129), PlayerRight1Mask(129)
Dim Shared PlayerLeft2Mask(129), PlayerUp2Mask(129), PlayerDown2Mask(129), PlayerRight2Mask(129)
Dim Shared WorldData As WorldDataType
Dim Shared map(-9 To 67, -9 To 67) As MapType
Dim Shared NpcFile$, PlaceMidi, File$
dim shared as ubyte Pal(255,3)
Dim Shared path01(201), grass1(201), grass2(201), wall1(201), wall2(201), roof1(201), door1(201), desk1(201), Rock2(201)
Dim Shared water1(201), tree1(201), wall01(201), wall02(201), black(201), firepc(201), path02(201), tree3(201), Grass4(201)
Dim Shared bush1(201), wind1(201), bed1(201), wind2(201), tree2(201), door2(201), path03(201), bed2(201), Grass3(201)
Dim Shared barrel1(201), table1(201), torch1(201), sign1(201), shelf1(201), gold1(201), sign2(201), tree4(201), Hedge01(201), Hedge02(201)
Dim Shared Potio1(79), Potio2(79), PoisLeaf(79), Potio3(79), Desk2(201), Table2(201), Clerk1(201), rock1(201), Dragon(201)
Dim Shared Man01(201), Man01m(201), Man02(201), Man03(201), Man04(201), Man05(201), Man05m(201), Man06(201), Man07(201)
dim shared as integer MidiSong(4), CurMidi, NewMidi
dim shared heroimg(3,3,129) as short, Player as Playerdata, SX as integer, SY as integer, move as integer
dim shared nomidi as integer

Dim z As String
Dim as Integer X, i

Chdir "data"
Randomize Timer
WindowTitle "Mirkwood - Middle Earth Tale III"

' Initialise FMOD with 48000Hz, 8 channels.
FSOUND_Init(48000, 8, 0)

nomidi = 0
Screen 13,,, &h1

LoadShit

Do
If O5 = 2 Or Hp <= 0 Then Death: Begin: Goto jop
If O5 = 3 Then Begin: Goto jop

Select Case WorldData.Place
Case 1 To 9
NewMidi = 1
Case Else
NewMidi = 2
End Select
LoopMidi

kbd$ = INKEY$

jop:
'LOCATE 1, 1: PRINT "X:"; WorldData.TopCol; "Y:"; WorldData.TopRow; "T:"; WorldData.Terreng; "P:"; WorldData.Place
'LOCATE 2, 1: PRINT "CurMidi:"; CurMidi; "PlaceMidi:"; PlaceMidi; "Fight:"; RndNum1; "-"; RndNum2

If kbd$ <> "" Then
Select Case kbd$
Case " "
WhatsUp NpcFile$
Case CHR$(27)
Menu1
Case "H", "h", "?"
NpcTalk("help.npc")
Case "M", "m"
nomidi = nomidi xor 1
if nomidi = 1 then
FMUSIC_StopSong(MIDISong(CurMidi))
else
FMUSIC_PlaySong(MIDISong(CurMidi))
end if
Case "Q"
TheEnd
End Select
End If

if SX = 0 and SY = 0 then
move = 0
if Multikey(&h48) then
MoveUp
WorldData.Action = true
CheckFig
Player.Dir = 2

elseif Multikey(&h50) then

MoveDown
WorldData.Action = true
CheckFig
Player.Dir = 0

elseif Multikey(&h4B) then

MoveLeft
WorldData.Action = true
CheckFig
Player.Dir = 3

elseif Multikey(&h4d) then

MoveRight
WorldData.Action = true
CheckFig
Player.Dir = 1

end if
End If

ShowMap

if SX > 0 then SX = SX - 2
if SX < 0 then SX = SX + 2
if SY > 0 then SY = SY - 2
if SY < 0 then SY = SY + 2

if sx <> 0 or sy <> 0 or move = 1 then
if Player.Nextframe > 0 then
Player.Nextframe -= 1
else
Player.Frame += 1
if Player.Frame > 3 then Player.Frame = 0
Player.Nextframe = 5
end if
else
Player.Frame = 0
Player.Nextframe = 0
end if

Loop

'-------------------------------------------
Sub Begin
dim as integer x
dim z$
NewMidi = -1
'Screen 13
'SetupPalette
Cls


Walikko:
box(65, 70, 240, 160)
TEXT "MIRKWOOD", 2, 75, 26, 3
TEXT "jockebeast@hotmail.com", 2, 100, 175, 1
TEXT "Middle Earth Tale III.", 2, 85, 50, 1
TEXT "Jocke The Beast is proud to present", 2, 38, 5, 1
X = 1
Do

If X = 1 Then
TEXT "New Game", 239, 110, 80, 1
TEXT "Load Game", 170, 110, 100, 1
TEXT "Help/Info", 170, 110, 120, 1
TEXT "Quit", 170, 110, 140, 1
End If
If X = 2 Then
TEXT "New Game", 170, 110, 80, 1
TEXT "Load Game", 239, 110, 100, 1
TEXT "Help/Info", 170, 110, 120, 1
TEXT "Quit", 170, 110, 140, 1
End If
If X = 3 Then
TEXT "New Game", 170, 110, 80, 1
TEXT "Load Game", 170, 110, 100, 1
TEXT "Help/Info", 239, 110, 120, 1
TEXT "Quit", 170, 110, 140, 1
End If
If X = 4 Then
TEXT "New Game", 170, 110, 80, 1
TEXT "Load Game", 170, 110, 100, 1
TEXT "Help/Info", 170, 110, 120, 1
TEXT "Quit", 239, 110, 140, 1
End If
Do
z$ = INKEY$
LoopMidi
Loop Until z$ <> ""
If z$ = CHR$(255) + CHR$(80) Then X = X + 1: If X > 4 Then X = 1
If z$ = CHR$(255) + CHR$(72) Then X = X - 1: If X < 1 Then X = 4
Loop Until z$ = CHR$(13)

If X = 1 Then
do
Cls
box(5, 5, 210, 70)
TEXT "ENTER YOUR NAME,WARRIOR.", 14, 20, 10, 1
TEXT "(Dont use Scandinavian signs,", 15, 20, 20, 1
TEXT " and maximal 13 letters.)", 15, 20, 30, 1
TEXT "Name", 12, 22, 56, 1: Locate 8, 8: Color 12: Input chrname

loop until ltrim(rtrim(chrname)) <> ""

Story
LoadMap("mapin01.map", 1, 0, 41)
InitVars
ShowMap
Exit Sub
elseIf X = 2 Then
LoadGame
ShowMap
Exit Sub
elseIf X = 3 Then
Info
Goto Walikko
elseIf X = 4 Then

Cls : Print "jockebeast@hotmail.com"
TheEnd
End If

End Sub

'-------------------------------------------
Sub box (X, y, x2, y2)
Line (X, y)-(x2, y2), 200, B
Line (X + 1, y + 1)-(x2 - 1, y2 - 1), 140, B
Line (X + 2, y + 2)-(x2 - 2, y2 - 2), 200, B
Line (X + 3, y + 3)-(x2 - 3, y2 - 3), 0, B
Line (X + 4, y + 4)-(x2 - 4, y2 - 4), 0, BF

End Sub

'-------------------------------------------
Sub ChangeAnim

If WorldData.AnimCycle = 1 Then
WorldData.AnimCycle = 2
ElseIf WorldData.AnimCycle = 2 Then
WorldData.AnimCycle = 1
end if

End Sub

'-------------------------------------------
Sub CheckFig
dim lmap$
dim as integer Place

If WorldData.Terreng = 0 Then
Select Case WorldData.Place
Case 1
If WorldData.Direc = West Then lmap$ = "map02.map": Place = 2
If WorldData.Direc = South Then lmap$ = "map04.map": Place = 4
Case 2
If WorldData.Direc = East Then lmap$ = "map01.map": Place = 1
If WorldData.Direc = West Then lmap$ = "map03.map": Place = 3
If WorldData.Direc = South Then lmap$ = "map05.map": Place = 5
Case 3
If WorldData.Direc = South Then lmap$ = "map06.map": Place = 6
If WorldData.Direc = East Then lmap$ = "map02.map": Place = 2
Case 4
If WorldData.Direc = North Then lmap$ = "map01.map": Place = 1
If WorldData.Direc = West Then lmap$ = "map05.map": Place = 5
If WorldData.Direc = South Then lmap$ = "map07.map": Place = 7
Case 5
If WorldData.Direc = North Then lmap$ = "map02.map": Place = 2
If WorldData.Direc = West Then lmap$ = "map06.map": Place = 6
If WorldData.Direc = South Then lmap$ = "map08.map": Place = 8
If WorldData.Direc = East Then lmap$ = "map04.map": Place = 4
Case 6
If WorldData.Direc = North Then lmap$ = "map03.map": Place = 3
If WorldData.Direc = East Then lmap$ = "map05.map": Place = 5
If WorldData.Direc = South Then lmap$ = "map09.map": Place = 9
Case 7
If WorldData.Direc = North Then lmap$ = "map04.map": Place = 4
If WorldData.Direc = West Then lmap$ = "map08.map": Place = 8
Case 8
If WorldData.Direc = North Then lmap$ = "map05.map": Place = 5
If WorldData.Direc = East Then lmap$ = "map07.map": Place = 7
If WorldData.Direc = West Then lmap$ = "map09.map": Place = 9
Case 9
If WorldData.Direc = North Then lmap$ = "map06.map": Place = 6
If WorldData.Direc = West Then lmap$ = "map10.map": Place = 10
If WorldData.Direc = East Then lmap$ = "map08.map": Place = 8
Case 10
If WorldData.Direc = West Then lmap$ = "map11.map": Place = 11
If WorldData.Direc = East Then lmap$ = "map09.map": Place = 9
Case 11
If WorldData.Direc = North Then lmap$ = "map15.map": Place = 15
If WorldData.Direc = South Then lmap$ = "map14.map": Place = 14
If WorldData.Direc = East Then lmap$ = "map10.map": Place = 10
If WorldData.Direc = West Then lmap$ = "map12.map": Place = 12
Case 12
If WorldData.Direc = East Then lmap$ = "map11.map": Place = 11
If WorldData.Direc = West Then lmap$ = "map13.map": Place = 13
Case 13
If WorldData.Direc = East Then lmap$ = "map12.map": Place = 12
Case 14
If WorldData.Direc = North Then lmap$ = "map11.map": Place = 11
Case 15
If WorldData.Direc = North Then lmap$ = "map16.map": Place = 16
If WorldData.Direc = South Then lmap$ = "map11.map": Place = 11
Case 16
If WorldData.Direc = North Then lmap$ = "map17.map": Place = 17
If WorldData.Direc = South Then lmap$ = "map15.map": Place = 15
Case 17
If WorldData.Direc = North Then lmap$ = "map18.map": Place = 18
If WorldData.Direc = South Then lmap$ = "map16.map": Place = 16
Case 18
If WorldData.Direc = South Then lmap$ = "map17.map": Place = 17
End Select

If WorldData.Direc = West Then LoadMap(lmap$, Place, WorldData.TopRow, 42)
If WorldData.Direc = East Then LoadMap(lmap$, Place, WorldData.TopRow, -7)
If WorldData.Direc = North Then LoadMap(lmap$, Place, 25, WorldData.TopCol)
If WorldData.Direc = South Then LoadMap(lmap$, Place, -4, WorldData.TopCol)
End If


If (WorldData.Inside = 1 And WorldData.Terreng = 15) Or (WorldData.Inside = 1 And WorldData.Terreng = 23) Then
Select Case WorldData.Place
Case 1
lmap$ = "map01.map"
Case 2
lmap$ = "map02.map"
Case 3
lmap$ = "map03.map"
Case 4
lmap$ = "map04.map"
Case 6
lmap$ = "map06.map"
Case 7
lmap$ = "map07.map"
Case 8
lmap$ = "map08.map"
Case 9
lmap$ = "map09.map"
Case 18
lmap$ = "map18.map"
End Select
LoadMap(lmap$, WorldData.Place, WorldData.TopRow + 2, WorldData.TopCol)
WorldData.Inside = 0
End If

If (WorldData.Inside = 0 And WorldData.Terreng = -9) Or (WorldData.Inside = 0 And WorldData.Terreng = -Cool Or (WorldData.Inside = 0 And WorldData.Terreng = Cool Then
Select Case WorldData.Place
Case 1
lmap$ = "mapin01.map"
Case 2
lmap$ = "mapin02.map"
Case 3
lmap$ = "mapin03.map"
Case 4
lmap$ = "mapin04.map"
Case 6
lmap$ = "mapin06.map"
Case 7
lmap$ = "mapin07.map"
Case 8
lmap$ = "mapin08.map"
Case 9
lmap$ = "mapin09.map"
Case 18
lmap$ = "map19.map"
End Select
LoadMap(lmap$, WorldData.Place, WorldData.TopRow - 2, WorldData.TopCol)
WorldData.Inside = 1: WorldData.Terreng = 3
End If

'CheckMusic

RndNum1 = Int(Rnd * 100) + 1: RndNum2 = Int(Rnd * 100) + 1
Select Case WorldData.Place
Case 12 To 17
If RndNum1 = RndNum2 And WorldData.Terreng = 2 Then
LoadEnemies
Fight
End If
Case 11
If RndNum1 < 50 And RndNum1 = RndNum2 And WorldData.Terreng = 2 Then
LoadEnemies
Fight
End If
End Select
'IF WorldData.Terreng = 82 THEN CALL LoadEnemies: CALL Fight

End Sub


'-------------------------------------------
Sub Death
'StopMIDI
'UnloadMIDI MIDIHandle%
FMUSIC_StopSong(MIDISong(CurMidi))
NewMidi = -1
Cls
TEXT "You have been defeated", 4, 20, 50, 2
TEXT "Press any key to Continue.", 4, 20, 80, 1
waitkey
End Sub

'-------------------------------------------
Sub delay (Seconds as integer)
dim as single CurrentTimer
CurrentTimer = Timer

While Timer < (CurrentTimer + Seconds)
Wend

End Sub

'-------------------------------------------
Sub Fight
dim as integer a, ea, poi, Givem
dim txt as string

SX = 0
SY = 0
Player.Frame = 0
Player.NextFrame = 0

NewMidi = 0 'Change to battle music

Fight01:
If Hp <= 0 Then Hp = 0: Exit Sub
box(1, 1, 318, 192)
TEXT " A BATTLE APPROCHES...", 4, 10, 10, 1
TEXT "Your Status:", 14, 15, 25, 1
TEXT "Hit Points:" + Fixed$(Hp) + "/" + Fixed$(MaxHp), 15, 15, 35, 1
TEXT "Gold:" + Fixed$(gold%), 15, 15, 45, 1
TEXT "Weapon:" + (Wep$) + " + " + Fixed$(WepB), 15, 15, 55, 1
TEXT "Armour:" + (Arm$) + " + " + Fixed$(ArmB), 15, 15, 65, 1
TEXT "Total Attack Skill:" + Fixed$(WepB + ItemWepB), 15, 15, 75, 1
TEXT "Total Defence Skill:" + Fixed$(ArmB + ItemArmB), 15, 15, 85, 1
TEXT "A) Fight", 14, 15, 95, 1
TEXT "B) Run", 14, 15, 105, 1
TEXT "C) Use", 14, 15, 115, 1
If Enemy1Hp <= 0 And Enemy2Hp <= 0 And Enemy3Hp <= 0 Then Goto EnemyDeath:
TEXT "Enemy Rapport:", 4, 165, 25, 1
If Enemy1Hp >= 1 Then TEXT "1: " + Enemy1Name$ + " /" + Fixed$(Enemy1Hp), 4, 165, 35, 1
If Enemy2Hp >= 1 Then TEXT "2: " + Enemy2Name$ + " /" + Fixed$(Enemy2Hp), 4, 165, 45, 1
If Enemy3Hp >= 1 Then TEXT "3: " + Enemy3Name$ + " /" + Fixed$(Enemy3Hp), 4, 165, 55, 1

Do
txt = INKEY$
If txt = "a" Or txt = "A" Then Goto Fight02
If txt = "b" Or txt = "B" Then Goto Fight04
If txt = "c" Or txt = "C" Then MenuItems: Goto Fight01
LoopMidi
Loop

Fight02:
TEXT "Attack which enemy ?", 14, 165, 75, 1
Do
txt = INKEY$
If txt = "1" And Enemy1Hp >= 1 Then Goto fight03:
If HowMany >= 2 And Enemy2Hp >= 1 And txt = "2" Then Goto fight03:
If HowMany >= 3 And Enemy3Hp >= 1 And txt = "3" Then Goto fight03:
LoopMidi
Loop While txt = ""
Goto Fight02:

fight03:
a = Int(Rnd * 10 + Rnd * WepB + ItemWepB)

If txt = "1" Then
ea = Int(Rnd * Enemy1Defence)
a = a - ea
If a < 0 Then a = 0
TEXT "You hit " + Enemy1Name$ + "," + Fixed$(a) + " dmg.", 15, 15, 125, 1
Enemy1Hp = Enemy1Hp - a
End If
If txt = "2" Then
ea = Int(Rnd * Enemy2Defence)
a = a - ea
If a < 0 Then a = 0
TEXT "You hit " + Enemy2Name$ + "," + Fixed$(a) + " dmg.", 15, 15, 125, 1
Enemy2Hp = Enemy2Hp - a
End If
If txt = "3" Then
ea = Int(Rnd * Enemy3Defence)
a = a - ea
If a < 0 Then a = 0
TEXT "You hit " + Enemy3Name$ + "," + Fixed$(a) + " dmg.", 15, 15, 125, 1
Enemy3Hp = Enemy3Hp - a
End If

Select Case HowMany
Case 1
If Enemy1Hp >= 1 Then
ea = Int(Rnd * Enemy1Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy1Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 135, 1
Hp = Hp - ea
End If
Case 2
If Enemy1Hp >= 1 Then
ea = Int(Rnd * Enemy1Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy1Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 135, 1
Hp = Hp - ea
End If
If Enemy2Hp >= 1 Then
ea = Int(Rnd * Enemy2Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy2Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 145, 1
Hp = Hp - ea
End If
Case 3
If Enemy1Hp >= 1 Then
ea = Int(Rnd * Enemy1Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy1Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 135, 1
Hp = Hp - ea
End If

If Enemy2Hp >= 1 Then
ea = Int(Rnd * Enemy2Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy2Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 145, 1
Hp = Hp - ea
End If

If Enemy3Hp >= 1 Then
ea = Int(Rnd * Enemy3Attack)
a = Int(Rnd * ArmB + ItemArmB)
ea = ea - a
If ea < 0 Then ea = 0
TEXT Enemy3Name$ + " hit's you," + Fixed$(ea) + " dmg.", 15, 15, 155, 1
Hp = Hp - ea
End If

End Select

If Poisoned = 0 Then
If (Enemy1Poison = 1 And Enemy1Hp >= 1) Or (Enemy2Poison = 1 And Enemy2Hp >= 1) Or (Enemy3Poison = 1 And Enemy3Hp >= 1) Then
poi = Int(Rnd * 40) + 1
If poi <= 5 Then
Poisoned = 1
TEXT "You got Poisoned !", 12, 15, 165, 1
waitkey
Goto Fight01:
End If
End If
End If

If Poisoned = 1 Then
poi = Int(Rnd * 10) + 1
TEXT "Poison hurts you for " + Fixed$(poi) + " dmg.", 12, 15, 165, 1
Hp = Hp - poi
End If

Do: txt = INKEY$: LoopMidi:Loop While txt = ""
Goto Fight01:

Fight04:
If Runa = 1 Then
Runa = 0
TEXT "You run away!", 14, 95, 140, 1
waitkey
Cls
CurMidi = 0

ShowMap
Exit Sub
End If
TEXT "You failed runing away!", 14, 95, 140, 1
waitkey
Goto Fight01

EnemyDeath:
If HowMany = 1 Then Givem = (Rnd * Enemy1Gold) + 1
If HowMany = 2 Then Givem = (Rnd * Enemy1Gold) + 1 + (Rnd * Enemy2Gold) + 1
If HowMany = 3 Then Givem = (Rnd * Enemy1Gold) + 1 + (Rnd * Enemy2Gold) + 1 + (Rnd * Enemy3Gold) + 1
kills = kills + HowMany
TEXT "You slained your enemies!", 2, 95, 140, 1
TEXT "You get " + Fixed$(Givem) + " Gold coins.", 14, 95, 150, 1
gold% = gold% + Givem
waitkey

Cls
ShowMap
End Sub

'-------------------------------------------
Function Fixed$ (Num)
Fixed$ = LTRIM$(RTRIM$(STR$(Num)))
End Function

'-------------------------------------------
Sub GotAItem
If Q1 = 0 And O1 = 1 Then NpcTalk("item1.npc"): ItemWepB = ItemWepB + 2
If Q2 = 0 And O2 = 1 Then NpcTalk("item2.npc"): ItemArmB = ItemArmB + 1
If Q3 = 0 And O3 = 1 Then NpcTalk("item3.npc"): ItemArmB = ItemArmB + 1
If Q4 = 0 And O4 = 1 Then NpcTalk("item4.npc"): ItemWepB = ItemWepB + 2
If Q5 = 0 And O5 = 1 Then NpcTalk("item5.npc")
End Sub

'-------------------------------------------
Sub Info
dim as integer x, y
dim a$

Cls

For X = 0 To 319 Step 20
For y = 0 To 199 Step 20

Put (X, y), wall1, Pset

Next
Next

TEXT "Mirkwood", 15, 32, 2, 2
TEXT "Middle Earth Tale III.", 15, 140, 10, 1
TEXT "Do you wish to read Help Info. Y/N", 14, 20, 50, 1
Do: a$ = INKEY$: Loop Until a$ = "y" Or a$ = "Y" Or a$ = "n" Or a$ = "N"
If a$ = "y" Or a$ = "Y" Then NpcTalk("help.npc")

Cls

For X = 0 To 319 Step 20
For y = 0 To 199 Step 20

Put (X, y), wall1, Pset

Next
Next

TEXT "Mirkwood", 15, 32, 2, 2
TEXT "Middle Earth Tale III.", 15, 140, 10, 1
TEXT "Game Made By:", 110, 1, 25, 1
TEXT "Jocke The Beast", 189, 1, 36, 1
TEXT "Graphichs/Maps Made by:", 110, 1, 56, 1
TEXT "Jocke The Beast", 189, 1, 66, 1
TEXT "Scripts/Story Made By:", 110, 1, 86, 1
TEXT "Jocke The Beast", 189, 1, 96, 1
TEXT "Special Thanks to:", 110, 1, 116, 1
TEXT "Tek - For making the best Tile-Engine ever!", 14, 1, 126, 1
TEXT "Niklas M - Ideas,beta testing and so...", 14, 1, 136, 1
TEXT "J.R.R Tolkien - Middle Earth creator", 14, 1, 146, 1
TEXT "All QB psychos - Increases the quality of Qb-Rpg's", 14, 1, 156, 1
TEXT "Jocke The Beast Software Inc.", 10, 1, 170, 1
TEXT " Mail: jockebeast@hotmail.com", 11, 1, 180, 1
waitkey
Cls
End Sub

'-------------------------------------------
Sub InitVars

WorldData.Direc = West
WorldData.AnimCycle = 1
WorldData.PlayerY = 97
WorldData.Place = 1
WorldData.Inside = 1
WorldData.Terreng = 3
Hp = 90
MaxHp = 100
gold% = 450

Runa = 0
ItemWepB = 0
ItemArmB = 0
Poisoned = 0
Wep$ = "Dagger"
WepB = 1
Arm$ = "Cloth"
ArmB = 1
AHerb = 1
PHerb = 1
Fpot = 1
SPot = 1
kills = 0
O1 = 0: O2 = 0: O3 = 0: O4 = 0: O5 = 0: Q1 = 0: Q2 = 0: Q3 = 0: Q4 = 0: Q5 = 0


NpcFile$ = " "
' NewMidi = 1
' CurMidi = -1
SX = 0
SY = 0
Player.Frame = 0
Player.NextFrame = 0

End Sub

'-------------------------------------------
Sub killer
If kills = 0 Then NpcTalk("killer01.npc"): Exit Sub
NpcTalk("killer02.npc")
gold% = gold% + kills * 10
kills = 0
End Sub

'-------------------------------------------
Sub LoadEnemies
dim as integer Enemy1Nr, Enemy2Nr, Enemy3Nr, i

HowMany = 0: Enemy1Name$ = "": Enemy1Hp = 0: Enemy1Attack = 0: Enemy1Defence = 0: Enemy1Poison = 0: Enemy1Gold = 0
Enemy2Name$ = "": Enemy2Hp = 0: Enemy2Attack = 0: Enemy2Defence = 0: Enemy2Poison = 0: Enemy2Gold = 0
Enemy3Name$ = "": Enemy3Hp = 0: Enemy3Attack = 0: Enemy3Defence = 0: Enemy3Poison = 0: Enemy3Gold = 0


HowMany = Int(Rnd * 3) + 1

Select Case HowMany
Case 1
Enemy1Nr = Int(Rnd * 28) + 1
Case 2
Enemy1Nr = Int(Rnd * 28) + 1
Enemy2Nr = Int(Rnd * 28) + 1
Case 3
Enemy1Nr = Int(Rnd * 28) + 1
Enemy2Nr = Int(Rnd * 28) + 1
Enemy3Nr = Int(Rnd * 28) + 1
End Select

Select Case HowMany
Case 1
Open "enemy.dat" For Input As #1
For i = 1 To Enemy1Nr
Input #1, Enemy1Name$, Enemy1Hp, Enemy1Attack, Enemy1Defence, Enemy1Poison, Enemy1Gold
Next i
Close #1
Case 2
Open "enemy.dat" For Input As #1
For i = 1 To Enemy1Nr
Input #1, Enemy1Name$, Enemy1Hp, Enemy1Attack, Enemy1Defence, Enemy1Poison, Enemy1Gold
Next i
Close #1

Open "enemy.dat" For Input As #1
For i = 1 To Enemy2Nr
Input #1, Enemy2Name$, Enemy2Hp, Enemy2Attack, Enemy2Defence, Enemy2Poison, Enemy2Gold
Next i
Close #1

Case 3
Open "enemy.dat" For Input As #1
For i = 1 To Enemy1Nr
Input #1, Enemy1Name$, Enemy1Hp, Enemy1Attack, Enemy1Defence, Enemy1Poison, Enemy1Gold
Next i
Close #1

Open "enemy.dat" For Input As #1
For i = 1 To Enemy2Nr
Input #1, Enemy2Name$, Enemy2Hp, Enemy2Attack, Enemy2Defence, Enemy2Poison, Enemy2Gold
Next i
Close #1

Open "enemy.dat" For Input As #1
For i = 1 To Enemy3Nr
Input #1, Enemy3Name$, Enemy3Hp, Enemy3Attack, Enemy3Defence, Enemy3Poison, Enemy3Gold
Next i
Close #1
End Select

End Sub

'-------------------------------------------
Sub Loadfont
dim as integer a, x, y, b
Open "font.dat" For Input As #1
For a = 1 To 126
For X = 1 To 8
For y = 1 To 6
Input #1, B
CharSet(a, X, y) = B 'loads font data into 3-D array.
Next y
Next X
Next a
Close

End Sub

'-------------------------------------------
Sub LoadGame
dim as integer Wdtc, Wdtr
Open "save.dat" For Input As #1
Input #1, chrname, WorldData.Place, Wdtc, Wdtr, Hp, MaxHp, gold%, Fpot, SPot, PHerb, AHerb, Poisoned, Runa, Wep$, WepB, Arm$, ArmB, ItemWepB, ItemArmB, O1, O2, O3, O4, O5, Q1, Q2, Q3, Q4, Q5, kills
Close #1

WorldData.TopCol = Wdtc
WorldData.TopRow = Wdtr
WorldData.Direc = West
WorldData.AnimCycle = 1
WorldData.PlayerY = 97
WorldData.Inside = 0
WorldData.Terreng = -9
CurMidi = 0
CheckFig
WorldData.TopRow = WorldData.TopRow + 2

SX = 0
SY = 0
Player.Frame = 0
Player.NextFrame = 0
End Sub

'-------------------------------------------
Sub LoadMap (map$, p, wx, wy)
dim as integer i, j

WorldData.Place = p

Open map$ For Input As #1
Input #1, WorldData.Rows, WorldData.Cols ' Get the rows and cols to read.

For i = 1 To WorldData.Rows ' Go through a for loop to
For j = 1 To WorldData.Cols ' load the world map data.
Input #1, map(j, i).Tile
Select Case map(j, i).Tile ' See what the tile is.
Case 0, -1, -2, -3, -4, -5, -6, -7, 7, 21, 22, 20, 10, 11, 14, 16, 17, 13, 4, 18, 19, 24, 25, 26, 27, 28, 29, 30, 68 To 99, 33, 34
map(j, i).Walkon = false
Case Else
map(j, i).Walkon = true
End Select
Next j
Next i
Close

WorldData.TopRow = wx
WorldData.TopCol = wy
WorldData.Terreng = 1
End Sub

'-------------------------------------------
Sub LoadShit
dim as integer x

Cls
'Width 80
Color 1
For X = 1 To 40: Locate 1, X: Print "Û"
Next


Color 15, 1
Locate 1, 1: Print "Loading Mirkwood - Middle Earth Tale III"
Color 7, 0
Print
Print "Time: "; TIME$; " Date: "; DATE$
Print
Print "FontLoad : ";


Loadfont
Print "Done!"
Print "SetupPalette: ";
SetupPalette
Print "Done!"
Print "InitVars : ";
Print "Done!"
Print "LoadTiles : ";
LoadTiles
Print "Done!"
Print "LoadMap : ";
Print "Done!"

Print "Load MIDIs : ";
MIDISong(0) = FMUSIC_LoadSong("Battle.mid")
IF MIDISong(0) = 0 THEN
PRINT "Error: Failed to load 'Battle.mid'!"
sleep
TheEnd
END IF
' make it loop.
FMUSIC_SetLooping(MIDISong(0), 1)

MIDISong(1) = FMUSIC_LoadSong("DUNGEON.MID")
IF MIDISong(1) = 0 THEN
PRINT "Error: Failed to load 'DUNGEON.MID'!"
sleep
TheEnd
END IF
' make it loop.
FMUSIC_SetLooping(MIDISong(1), 1)

MIDISong(2) = FMUSIC_LoadSong("FATHEME.MID")
IF MIDISong(2) = 0 THEN
PRINT "Error: Failed to load 'FATHEME.MID'!"
sleep
TheEnd
END IF
' make it loop.
FMUSIC_SetLooping(MIDISong(2), 1)

MIDISong(3) = FMUSIC_LoadSong("INTRO.MID")
IF MIDISong(3) = 0 THEN
PRINT "Error: Failed to load 'INTRO.MID'!"
sleep
TheEnd
END IF
' make it loop.
FMUSIC_SetLooping(MIDISong(3), 1)

MIDISong(4) = FMUSIC_LoadSong("ORCESTRA.MID")
IF MIDISong(4) = 0 THEN
PRINT "Error: Failed to load 'ORCESTRA.MID'!"
sleep
TheEnd
END IF
' make it loop.
FMUSIC_SetLooping(MIDISong(4), 1)

Print "Done!"

Print "": Print "Mirkwood is Loaded!": Print "": Print "Press Any key to Continue..."
waitkey
Begin
End Sub

'-------------------------------------------
Sub LoadTiles

'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄ ÄÄ Ä
' DEF SEG = VARSEG(Tree1(0)): BLOAD "tree.mdt", VARPTR(Tree1(0))
' Array "Tile" Array
' The 0 represents the offset, or where the data starts loading. This is just
' important for those of you that have indexed pictures.
'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄ ÄÄ Ä
Bload "black.mdt", Varptr(black(0))
Bload "grass1.mdt", Varptr(grass1(0))
Bload "grass2.mdt", Varptr(grass2(0))
Bload "water1.mdt", Varptr(water1(0))
Bload "tree1.mdt", Varptr(tree1(0))
Bload "tree2.mdt", Varptr(tree2(0))
Bload "tree3.mdt", Varptr(tree3(0))
Bload "tree4.mdt", Varptr(tree4(0))
Bload "wall01.mdt", Varptr(wall01(0))
Bload "wall02.mdt", Varptr(wall02(0))
Bload "floor1.mdt", Varptr(path01(0))
Bload "path01.mdt", Varptr(path02(0))
Bload "floor2.mdt", Varptr(path03(0))
Bload "roof1.mdt", Varptr(roof1(0))
Bload "wall1.mdt", Varptr(wall1(0))
Bload "wall2.mdt", Varptr(wall2(0))
Bload "door1.mdt", Varptr(door1(0))
Bload "door2.mdt", Varptr(door2(0))
Bload "firepc.mdt", Varptr(firepc(0))
Bload "bush1.mdt", Varptr(bush1(0))
Bload "wind01.mdt", Varptr(wind1(0))
Bload "wind02.mdt", Varptr(wind2(0))
Bload "bed1.mdt", Varptr(bed1(0))
Bload "bed2.mdt", Varptr(bed2(0))
Bload "desk1.mdt", Varptr(desk1(0))
Bload "barrel1.mdt", Varptr(barrel1(0))
Bload "table1.mdt", Varptr(table1(0))
Bload "sign1.mdt", Varptr(sign1(0))
Bload "torch1.mdt", Varptr(torch1(0))
Bload "shelf1.mdt", Varptr(shelf1(0))
Bload "gold.mdt", Varptr(gold1(0))
Bload "poti.mdt", Varptr(Potio1(0))
Bload "poti2.mdt", Varptr(Potio2(0))
Bload "poti3.mdt", Varptr(Potio3(0))
Bload "poison1.mdt", Varptr(PoisLeaf(0))
Bload "clerk1.mdt", Varptr(Clerk1(0))
Bload "desk2.mdt", Varptr(Desk2(0))
Bload "table2.mdt", Varptr(Table2(0))
Bload "sign2.mdt", Varptr(sign2(0))
Bload "rock1.mdt", Varptr(rock1(0))
Bload "rock2.mdt", Varptr(Rock2(0))
Bload "grass3.mdt", Varptr(Grass3(0))
Bload "grass4.mdt", Varptr(Grass4(0))
Bload "hedge1.mdt", Varptr(Hedge01(0))
Bload "hedge2.mdt", Varptr(Hedge02(0))
Bload "man01.mdt", Varptr(Man01(0))
Bload "man01m.mdt", Varptr(Man01m(0))
Bload "man02.mdt", Varptr(Man02(0))
Bload "man03.mdt", Varptr(Man03(0))
Bload "man04.mdt", Varptr(Man04(0))
Back to top Go down
View user profile
Letiger
888.com
888.com
avatar

Posts : 906
Prestige : 4098
Verve-Fame : 17
Join date : 2009-12-23
Age : 24
Location : Russia.

PostSubject: Re: A game in free basic   9/28/2010, 9:28 pm

Bload "man05.mdt", Varptr(Man05(0))
Bload "man05m.mdt", Varptr(Man05m(0))
Bload "man06.mdt", Varptr(Man06(0))
Bload "man07.mdt", Varptr(Man07(0))
Bload "dragon.mdt", Varptr(Dragon(0))
Bload "guyd1.mdt", Varptr(PlayerDown1(0))
Bload "guyd2.mdt", Varptr(PlayerDown2(0))
Bload "guyd1m.mdt", Varptr(PlayerDown1Mask(0))
Bload "guyd2m.mdt", Varptr(PlayerDown2Mask(0))
Bload "guyl1.mdt", Varptr(PlayerLeft1(0))
Bload "guyl2.mdt", Varptr(PlayerLeft2(0))
Bload "guyl1m.mdt", Varptr(PlayerLeft1Mask(0))
Bload "guyl2m.mdt", Varptr(PlayerLeft2Mask(0))
Bload "guyr1.mdt", Varptr(PlayerRight1(0))
Bload "guyr2.mdt", Varptr(PlayerRight2(0))
Bload "guyr1m.mdt", Varptr(PlayerRight1Mask(0))
Bload "guyr2m.mdt", Varptr(PlayerRight2Mask(0))
Bload "guyu1.mdt", Varptr(PlayerUp1(0))
Bload "guyu2.mdt", Varptr(PlayerUp2(0))
Bload "guyu1m.mdt", Varptr(PlayerUp1Mask(0))
Bload "guyu2m.mdt", Varptr(PlayerUp2Mask(0))
Bload "guy.mdt", Varptr(HeroImg(0, 0, 0))
End Sub

'-------------------------------------------
Sub Menu1
dim as integer HPPercent, x
dim z$

HPPercent = Hp / MaxHp * 100
box(1, 130, 235, 185)
TEXT "Name: " + chrname, 175, 6, 145, 1
Put (8, 155), gold1, Pset: TEXT "= " + Fixed$(gold%), 15, 30, 164, 1
TEXT "Hp:" + Fixed$(Hp) + "/" + Fixed$(MaxHp), 15, 145, 140, 1
Line (120, 150)-(220, 157), 172, B
Line (121, 151)-Step(HPPercent - 2, 3), 77, BF
Line (121, 154)-Step(HPPercent - 2, 2), 79, BF
If Poisoned = 1 Then TEXT "Poisoned!", 4, 120, 164, 1
box(240, 130, 315, 185)
X = 1
Do

If X = 1 Then
TEXT "Inventory", 9, 250, 140, 1
TEXT "Status", 15, 250, 150, 1
TEXT "Save Game", 15, 250, 160, 1
TEXT "Quit", 15, 250, 170, 1
End If
If X = 2 Then
TEXT "Inventory", 15, 250, 140, 1
TEXT "Status", 9, 250, 150, 1
TEXT "Save Game", 15, 250, 160, 1
TEXT "Quit", 15, 250, 170, 1
End If
If X = 3 Then
TEXT "Inventory", 15, 250, 140, 1
TEXT "Status", 15, 250, 150, 1
TEXT "Save Game", 9, 250, 160, 1
TEXT "Quit", 15, 250, 170, 1
End If
If X = 4 Then
TEXT "Inventory", 15, 250, 140, 1
TEXT "Status", 15, 250, 150, 1
TEXT "Save Game", 15, 250, 160, 1
TEXT "Quit", 9, 250, 170, 1
End If


Do
z$ = INKEY$
Loop Until z$ <> ""
If z$ = CHR$(27) Then ShowMap: Exit Sub
If z$ = CHR$(255) + CHR$(80) Then X = X + 1: If X > 4 Then X = 1
If z$ = CHR$(255) + CHR$(72) Then X = X - 1: If X < 1 Then X = 4
LoopMidi
Loop Until z$ = CHR$(13)

If X = 1 Then
MenuItems
Menu1
End If

If X = 2 Then
MenuStatus
End If

If X = 3 Then
MenuSaveGame
End If

If X = 4 Then
quit
End If

End Sub

'-------------------------------------------
Sub MenuItems
dim as integer HPPercent
dim a$

use:
HPPercent = Hp / MaxHp * 100
box(1, 130, 235, 185)
TEXT "Name: " + chrname, 175, 6, 145, 1
Put (8, 155), gold1, Pset: TEXT "= " + Fixed$(gold%), 15, 30, 164, 1
TEXT "Hp:" + Fixed$(Hp) + "/" + Fixed$(MaxHp), 15, 145, 140, 1
Line (120, 150)-(220, 157), 172, B
Line (121, 151)-Step(HPPercent - 2, 3), 77, BF
Line (121, 154)-Step(HPPercent - 2, 2), 79, BF
If Poisoned = 1 Then TEXT "Poisoned!", 4, 120, 164, 1
box(1, 1, 318, 20)
box(1, 20, 180, 125)
box(180, 20, 318, 125)
TEXT "Potions/Herbs", 9, 20, 5, 1
TEXT "Items", 9, 230, 5, 1
If O1 = 1 Then TEXT "# Ring Of Fire", 4, 210, 30, 1
If O2 = 1 Then TEXT "# Golden Diadem", 14, 210, 40, 1
If O3 = 1 Then TEXT "# Black Amulett", 8, 210, 50, 1
If O4 = 1 Then TEXT "# Elf Ring", 2, 210, 60, 1
If O5 = 1 Then TEXT "# Dragon Spear", 9, 210, 70, 1

If Fpot >= 1 Then
Put (10, 30), Potio1, Pset
TEXT "Full Potions: " + Fixed$(Fpot), 15, 30, 30, 1
End If

If SPot >= 1 Then
Put (10, 40), Potio2, Pset
TEXT "Half Potions: " + Fixed$(SPot), 15, 30, 40, 1
End If

If PHerb >= 1 Then
Put (10, 50), PoisLeaf, Pset
TEXT "Poison Antidote: " + Fixed$(PHerb), 15, 30, 50, 1
End If

If AHerb >= 1 Then
Put (10, 60), Potio3, Pset
TEXT "Agility Potion: " + Fixed$(AHerb), 15, 30, 60, 1
End If

If Fpot >= 1 Then
TEXT "A) Use Full Potion", 15, 6, 80, 1
End If

If SPot >= 1 Then
TEXT "B) Use Small Potion", 15, 6, 90, 1
End If

If PHerb >= 1 Then
TEXT "C) Use Poison Antidote", 15, 6, 100, 1
End If

If AHerb >= 1 Then
TEXT "D) Use Agility Potion", 15, 6, 110, 1
End If

Do
a$ = INKEY$
If a$ = "A" Or a$ = "a" Then
If Fpot >= 1 Then
Hp = MaxHp
Fpot = Fpot - 1
Goto use
End If
End If
If a$ = "B" Or a$ = "b" Then
If SPot >= 1 Then
Hp = Hp + 10
If Hp > MaxHp Then Hp = MaxHp
SPot = SPot - 1
Goto use
End If
End If
If a$ = "C" Or a$ = "c" Then
If PHerb >= 1 Then
Poisoned = 0
PHerb = PHerb - 1
Goto use
End If
End If
If a$ = "D" Or a$ = "d" Then
If AHerb >= 1 Then
Runa = 1
AHerb = AHerb - 1
Goto use
End If
End If
If a$ = CHR$(27) Then Exit Do
LoopMidi
Loop
ShowMap
End Sub

'-------------------------------------------
Sub MenuSaveGame
dim as integer Wdtc, Wdtr

box(50, 50, 290, 80)
If WorldData.Inside = 0 Then
TEXT "Must be Inside a Building to Save Game!", 15, 56, 60, 1
waitkey
ShowMap
Menu1
Exit Sub
End If
TEXT "Game Saved!", 15, 130, 60, 1
Wdtc = WorldData.TopCol
Wdtr = WorldData.TopRow
Open "save.dat" For Output As #1
Write #1, chrname, WorldData.Place, Wdtc, Wdtr, Hp, MaxHp, gold%, Fpot, SPot, PHerb, AHerb, Poisoned, Runa, Wep$, WepB, Arm$, ArmB, ItemWepB, ItemArmB, O1, O2, O3, O4, O5, Q1, Q2, Q3, Q4, Q5, kills
Close #1
waitkey
ShowMap
Menu1
End Sub

'-------------------------------------------
Sub MenuStatus
box(1, 1, 315, 128)
TEXT "Status / Weapons", 9, 20, 5, 1
TEXT "Name: " + (chrname), 15, 15, 25, 1
TEXT "Hit Points:" + Fixed$(Hp) + "/" + Fixed$(MaxHp), 15, 15, 35, 1
TEXT "Gold:" + Fixed$(gold%), 15, 15, 45, 1
TEXT "Weapon:" + (Wep$) + " + " + Fixed$(WepB), 79, 15, 65, 1
TEXT "Armour:" + (Arm$) + " + " + Fixed$(ArmB), 79, 15, 75, 1
TEXT "Total Attack Skill:" + Fixed$(WepB + ItemWepB), 108, 15, 95, 1
TEXT "Total Defence Skill:" + Fixed$(ArmB + ItemArmB), 109, 15, 105, 1
TEXT "Scalps:" + Fixed$(kills), 4, 220, 105, 1
waitkey
ShowMap
Menu1

End Sub


'-------------------------------------------
Sub MoveDown

WorldData.Direc = South
ChangeAnim

If map(WorldData.TopCol + 8, WorldData.TopRow + 5 + 1).Walkon = true Then
WorldData.Terreng = map(WorldData.TopCol + 8, WorldData.TopRow + 5 + 1).Tile
WorldData.TopRow = WorldData.TopRow + 1
WorldData.NPC = map(WorldData.TopCol + 8, WorldData.TopRow + 5 + 1).Tile
SY = -20
move = 1
else
WorldData.Terreng = map(WorldData.TopCol + 8, WorldData.TopRow + 5 + 1).Tile
WorldData.NPC = WorldData.Terreng
End If

End Sub

'-------------------------------------------
Sub MoveLeft

WorldData.Direc = West
ChangeAnim

If map(WorldData.TopCol + 8 - 1, WorldData.TopRow + 5).Walkon = true Then
WorldData.Terreng = map(WorldData.TopCol + 8 - 1, WorldData.TopRow + 5).Tile
WorldData.TopCol = WorldData.TopCol - 1
WorldData.NPC = map(WorldData.TopCol + 8 - 1, WorldData.TopRow + 5).Tile
SX = 20
move = 1
else
WorldData.Terreng = map(WorldData.TopCol + 8 - 1, WorldData.TopRow + 5).Tile
WorldData.NPC = WorldData.Terreng
End If

End Sub

'-------------------------------------------
Sub MoveRight

WorldData.Direc = East
ChangeAnim

If map(WorldData.TopCol + 8 + 1, WorldData.TopRow + 5).Walkon = true Then
WorldData.Terreng = map(WorldData.TopCol + 8 + 1, WorldData.TopRow + 5).Tile
WorldData.TopCol = WorldData.TopCol + 1
WorldData.NPC = map(WorldData.TopCol + 8 + 1, WorldData.TopRow + 5).Tile
SX = -20
move = 1
else
WorldData.Terreng = map(WorldData.TopCol + 8 + 1, WorldData.TopRow + 5).Tile
WorldData.NPC = WorldData.Terreng
End If


End Sub

'-------------------------------------------
Sub MoveUp

WorldData.Direc = North
ChangeAnim

If map(WorldData.TopCol + 8, WorldData.TopRow + 5 - 1).Walkon = true Then
WorldData.Terreng = map(WorldData.TopCol + 8, WorldData.TopRow + 5 - 1).Tile
WorldData.TopRow = WorldData.TopRow - 1
WorldData.NPC = map(WorldData.TopCol + 8, WorldData.TopRow + 5 - 1).Tile
SY = 20
move = 1
else
WorldData.Terreng = map(WorldData.TopCol + 8, WorldData.TopRow + 5 - 1).Tile
WorldData.NPC = WorldData.Terreng
End If

End Sub


'-------------------------------------------
Sub NpcTalk (FileName$)
dim as integer NPOI, TRAVEL, times, BLIPNUM, TRAVEL1, TRAVEL2, TRAVEL3
dim as integer x, TextColor
dim z$, mitter$, tx1$, tx2$, tx3$, tx4$, tx5$, RESPONSE1$, RESPONSE2$, RESPONSE3$

TALKTONPC:
NPOI = Val(mitter$)
TRAVEL = 1
SNIPER:
box(38, 28, 282, 140)
Close #1
Open FileName$ For Input As #1
For times = 1 To TRAVEL
Input #1, BLIPNUM
Input #1, tx1$
Input #1, tx2$
Input #1, tx3$
Input #1, tx4$
Input #1, tx5$
Input #1, RESPONSE1$, TRAVEL1
Input #1, RESPONSE2$, TRAVEL2
Input #1, RESPONSE3$, TRAVEL3
Next times
Gosub SAYTEXT
If RESPONSE1$ = "" Then Do: Loop Until INKEY$ <> "": Close #1: Cls : Exit Sub
X = 1
Do
TextColor = 170
If X = 1 Then TextColor = 239
TEXT RESPONSE1$, TextColor, 43, 102, 1
TextColor = 170
If X = 2 Then TextColor = 239
If RESPONSE2$ <> "" Then TEXT RESPONSE2$, TextColor, 43, 112, 1
TextColor = 170
If X = 3 Then TextColor = 239
If RESPONSE3$ <> "" Then TEXT RESPONSE3$, TextColor, 43, 122, 1

Do
z$ = INKEY$
LoopMidi
Loop Until z$ <> ""
If RESPONSE2$ <> "" Then
If z$ = CHR$(255) + CHR$(72) And X <> 1 Then X = X - 1
If z$ = CHR$(255) + CHR$(80) And RESPONSE3$ <> "" And X <> 3 Then X = X + 1
If z$ = CHR$(255) + CHR$(80) And RESPONSE3$ = "" And X <> 2 Then X = X + 1
End If
LoopMidi
Loop Until z$ = CHR$(13) Or z$ = " "

If X = 1 Then TRAVEL = TRAVEL1
If X = 2 Then TRAVEL = TRAVEL2
If X = 3 Then TRAVEL = TRAVEL3
If TRAVEL = 0 Then Close #1: Exit Sub
Goto SNIPER

SAYTEXT:
TEXT tx1$, 15, 43, 32, 1
If tx2$ <> "" Then
TEXT tx2$, 15, 43, 42, 1
End If
If tx3$ <> "" Then
TEXT tx3$, 15, 43, 52, 1
End If
If tx4$ <> "" Then
TEXT tx4$, 15, 43, 62, 1
End If
If tx5$ <> "" Then
TEXT tx5$, 15, 43, 72, 1
End If
Return

End Sub

'-------------------------------------------
Sub putPlayerPic

If WorldData.Terreng = 12 Or (WorldData.Terreng = 10 And WorldData.Direc = South) Or (WorldData.Terreng = 21 And WorldData.Direc = South) Then
Exit Sub
End If

Select Case WorldData.Direc
Case North
If WorldData.AnimCycle = 1 Then
Put (162, WorldData.PlayerY), PlayerUp1Mask, And
Put (162, WorldData.PlayerY), PlayerUp1, Or
Else
Put (162, WorldData.PlayerY), PlayerUp2Mask, And
Put (162, WorldData.PlayerY), PlayerUp2, Or
End If
Case East
If WorldData.AnimCycle = 1 Then
Put (162, WorldData.PlayerY), PlayerRight1Mask, And
Put (162, WorldData.PlayerY), PlayerRight1, Or
Else
Put (162, WorldData.PlayerY), PlayerRight2Mask, And
Put (162, WorldData.PlayerY), PlayerRight2, Or
End If
Case South
If WorldData.AnimCycle = 1 Then
Put (162, WorldData.PlayerY), PlayerDown1Mask, And
Put (162, WorldData.PlayerY), PlayerDown1, Or
Else
Put (162, WorldData.PlayerY), PlayerDown2Mask, And
Put (162, WorldData.PlayerY), PlayerDown2, Or
End If
Case West
If WorldData.AnimCycle = 1 Then
Put (162, WorldData.PlayerY), PlayerLeft1Mask, And
Put (162, WorldData.PlayerY), PlayerLeft1, Or
Else
Put (162, WorldData.PlayerY), PlayerLeft2Mask, And
Put (162, WorldData.PlayerY), PlayerLeft2, Or
End If
End Select
End Sub

'-------------------------------------------
Sub PutTile (Ico as integer, Jco as integer, MapNo as integer)

Select Case MapNo
Case -1
Put (Ico , Jco ), water1, Pset
Case -2
Put (Ico , Jco ), tree1, Pset
Case -3
Put (Ico , Jco ), tree2, Pset
Case -4
Put (Ico , Jco ), sign1, Pset
Case -5
Put (Ico , Jco ), sign2, Pset
Case -6
Put (Ico , Jco ), tree3, Pset
Case -7
Put (Ico , Jco ), tree4, Pset
Case -8
Put (Ico , Jco ), door2, Pset
Case -9
Put (Ico , Jco ), door1, Pset
Case 0
Put (Ico , Jco ), black, Pset
Case 1
Put (Ico , Jco ), grass1, Pset
Case 2
Put (Ico , Jco ), grass2, Pset
Case 3
Put (Ico , Jco ), path01, Pset
Case 4
Put (Ico , Jco ), bush1, Pset
Case 5
Put (Ico , Jco ), path02, Pset
Case 6
Put (Ico , Jco ), path03, Pset
Case 7
Put (Ico , Jco ), rock1, Pset
Case 8
Put (Ico , Jco ), Rock2, Pset
Case 10
Put (Ico , Jco ), wall1, Pset
Case 11, 15
Put (Ico , Jco ), wall2, Pset
Case 12
Put (Ico , Jco ), roof1, Pset
Case 13
Put (Ico , Jco ), wind1, Pset
Case 14
Put (Ico , Jco ), firepc, Pset
Case 16
Put (Ico , Jco ), bed1, Pset
Case 17
Put (Ico , Jco ), bed2, Pset
Case 18
Put (Ico , Jco ), desk1, Pset
Case 19
Put (Ico , Jco ), torch1, Pset
Case 20, 23
Put (Ico , Jco ), wall02, Pset
Case 21
Put (Ico , Jco ), wall01, Pset
Case 22
Put (Ico , Jco ), wind2, Pset
Case 24
Put (Ico , Jco ), barrel1, Pset
Case 25
Put (Ico , Jco ), table1, Pset
Case 26
Put (Ico , Jco ), shelf1, Pset
Case 27
Put (Ico , Jco ), Table2, Pset
Case 28, 30
Put (Ico , Jco ), Desk2, Pset
Case 29
Put (Ico , Jco ), Clerk1, Pset
Case 31
Put (Ico , Jco ), Grass3, Pset
Case 32
Put (Ico , Jco ), Grass4, Pset
Case 33
Put (Ico , Jco ), Hedge01, Pset
Case 34
Put (Ico , Jco ), Hedge02, Pset
Case 68, 94
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man07, Or
Case 69
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man06, Or
Case 70
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man05, Or
Case 71
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man04, Or
Case 72
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man03, Or
Case 73
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man02, Or
Case 74
Put (Ico , Jco ), path01, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man01, Or
Case 75
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man07, Or
Case 76
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man06, Or
Case 77
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man05, Or
Case 78, 98
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man04, Or
Case 79
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man03, Or
Case 80
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man02, Or
Case 81
Put (Ico , Jco ), path03, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man01, Or
Case 83
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man07, Or
Case 84
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man06, Or
Case 85
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man05m, And
Put (Ico , Jco ), Man05, Or
Case 86, 95
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man04, Or
Case 87, 96
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man03, Or
Case 88
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man02, Or
Case 89, 97
If WorldData.Place >= 10 Then Put (Ico , Jco ), grass2, Pset
If WorldData.Place <= 9 Then Put (Ico , Jco ), grass1, Pset
Put (Ico , Jco ), Man01m, And
Put (Ico , Jco ), Man01, Or
Case 99
Put (Ico , Jco ), Dragon, Pset

Case Else
Put (Ico , Jco), black, Pset


End Select

End Sub

'-------------------------------------------
Sub quit
dim a$
box(100, 20, 250, 100)
TEXT "Really Quit ? Y/N", 14, 110, 40, 1
Do
a$ = INKEY$
If a$ = "n" Or a$ = "N" Then ShowMap: Menu1: Exit Sub
Loop Until a$ = "n" Or a$ = "N" Or a$ = "y" Or a$ = "Y"


Begin
End Sub


'-------------------------------------------
Sub SetupPalette
dim as integer i

Bload "nmedia.pal", varptr(Pal(0,0))
For i = 0 To 255
Out &H3C8, i
Out &H3C9, Pal(i, 0)
Out &H3C9, Pal(i, 1)
Out &H3C9, Pal(i, 2)
Next

End Sub

'-------------------------------------------
Sub Shop1
Buy:
box(40, 20, 260, 190)
TEXT " Gold:" + Fixed$(gold%), 14, 43, 130, 1
TEXT " A) Full Potion -50 gold", 15, 43, 30, 1
TEXT " B) Small Potion -10 gold", 15, 43, 40, 1
TEXT " C) Poison Antidote -20 gold", 15, 43, 50, 1
TEXT " D) Agility Potion -25 gold ", 15, 43, 60, 1
TEXT " E) Nothing Please ", 15, 43, 72, 1
TEXT " ", 15, 43, 92, 1
'Put (230, 31), Potio1 , Pset
'Put (230, 41), Potio2 , Pset
'Put (230, 51), PoisLeaf, Pset
'Put (230, 61), Potio3 , Pset
Do
LoopMidi
kbd$ = INKEY$
If kbd$ = "A" Or kbd$ = "a" Then
If gold% < 50 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy
End If
Fpot = Fpot + 1
gold% = gold% - 50
TEXT " You Bought a Full Potion", 15, 43, 92, 1
waitkey
Goto Buy
End If

If kbd$ = "B" Or kbd$ = "b" Then
If gold% < 10 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy
End If
SPot = SPot + 1
gold% = gold% - 10
TEXT " You Bought a Small Potion", 15, 43, 92, 1
waitkey
Goto Buy
End If
If kbd$ = "C" Or kbd$ = "c" Then
If gold% < 20 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy
End If
PHerb = PHerb + 1
gold% = gold% - 20
TEXT " You Bought a Poison Antidote", 15, 43, 92, 1
waitkey
Goto Buy
End If

If kbd$ = "D" Or kbd$ = "d" Then
If gold% < 25 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy
End If
AHerb = AHerb + 1
gold% = gold% - 25
TEXT " You Bought a Agility Potion ", 15, 43, 92, 1
waitkey
Goto Buy
End If

If kbd$ = "E" Or kbd$ = "e" Then Exit Sub
Loop

End Sub

Sub Shop2
Buy2:
box(40, 20, 260, 190)
TEXT " Gold:" + Fixed$(gold%), 14, 43, 130, 1
TEXT " A) Broad Sword (+2) -200 gold", 15, 43, 30, 1
TEXT " B) Long Sword (+3) -400 gold", 15, 43, 40, 1
TEXT " C) Battle Axe (+4) -500 gold", 15, 43, 50, 1
TEXT " D) Elf Sword (+6) -1000 gold", 15, 43, 60, 1
TEXT " E) Nothing Please ", 15, 43, 72, 1
Do
LoopMidi
kbd$ = INKEY$
If kbd$ = "A" Or kbd$ = "a" Then
If gold% < 200 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy2
End If
Wep$ = "Broad Sword": WepB = 2
gold% = gold% - 200
TEXT " You Bought a Broad Sword", 15, 43, 92, 1
waitkey
Goto Buy2
End If

If kbd$ = "B" Or kbd$ = "b" Then
If gold% < 400 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy2
End If
Wep$ = "Long Sword": WepB = 3
gold% = gold% - 400
TEXT " You Bought a Long Sword", 15, 43, 92, 1
waitkey
Goto Buy2
End If
If kbd$ = "C" Or kbd$ = "c" Then
If gold% < 500 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy2
End If
Wep$ = "Battle Axe": WepB = 4
gold% = gold% - 500
TEXT " You Bought a Battle Axe", 15, 43, 92, 1
waitkey
Goto Buy2
End If
If kbd$ = "D" Or kbd$ = "d" Then
If gold% < 1000 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy2
End If
Wep$ = "Elf Sword": WepB = 6
gold% = gold% - 1000
TEXT " You Bought a Elf Sword", 15, 43, 92, 1
waitkey
Goto Buy2
End If

If kbd$ = "E" Or kbd$ = "e" Then Exit Sub
Loop

End Sub

Sub Shop3
Buy3:
box(40, 20, 260, 190)
TEXT " Gold:" + Fixed$(gold%), 14, 43, 130, 1
TEXT " A) Leather Cloak (+2) -150 gold", 15, 43, 30, 1
TEXT " B) Ring Mail (+3) -350 gold", 15, 43, 40, 1
TEXT " C) Plate Mail (+4) -450 gold", 15, 43, 50, 1
Back to top Go down
View user profile
Letiger
888.com
888.com
avatar

Posts : 906
Prestige : 4098
Verve-Fame : 17
Join date : 2009-12-23
Age : 24
Location : Russia.

PostSubject: Re: A game in free basic   9/28/2010, 9:29 pm

TEXT " D) Bear Cloak (+6) -900 gold", 15, 43, 60, 1
TEXT " E) Nothing Please ", 15, 43, 72, 1
Do
LoopMidi
kbd$ = INKEY$
If kbd$ = "A" Or kbd$ = "a" Then
If gold% < 150 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy3
End If
Arm$ = "Leather Cloak": ArmB = 2
gold% = gold% - 150
TEXT " You Bought a Leather Cloak", 15, 43, 92, 1
waitkey
Goto Buy3
End If

If kbd$ = "B" Or kbd$ = "b" Then
If gold% < 350 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy3
End If
Arm$ = "Ring Mail": ArmB = 3
gold% = gold% - 350
TEXT " You Bought a Ring Mail", 15, 43, 92, 1
waitkey
Goto Buy3
End If
If kbd$ = "C" Or kbd$ = "c" Then
If gold% < 450 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy3
End If
Arm$ = "Plate Mail": ArmB = 4
gold% = gold% - 450
TEXT " You Bought a Plate Mail", 15, 43, 92, 1
waitkey
Goto Buy3
End If
If kbd$ = "D" Or kbd$ = "d" Then
If gold% < 900 Then
TEXT " Not Enough Money ", 15, 43, 92, 1
waitkey
Goto Buy3
End If
Arm$ = "Bear Cloak": ArmB = 6
gold% = gold% - 900
TEXT " You Bought a Bear Cloak", 15, 43, 92, 1
waitkey
Goto Buy3
End If

If kbd$ = "E" Or kbd$ = "e" Then Exit Sub
Loop

End Sub

Sub Shop4
box(40, 20, 260, 190)
TEXT " Gold:" + Fixed$(gold%), 14, 43, 130, 1
TEXT " The Lonely Souls Inn", 2, 43, 30, 1
TEXT " Do you want to stay for a night?", 15, 43, 50, 1
TEXT " Price: 30 gold", 15, 43, 60, 1
TEXT " Y/N ", 14, 43, 70, 1
Do
LoopMidi
kbd$ = INKEY$
If kbd$ = "Y" Or kbd$ = "y" Then
If gold% < 30 Then
TEXT "Sorry,not enough Gold!", 15, 43, 90, 1
waitkey
Exit Sub
End If
TEXT "Thank's.Enjoy your sleep.", 15, 43, 90, 1
Hp = MaxHp
gold% = gold% - 30
waitkey
Exit Sub
End If
If kbd$ = "n" Or kbd$ = "N" Then Exit Sub
Loop

End Sub

'-------------------------------------------
Sub ShowMap
'dim as integer i, j
'
' For i = 0 To 15
' For j = 0 To 9
' PutTile i, j, map(i + WorldData.TopCol, j + WorldData.TopRow).Tile
' Next j
' Next i
'
' putPlayerPic

dim as integer x, y, i
dim as integer ShowX, ShowY, MapX, MapY, ScrollX, ScrollY, PutX, PutY
dim as integer MaxX, MaxY, TileNr


ShowX = (((WorldData.TopCol+7) * 20) + SX) - 160
IF ShowX < 0 THEN ShowX = 0
IF ShowX > (((WorldData.Cols) * 20) - 320) THEN ShowX = ((WorldData.Cols) * 20) - 320

ShowY = (((WorldData.TopRow+4 ) * 20) + SY) - 100
IF ShowY < 0 THEN ShowY = 0
IF ShowY > (((WorldData.Rows) * 20) - 200) THEN ShowY = ((WorldData.Rows) * 20) - 200

MapX = (ShowX \ 20) + 1
MapY = (ShowY \ 20) + 1

ScrollX = -(ShowX MOD 20)
ScrollY = -(ShowY MOD 20)

IF ScrollX THEN MaxX = 16 ELSE MaxX = 15
IF ScrollY THEN MaxY = 10 ELSE MaxY = 9


putY = scrolly
FOR y = 0 TO MaxY
putX = scrollx
FOR x = 0 TO MaxX

TileNr = Map(MapX + x, MapY + y).Tile
if TileNr <> 12 then PUTTile putX, putY, TileNr
putX = putX + 20
NEXT
putY = putY + 20
NEXT


put ((((WorldData.TopCol+7) * 20) + SX) - ShowX, (((WorldData.TopRow+4) * 20) + SY) - ShowY), HeroImg(Player.Dir, Player.Frame, 0), TRANS

putY = scrolly
FOR y = 0 TO MaxY
putX = scrollx
FOR x = 0 TO MaxX

TileNr = Map(MapX + x, MapY + y).Tile
if TileNr = 12 then PUTTile putX, putY, TileNr
putX = putX + 20
NEXT
putY = putY + 20
NEXT

'Wait for vsync
WAIT &h3DA, 8
End Sub


'-------------------------------------------
Sub Story
dim as integer x, y

Cls
For X = 0 To 319 Step 20
For y = 0 To 199 Step 20
Put (X, y), wall01, Pset
Next
Next

TEXT "Mirkwood", 15, 32, 2, 2
TEXT "Middle Earth Tale III.", 15, 140, 10, 1

NewMidi = 3
NpcTalk("intro.npc")
End Sub

'-------------------------------------------
Sub TEXT (a$, C as integer, XCoordinate as integer, YCoordinate as integer, Size as integer)
dim as integer StartX, e, ascnr, x, y, col, PixelsRight
dim b$

Size = Int(Size) 'No decimals allowed!
If Size > 10 Then Size = 10 'Check and fix invalid size calls
If Size < 1 Then Size = 1 'likewise for <.

YCoordinate = Int(YCoordinate / Size) 'Prevent ballooning of YCoordinates
'that is a result of using
'size values larger than 1 for size


If XCoordinate = 999 Then XCoordinate = 160 - (Len(a$) * 3 * Size)

StartX = XCoordinate 'set Starting X-Val for character drawing

For e = 1 To Len(a$)

B$ = MID$(a$, e, 1) ' read each character of the string
ascnr = Asc(B$) ' get ASCII values of each character

For X = 1 To 8

For y = 1 To 6

Select Case CharSet(ascnr, X, y) 'use ASCII value (a) to point
'to the correct element in
'the array

Case 0: col = 0 ' Don't draw pixel

Case 1: col = C ' Draw pixel

Case Else ' Error!
Cls
Screen 9
Beep
Color 4
Print "Error in FONTDATA.DAT"
Print "This could be the result of unauthorized tampering with the file."
Print "To fix: edit FONTDATA.DAT; make sure only 1's, 0's, and commas are there."
Print
Print "Program will now continue, but may exhibit erratic behavior..."
Do: Loop Until INKEY$ <> ""
Screen 13

End Select

If col <> 0 Then 'Draw a pixel!
Line (StartX + PixelsRight, (X + YCoordinate) * Size)-(StartX + PixelsRight + (Size - 1), ((X + YCoordinate) * Size) + (Size - 1)), col, BF
End If

StartX = StartX + Size 'Set starting X-value for next pixel

Next y

StartX = XCoordinate 'reset startx for next line of pixels

Next X
PixelsRight = PixelsRight + (6 * Size) ' add pixels for next character

Next e


End Sub


'-------------------------------------------
Sub waitkey
Do
LoopMidi
Loop Until INKEY$ <> ""
End Sub

'-------------------------------------------
Sub WhatsUp (FileName$)
dim as integer piconenpc

NpcFile$ = " "
Select Case WorldData.NPC
Case 68 To 81, 83 To 89
piconenpc = Int(Rnd * 3) + 1
If piconenpc = 1 Then NpcFile$ = "npc01.npc"
If piconenpc = 2 Then NpcFile$ = "npc02.npc"
If piconenpc = 3 Then NpcFile$ = "npc03.npc"
End Select

Select Case WorldData.NPC
Case -4
If WorldData.Place = 1 And WorldData.TopCol <= 1 Then NpcFile$ = "sign6.npc"
If WorldData.Place = 1 And WorldData.TopCol >= 38 Then NpcFile$ = "sign5.npc"
If WorldData.Place = 2 Then NpcFile$ = "sign7.npc"
If WorldData.Place = 7 And WorldData.TopRow <= -2 Then NpcFile$ = "sign8.npc"
If WorldData.Place = 7 And WorldData.TopRow >= 17 Then NpcFile$ = "sign9.npc"
If WorldData.Place = 9 Or WorldData.Place = 10 Then NpcFile$ = "sign10.npc"
If WorldData.Place = 11 Then NpcFile$ = "sign11.npc"
If WorldData.Place = 18 Then NpcFile$ = "sign12.npc"
Case -5
If WorldData.Place = 1 Then NpcFile$ = "sign1.npc"
If WorldData.Place = 2 Then NpcFile$ = "sign2.npc"
If WorldData.Place = 4 Then NpcFile$ = "sign3.npc"
If WorldData.Place = 8 Then NpcFile$ = "sign4.npc"
Case 29
NpcFile$ = "npc64.npc"
Case 30
If WorldData.Place = 1 Then Shop1
If WorldData.Place = 2 Then Shop2
If WorldData.Place = 4 Then Shop3
If WorldData.Place = 8 Then Shop4
Case 68
If WorldData.Place = 2 Then NpcFile$ = "npc04.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc06.npc"
Case 69
If WorldData.Place = 4 Then NpcFile$ = "npc07.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc08.npc"
Case 70
If WorldData.Place = 6 Then NpcFile$ = "npc09.npc"
Case 71
If WorldData.Place = 2 Then NpcFile$ = "npc10.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc11.npc"
Case 72
If WorldData.Place = 1 Then NpcFile$ = "npc12.npc"
If WorldData.Place = 2 Then NpcFile$ = "npc13.npc"
Case 73
If WorldData.Place = 1 Then NpcFile$ = "npc14.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc15.npc"
Case 74
If WorldData.Place = 1 Then NpcFile$ = "npc16.npc"
If WorldData.Place = 8 Then NpcFile$ = "npc17.npc"
Case 75
If WorldData.Place = 1 Then NpcFile$ = "npc18.npc"
If WorldData.Place = 6 Then NpcFile$ = "npc19.npc"
Case 76
If WorldData.Place = 1 Then NpcFile$ = "npc05.npc"
If WorldData.Place = 6 Then NpcFile$ = "npc20.npc"
Case 77
If WorldData.Place = 2 Then NpcFile$ = "npc21.npc"
If WorldData.Place = 3 Then NpcFile$ = "npc22.npc"
Case 78
If WorldData.Place = 3 Then NpcFile$ = "npc23.npc"
Case 79
If WorldData.Place = 2 Then NpcFile$ = "npc24.npc"
If WorldData.Place = 8 Then NpcFile$ = "npc25.npc"
Case 80
If WorldData.Place = 4 Then NpcFile$ = "npc26.npc"
If WorldData.Place = 8 Then NpcFile$ = "npc27.npc"
Case 81
If WorldData.Place = 3 Then NpcFile$ = "npc28.npc"
If WorldData.Place = 4 Then NpcFile$ = "npc29.npc"
Case 83
If WorldData.Place = 1 Then NpcFile$ = "npc30.npc"
If WorldData.Place = 4 Then NpcFile$ = "npc31.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc32.npc"
Case 84
If WorldData.Place = 1 Then NpcFile$ = "npc33.npc"
If WorldData.Place = 3 Then NpcFile$ = "npc34.npc"
If WorldData.Place = 8 Then NpcFile$ = "npc35.npc"
Case 85
If WorldData.Place = 2 Then NpcFile$ = "npc36.npc"
If WorldData.Place = 3 Then NpcFile$ = "npc37.npc"
If WorldData.Place = 4 Then NpcFile$ = "npc38.npc"
If WorldData.Place = 6 Then NpcFile$ = "npc39.npc"
If WorldData.Place = 10 Then NpcFile$ = "npc40.npc"
Case 86
If WorldData.Place = 2 Then NpcFile$ = "npc41.npc"
If WorldData.Place = 4 Then NpcFile$ = "npc42.npc"
If WorldData.Place = 6 Then NpcFile$ = "npc43.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc44.npc"
Case 87
If WorldData.Place = 1 Then NpcFile$ = "npc45.npc"
If WorldData.Place = 3 Then NpcFile$ = "npc46.npc"
If WorldData.Place = 6 Then NpcFile$ = "npc47.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc48.npc"
If WorldData.Place = 16 Then NpcFile$ = "npc49.npc"
Case 88
If WorldData.Place = 2 Then NpcFile$ = "npc50.npc"
If WorldData.Place = 5 Then NpcFile$ = "npc51.npc"
If WorldData.Place = 8 Then NpcFile$ = "npc52.npc"
If WorldData.Place = 9 Then NpcFile$ = "npc53.npc"
If WorldData.Place = 11 Then NpcFile$ = "npc54.npc"
Case 89
If WorldData.Place = 2 Then NpcFile$ = "npc55.npc"
If WorldData.Place = 3 Then NpcFile$ = "npc56.npc"
If WorldData.Place = 8 Then killer: NpcFile$ = " "
Case 94
If Q1 = 0 Then
NpcTalk("npc57.npc")
O1 = 1: GotAItem: Q1 = 1
Exit Sub
End If
Case 95
If Q2 = 0 Then
NpcTalk("npc58.npc")
O2 = 1: GotAItem: Q2 = 1
Exit Sub
End If
Case 96
If Q3 = 0 Then
NpcTalk("npc59.npc")
O3 = 1: GotAItem: Q3 = 1
Exit Sub
End If
Case 97
If Q4 = 0 And kills >= 5 Then
NpcTalk("npc60.npc")
O4 = 1: GotAItem: Q4 = 1: kills = kills - 5
Exit Sub
End If
If Q4 = 0 And kills <= 4 Then NpcFile$ = "npc61.npc"
Case 98
If Q5 = 0 And O2 = 1 Then
NpcTalk("npc62.npc")
O5 = 1: GotAItem: Q5 = 1
Exit Sub
End If
If Q5 = 0 And O2 = 0 Then NpcFile$ = "npc63.npc"
Case 99
If O5 = 0 Then NpcTalk("endgame1.npc"): O5 = 2: NpcFile$ = " "
If O5 = 1 Then NpcTalk("endgame2.npc"): O5 = 3: NpcFile$ = " "
End Select
If NpcFile$ = " " Then Exit Sub
NpcTalk(NpcFile$)
End Sub

Sub LoopMIDI
if nomidi then exit sub
if NewMidi <> CurMidi then
FMUSIC_StopSong(MIDISong(CurMidi))
if NewMidi > -1 and NewMidi < 5 then FMUSIC_PlaySong(MIDISong(NewMidi))
CurMidi = NewMidi
end if

FSOUND_Update
end sub

Sub TheEnd
Chdir ".."

FSOUND_Close
END
End sub
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: A game in free basic   

Back to top Go down
 
A game in free basic
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Mai-Otome Elimination Game: The Greatest Otome ROUND 7
» Contruct2 - HTML5 Game Engine
» The Mind-Boggling Game
» [MM] A Sailor Moon game for Android smartphones
» Slender Man Game

Permissions in this forum:You cannot reply to topics in this forum
Verve Joint :: General :: Gaming-
Jump to: