/*
Still Need
-open new screen when character moves into house or castle
-leave town
-quest help
-battles
*/
import GUI
setscreen ("graphics:800;600,nobuttonbar,title:RPG")
const MARGIN := 45
var archerDefence : int
var archerMana : int
var backgroundHeight : int
var backgroundPic : int
var backgroundWidth : int
var backgroundX : int
var backgroundY : int
var baughtItem : string
var characterClass : string
var characterLevel : int
var characterMovementDistance : int := 4
var characterName : string
var chars : array char of boolean
var continue : string (1)
var currentLifeTotal : int
var currentMoneyTotal : int
var delayTime : int
var finalClass : string
var finalClassPic : int
var finalClassPicHeight : int
var finalClassPicWidth : int
var finalClassPicX : int
var finalClassPicY : int
var guideViewingCounter := 0
var leaveTownButton : int
var proceedToCastle : string
var questReminderButton : int
var quitGameButton : int
var totalLifeTotal : int
var viewCharacterGuide : string (1)
var viewGameGuide : string (1)
var warriorDefence : int
var warriorMana : int
var wizardDefence : int
var wizardMana : int
% Initialization
characterLevel := 1
currentLifeTotal := 30
totalLifeTotal := 30
currentMoneyTotal := 15
% warriorMana := 8
% warriorDefence := 10
% archerMana := 12
% archerDefence := 5
% wizardMana := 20
% wizardDefence := 2
delayTime := 2500
% Data on character
procedure characterData
put repeat ("*", 20)
put "Name: ", characterName
put "Class: ", characterClass
put "Level: ", characterLevel
put "Money: ", currentMoneyTotal
put "Life: ", currentLifeTotal, " / ", totalLifeTotal
put repeat ("*", 20)
end characterData
% Leave Town
procedure leaveTown
cls
locate (10, 10)
put "Coming later."
View.Update
delay (1000)
end leaveTown
% Quest Help
procedure questHelp
cls
locate (10, 10)
put "Coming later."
View.Update
delay (1000)
% then return to main screen
end questHelp
% Quit Game
procedure quitGame
cls
locate (10, 10)
put "Coming later."
View.Update
GUI.Quit
return
end quitGame
% PNext Screen
procedure goOnToNext
put skip, "Press any key to continue" ..
getch (continue)
cls
end goOnToNext
% Delay procedure
procedure TextDelay (text : string)
for i : 1 .. length (text)
put text (i) ..
delay (5)
end for
put skip
end TextDelay
finalClassPic := Pic.FileNew ("warrior.bmp")
backgroundPic := Pic.FileNew ("town2.bmp")
finalClassPicWidth := Pic.Width (finalClassPic)
finalClassPicHeight := Pic.Height (finalClassPic)
backgroundWidth := Pic.Width (backgroundPic)
backgroundHeight := Pic.Height (backgroundPic)
backgroundX := (backgroundWidth - maxx) div 2
backgroundY := (backgroundHeight - maxy) div 2
finalClassPicX := (backgroundWidth - finalClassPicWidth) div 2
finalClassPicY := (backgroundHeight - finalClassPicHeight) div 2
setscreen ("offscreenonly")
loop
Input.KeyDown (chars)
if chars (KEY_LEFT_ARROW) then
finalClassPicX -= 2
elsif chars (KEY_RIGHT_ARROW) then
finalClassPicX += 2
end if
if chars (KEY_UP_ARROW) then
finalClassPicY += 2
elsif chars (KEY_DOWN_ARROW) then
finalClassPicY -= 2
end if
if finalClassPicX - MARGIN < 0 then
finalClassPicX := MARGIN
elsif finalClassPicX + finalClassPicWidth > backgroundWidth - MARGIN then
finalClassPicX := backgroundWidth - MARGIN - finalClassPicWidth
end if
if finalClassPicX - backgroundX < MARGIN then
backgroundX := finalClassPicX - MARGIN
elsif (finalClassPicX + finalClassPicWidth) - backgroundX > maxx - MARGIN then
backgroundX := finalClassPicX + finalClassPicWidth - maxx + MARGIN
end if
if finalClassPicY - MARGIN < 0 then
finalClassPicY := MARGIN
elsif finalClassPicY + finalClassPicHeight > backgroundHeight - MARGIN then
finalClassPicY := backgroundHeight - MARGIN - finalClassPicHeight
end if
if finalClassPicY - backgroundY < MARGIN then
backgroundY := finalClassPicY - MARGIN
elsif (finalClassPicY + finalClassPicHeight) - backgroundY > maxy - MARGIN then
backgroundY := finalClassPicY + finalClassPicHeight - maxy + MARGIN
end if
cls
Pic.Draw (backgroundPic, -backgroundX, -backgroundY, picCopy)
Pic.Draw (finalClassPic, finalClassPicX - backgroundX, finalClassPicY - backgroundY, picMerge)
% Buttons
Draw.FillBox (0, 0, maxx, 40, brown)
leaveTownButton := GUI.CreateButtonFull (10, 5, 200, "Leave Town",
leaveTown, 0, '^L', true)
questReminderButton := GUI.CreateButtonFull (290, 5, 200, "Remeber Quest",
questHelp, 0, '^R', false)
quitGameButton := GUI.CreateButtonFull (590, 5, 200, "Quit the Game",
quitGame, 0, '^Q', false)
exit when GUI.ProcessEvent
% loop
% exit when GUI.ProcessEvent
% end loop
View.Update
end loop |