'----------------------------------------------------------------------------------------------------------Û SETUP Û--------------------------------------------------------------------------------------------------------------
SCREEN _NEWIMAGE(640, 480, 32) ' enter in graphics mode 640x480 32 bith color depth _MOUSEHIDE ' dont show OS cursor, we will use our own 'x = 20 cells
'y = 15 cells(14 in fact for gameplay, the upper one holds the HUD)
'----------------------------------------------------------------------------------------------------------Û VARAIABLES Û--------------------------------------------------------------------------------------------------------------
'Û PROGRAM GLOBALS Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û COLORS Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û IMAGES Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û MECHS Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û POINTER/MOUSE Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û HERO Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class
AS STRING ' Barbarian, Clerig, Assasin or Wizard lvl
AS _BYTE ' current character level nextXp
AS INTEGER ' the next target for lvlUp image
AS LONG ' aspect of the hero'
'Û ITEMS Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
special
AS STRING '<--------------------------¿ map
AS _BYTE 'MAP number OR -1 for POCKET ³' ITEMS SPECIAL VARIABLE:-------------------------¾
's=adds strength; a=adds agility; p=adds power; v=adds vigor;¿ CAN BE
'd=adds defense; b=adds to base damage;m=adds to max damage; ³ FROM 1 eg:a1,v3,d2,etc...
'c=adds to chance TO HIT% ; ¾ TO 3
't= teaches some spell(from 0 to 5);
'u=unidentified (has no number)
'Û WORLD Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Û ENEMIES Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
map
AS _BYTE ' in wich map enemy is lvl
AS _BYTE ' enemies level goes from 0 to 31, same as the image array
'Û SPELLS Û- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DIM SHARED SpellsIknow%%
(5) ' array contains the level that the player knows from each one of the spells 0 to 5. Never will be greater than 10
'----------------------------------------------------------------------------------------------------------Û PRE-PROGRAM Û--------------------------------------------------------------------------------------------------------------
CHDIR ".\data" ' ³ Change PRINT "Data folder not found" '³ + Check loadImages
loadProgramInitialVariables
'----------------------------------------------------------------------------------------------------------Û PROGRAM Û--------------------------------------------------------------------------------------------------------------
'What happened to the MUSIC????? XD
playerInputs
IF actualMapWorking%
<> -1 THEN drawMyFantasy
'drawTrhows -------> first show the action performed by the player, be it a spell or arrow/bolt/throw/bomb
enemiesTurns
CASE -1: lookInPocket
' POCKET CASE -2: selectSomeSpell
' SPELLS CASE -3: showTheStats
' STATS CASE -5: newGame
' NEW GAME CASE -10: lookAtMap
' MAP
IF Hero.life
> calculateMaxLife%
THEN Hero.life
= calculateMaxLife%
IF Hero.mana
> calculateMaxMana%
THEN Hero.mana
= calculateMaxMana%
doWithFinger
TESTER
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB helpMenu
() ' INCOMPLETE°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û MENUS Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° doWithFinger
keyboardInputs
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB showTheStats
() ' STILL HAVE TO: !!!ARROW FOR UPGRADING CAN'T APPEAR IF WE REACHED TOP OF SKILL FOR CLASS!!!! Also reorganize the text and positions to imitate Diablo style of skills: base & now
drawMenuBack 247, 99, 391, 274
closeWindowButton 375, 102
LINE (298, 127)-(332, 142), GREEN2
, BF
' ¿ _PUTIMAGE (299, 128), LvlImg&
(0) ' static "Lvl" img ³ROMAN number _PUTIMAGE (315, 128), LvlImg&
(Hero.lvl
) ' Lvl roman number Ù
drawItemSlots
255, 143:
_PUTIMAGE (255, 143), Hero.image
'
PRINT "STR"; calculateHeroActualStrength%;
PRINT "AGI"; calculateHeroActualAgility%;
PRINT "POW"; calculateHeroActualPower%;
PRINT "VIG"; calculateHeroActualVigor%;
LOCATE 16, 40:
PRINT "HIT%"; calculateHeroChanceToHit%;
IF Hero.attributePoints
> 0 THEN ' if you have points
_PUTIMAGE (304, 176), DirArrowImg&
(4) ' strength ¿ IF fingerIsOnSurface%
(304, 176, 16, 16) THEN ' ³ printHUDpromt "Increase your strength" ' ³
Hero.strength = Hero.strength + 1 ' ³
Hero.attributePoints = Hero.attributePoints - 1 '³
_PUTIMAGE (376, 176), DirArrowImg&
(4) ' agility ³ IF fingerIsOnSurface%
(376, 176, 16, 16) THEN ' ³ printHUDpromt "Increase your agility" ' ³
Hero.agility = Hero.agility + 1 ' ³ ARROWS
Hero.attributePoints = Hero.attributePoints - 1 '³ FOR
END IF ' ³ UPGRADING <---------------Need to make functions for checking topStrength, topPower, etc... calculateHeroTopVigor _PUTIMAGE (304, 192), DirArrowImg&
(4) ' power ³ IF fingerIsOnSurface%
(304, 192, 16, 16) THEN ' ³ printHUDpromt "Increase your power" ' ³
Hero.power = Hero.power + 1 ' ³
Hero.attributePoints = Hero.attributePoints - 1 '³
_PUTIMAGE (376, 192), DirArrowImg&
(4) ' vigor ³ IF fingerIsOnSurface%
(376, 192, 16, 16) THEN ' ³ printHUDpromt "Increase your vigor" ' ³
Hero.vigor = Hero.vigor + 1 ' ³
Hero.attributePoints = Hero.attributePoints - 1 '³
drawMenuBack 272, 296, 359, 359 '¿
PRINT "ATTRIBUTE";
' ³ bottom PRINT Hero.attributePoints;
' ¾
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB newGame
() '!!!!!!! set me to 0 after testing
actualMapWorking% = -1 'leave actual game
chooseClass '¿ don't switch
enterName ' Ù the order!
Hero.lvl = 1 ' start with a fresh character
Hero.xp = 0 ' ¿
Hero.nextXp = 100 ' ³ with no xp
Hero.prevNextXp = 0 ' ³
Hero.attributePoints = 5 ' ¾ <--------------------------!!!!!!! set me to 0 after testing
SpellsIknow%%(i%) = 0 ' you don't know any spells
'Û LOAD CHARACTER INITIAL VARIABLES Û
Hero.strength = 20 '³
Hero.agility = 10 ' ³ BARBARIAN
Hero.power = 5 ' ³ SKILLS
Hero.vigor = 15 ' Ù
Hero.strength = 15 '³
Hero.agility = 5 ' ³ CLERIG
Hero.power = 10 ' ³ SKILLS
Hero.vigor = 20 ' Ù
Hero.strength = 10 '³
Hero.agility = 20 ' ³ ASSASIN
Hero.power = 5 ' ³ SKILLS
Hero.vigor = 15 ' Ù
Hero.strength = 5 ' ³
Hero.agility = 10 ' ³ WIZARD
Hero.power = 20 ' ³ SKILLS
Hero.vigor = 15 ' ³
Hero.life = calculateMaxLife%
Hero.mana = calculateMaxMana%
cleanOnePocketSlot i% ' clearPocket
equipOurHero
actualMapWorking% = 0 ' ¿ we start
Hero.x = 32 ' ³ at this
Hero.y = 64 ' Ù place
loadEnemiesInitialVariables
loadMechsInitialVariables
showHistory 0
actualMenuWorking% = 0 ' LAUNCH GAME!
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hero.class = "" ' we have no class at start
playerInputs
IF actualMapWorking%
<> -1 THEN drawMyFantasy
CLS , GREEN3
'all screen clear on green3
drawMenuBack 247, 99, 391, 274
PRINT "CHOOSE CLASS";
' Barbarian, Clerig, Assasin or Wizard Ù
drawItemSlots 252 + i% * 34, 139 ' slots for hero images
_PUTIMAGE (252, 139), HeroImg&
(0) ' Barbarian ¿ _PUTIMAGE (286, 139), HeroImg&
(1) ' Clerig ³ characters _PUTIMAGE (320, 139), HeroImg&
(3) ' Assasin ³ images
_PUTIMAGE (327, i%
* 16 + 212), ManaImg&
(0) ' open ³ _PUTIMAGE (367, i%
* 16 + 212), ManaImg&
(6) ' close ³ static FOR ii%
= 0 TO 3 ' ³ BARS _PUTIMAGE (ii%
* 8 + 335, i%
* 16 + 212), ManaImg&
(5) '³
IF ((Finger.x
> 251 AND Finger.x
< 285) AND (Finger.y
> 138 AND Finger.y
< 172)) THEN ' ¿ barShowingPercentage 327, 212, 100 'STRENGTH ³
barShowingPercentage 327, 228, 50 'AGILITY ³
barShowingPercentage 327, 244, 25 'POWER ³
barShowingPercentage 327, 260, 75 ' VIGOR ³
IF Finger.clickL
THEN Hero.class
= "Barbarian" 'if click, confirm Ù
barShowingPercentage 327, 212, 75 'STRENGTH ³
barShowingPercentage 327, 228, 25 'AGILITY ³
barShowingPercentage 327, 244, 50 'POWER ³
barShowingPercentage 327, 260, 100 ' VIGOR ³
IF Finger.clickL
THEN Hero.class
= "Clerig" 'if click, confirm Ù
barShowingPercentage 327, 212, 50 'STRENGTH ³
barShowingPercentage 327, 228, 100 'AGILITY ³
barShowingPercentage 327, 244, 25 'POWER ³
barShowingPercentage 327, 260, 75 ' VIGOR ³
IF Finger.clickL
THEN Hero.class
= "Assasin" 'if click, confirm Ù
barShowingPercentage 327, 212, 25 'STRENGTH ³
barShowingPercentage 327, 228, 50 'AGILITY ³
barShowingPercentage 327, 244, 100 'POWER ³
barShowingPercentage 327, 260, 75 ' VIGOR ³
IF Finger.clickL
THEN Hero.class
= "Wizard" 'if click, confirm ³
doWithFinger
LOOP UNTIL Hero.class
<> "" ' leave when we have a class
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - -
SUB enterName
() ' first letter should always capitalize
DIM playerChoosingName$
'¿
Hero.id = "" ' ¿ get ready for recive
playerChoosingName$ = "" ' Ù something
suffixForName$ = "the " + Hero.class '¿ we already have
'center it ³ an rpg class ;)
ii%
= 40 - (LEN(suffixForName$
) \
2) 'Ù
getMouseData
IF actualMapWorking%
<> -1 THEN drawMyFantasy
CLS , GREEN3
'all screen clear on green3
drawMenuBack 247, 99, 391, 274
PRINT "ENTER YOUR NAME";
' Ù
drawItemSlots 303, 139 ' slot for hero image
SELECT CASE Hero.class
' images of possible hero to choose
PRINT "This story begins";
' ³ text pre PRINT "with a hero called";
' Ù
' write ³
IF LEN(playerChoosingName$
) < 11 THEN ' ³ keyboard IF LEN(playerChoosingName$
) > 0 THEN ' if the name has at least one character ³ particular IF ASC(key$
) = 8 THEN playerChoosingName$
= LEFT$(playerChoosingName$
, LEN(playerChoosingName$
) - 1) ' erease letter from name ³ menu IF ASC(key$
) = 13 THEN Hero.id
= playerChoosingName$
' confirm name ³
i%
= 40 - (LEN(playerChoosingName$
) \
2) '¿ print the name LOCATE 14, i%
' ³ the player is PRINT playerChoosingName$;
"_";
' Ù actually writing
PRINT suffixForName$;
'Ù "the " + Hero.class
_PUTIMAGE (287, 245), FingerImg&
(3) ' GO ¿ print _PUTIMAGE (335, 245), FingerImg&
(1) ' X Ù "buttons"
IF Finger.clickL
THEN ' when u click ¿ IF LEN(playerChoosingName$
) > 0 THEN ' and some name has been written ³ ' if finger position ok, then confirm name ³ mouse click
IF ((Finger.x
> 286 AND Finger.x
< 302) AND (Finger.y
> 244 AND Finger.y
< 260)) THEN Hero.id
= playerChoosingName$
'³ inputs in END IF ' ³ this particular ' if u click on the cross erease the pre-name ³ menu
IF ((Finger.x
> 334 AND Finger.x
< 350) AND (Finger.y
> 244 AND Finger.y
< 260)) THEN playerChoosingName$
= "" ' ³
doWithFinger
LOOP UNTIL Hero.id
<> "" ' leave here when we have a name
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB selectSomeSpell
() ' INCOMPLETE
drawMenuBack 247, 99, 391, 274
closeWindowButton 375, 102
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drawMenuBack 247, 99, 391, 306
PRINT "FANTASY";
' ¾ TITLE
_PUTIMAGE (259, 103), SpellImg&
(0) '¿ demoniac
IF actualMapWorking%
<> -1 THEN closeWindowButton
375, 102 ' if we are playing we should be able to see and press this button
IF fingerIsOnSurface%
(280, 144, 72, 16) THEN ' ³ IF Finger.clickL
THEN actualMenuWorking%
= -5 ' ³ NEW GAME IF fingerIsOnSurface%
(280, 144, 72, 16) THEN printHUDpromt
"Start a new game" ' ¾
IF fingerIsOnSurface%
(280, 176, 72, 16) THEN ' ³ IF Finger.clickL
THEN actualMenuWorking%
= -6 ' ³ COLOR GREEN3
, GREEN4
' no file for loading ³ IF fingerIsOnSurface%
(280, 176, 72, 16) THEN printHUDpromt
"Load a saved game" ' ¾
IF actualMapWorking%
<> -1 THEN ' ³ IF fingerIsOnSurface%
(280, 208, 72, 16) THEN ' ³ IF Finger.clickL
THEN actualMenuWorking%
= -7 ' ³ COLOR GREEN3
, GREEN4
' if NOT in game ³ IF fingerIsOnSurface%
(280, 208, 72, 16) THEN printHUDpromt
"Save current game" ' ¾
IF fingerIsOnSurface%
(296, 240, 32, 16) THEN ' ³ IF Finger.clickL
THEN actualMenuWorking%
= -9 ' ³ HELP IF fingerIsOnSurface%
(296, 240, 32, 16) THEN printHUDpromt
"Learn how to play" ' ¾
IF fingerIsOnSurface%
(296, 272, 32, 16) THEN ' ³ IF Finger.clickL
THEN actualMenuWorking%
= -8 ' ³ EXIT IF fingerIsOnSurface%
(296, 272, 32, 16) THEN printHUDpromt
"Close and leave" ' ¾
COLOR GREEN1
, GREEN4
' don't conlictuate with other stuf
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB lookInPocket
() 'what about in case of commerce or chest, bag, bones, etc....????
drawMenuBack 247, 99, 391, 274 '
closeWindowButton 375, 102
drawMenuBack 459, 99, 603, 274 '
drawItemSlots Pocket(i%).x, Pocket(i%).y ' POCKET & EQUIPPED slots draw
drawMenuBack 29, 284, 610, 450 ' ITEM INFO
drawItemsInPocket
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB lookAtMap
() ' INCOMPLETE drawMenuBack 16, 48, 624, 464
closeWindowButton 608, 52
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB loadGame
() 'INCOMPLETE drawMenuBack 247, 99, 391, 274
closeWindowButton 375, 102
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB saveGame
() 'INCOMPLETE drawMenuBack 247, 99, 391, 274
closeWindowButton 375, 102
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB cleanYourHand
() '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û ITEMS Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° inHand.kind = -1
inHand.lvl = -1
inHand.ammount = 0
inHand.special = ""
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
lookForSpaceInPocket% = FALSE
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Pocket(i%).kind = -1
Pocket(i%).lvl = -1
Pocket(i%).ammount = 0
Pocket(i%).special = ""
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_PUTIMAGE (Pocket
(i%
).x
, Pocket
(i%
).y
), calculateItemImage&
(Pocket
(i%
).kind
, Pocket
(i%
).lvl
) _PUTIMAGE (inHand.x
- 16, inHand.y
- 16), calculateItemImage&
(inHand.kind
, inHand.lvl
) '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB createItemInPocket
(kind%
, lvl%
, ammount%
, slot%
, special$
) Pocket(slot%).kind = kind%
Pocket(slot%).lvl = lvl%
Pocket(slot%).ammount = ammount%
Pocket(slot%).special = special$
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB cleanOnePocketSlot
(indexOfSlot%
) Pocket(indexOfSlot%).kind = -1
Pocket(indexOfSlot%).lvl = -1
Pocket(indexOfSlot%).ammount = 0
Pocket(indexOfSlot%).special = ""
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateItemImage&
(kind%
, lvl%
) CASE -1: calculateItemImage&
= BlankImg&
CASE 0: calculateItemImage&
= KeysImg&
(lvl%
) CASE 1: calculateItemImage&
= PotionImg&
(lvl%
) CASE 2: calculateItemImage&
= PaperImg&
(lvl%
) CASE 3: calculateItemImage&
= BookImg&
(lvl%
) CASE 4: calculateItemImage&
= SwordImg&
(lvl%
) CASE 5: calculateItemImage&
= AxeImg&
(lvl%
) CASE 6: calculateItemImage&
= ThrowImg&
(lvl%
) CASE 7: calculateItemImage&
= BowImg&
(lvl%
) CASE 8: calculateItemImage&
= BowImg&
(lvl%
+ 3) CASE 9: calculateItemImage&
= BombImg&
(lvl%
) CASE 10: calculateItemImage&
= ArrowImg&
(lvl%
) CASE 11: calculateItemImage&
= SpearImg&
(lvl%
) CASE 12: calculateItemImage&
= ArmorImg&
(lvl%
) CASE 13: calculateItemImage&
= HelmImg&
(lvl%
) CASE 14: calculateItemImage&
= ShieldImg&
(lvl%
) CASE 15: calculateItemImage&
= WandImg&
(lvl%
) CASE 16: calculateItemImage&
= MoneyImg&
(lvl%
) CASE 17: calculateItemImage&
= JewelImg&
(lvl%
) CASE 18: calculateItemImage&
= WonderImg&
(lvl%
) '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateItemDefense%
(kind%
, lvl%
, special$
) tmp% = 0
CASE 12: tmp%
= 3 + 3 * lvl%
' ARMORS CASE 13: tmp%
= 1 + 1 * lvl%
' HELMS CASE 14: tmp%
= 2 + 2 * lvl%
' SHIELDS calculateItemDefense% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateItemBaseDmg%
(kind%
, lvl%
, special$
) tmp% = 0
CASE 4: tmp%
= (lvl%
+ 1) * 2 ' SWORDS CASE 5: tmp%
= (lvl%
+ 1) * 3 'AXES CASE 6: tmp%
= (lvl%
+ 1) 'THROWS CASE 7: tmp%
= (lvl%
+ 1) * 2 'BOWS CASE 8: tmp%
= (lvl%
+ 1) * 3 'CROSSBOWS CASE 9: tmp%
= (lvl%
+ 1) * 15 'BOMBS CASE 10: tmp%
= (lvl%
+ 1) * 2 'ARROWS CASE 11: tmp%
= (lvl%
+ 1) * 3 'BOLTS CASE 15: tmp%
= (lvl%
+ 1) 'WANDS calculateItemBaseDmg% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateItemMaxDmg%
(kind%
, lvl%
, special$
) k% = kind%
l% = lvl%
s$ = special$
CASE 4: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 3 ' SWORDS CASE 5: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 4 'AXES CASE 6: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 1 'THROWS CASE 7: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 2 'BOWS CASE 8: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 3 'CROSSBOWS CASE 9: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + (l%
+ 1) * 5 'BOMBS CASE 10: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 1 'ARROWS CASE 11: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 2 'BOLTS CASE 15: tmp%
= calculateItemBaseDmg%
(k%
, l%
, s$
) + 1 'WANDS calculateItemMaxDmg% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION nameAnItem$
(kind%
, lvl%
, special$
)
tmp$ = ""
tmp$ = tmp$ + " key"
tmp$ = tmp$ + " potion"
CASE 1: tmp$
= "Dark spell" CASE 2: tmp$
= "Prophecy" CASE 0: tmp$
= "Ancient book" CASE 1: tmp$
= "Old book" CASE 3: tmp$
= "Enciclopedy" CASE 5: tmp$
= "Sharpened" CASE 6: tmp$
= "Celestial" CASE 7: tmp$
= "Demoniac" tmp$ = tmp$ + " sword"
CASE 0: tmp$
= "Bushcraft" CASE 5: tmp$
= "Sharp double" CASE 7: tmp$
= "Demoniac" tmp$ = tmp$ + " axe"
tmp$ = tmp$ + " shurikens"
CASE 1: tmp$
= "Composite" tmp$ = tmp$ + " bow"
tmp$ = tmp$ + " crossbow"
tmp$ = tmp$ + " bombs"
tmp$ = tmp$ + " arrows"
tmp$ = tmp$ + " bolts"
CASE 0: nameAnItem$
= "Leather vest" + itemSpecialSuffix$
(special$
):
EXIT FUNCTION CASE 1: nameAnItem$
= "Leather armor" + itemSpecialSuffix$
(special$
):
EXIT FUNCTION tmp$ = tmp$ + " plate"
CASE 5: nameAnItem$
= "Small Helmet" + itemSpecialSuffix$
(special$
):
EXIT FUNCTION CASE 6: nameAnItem$
= "Great healmet" + itemSpecialSuffix$
(special$
):
EXIT FUNCTION CASE 7: nameAnItem$
= "Hellking Crown" + itemSpecialSuffix$
(special$
):
EXIT FUNCTION tmp$ = tmp$ + " cap"
tmp$ = tmp$ + " shield"
CASE 0: tmp$
= "Apprentice" CASE 1: tmp$
= "Initiate" CASE 3: tmp$
= "Academic" CASE 6: tmp$
= "Egiptian" tmp$ = tmp$ + " wand"
CASE 1: tmp$
= "Many coins" CASE 2: tmp$
= "Crude gemstones" CASE 3: tmp$
= "Gemstone" CASE 3: tmp$
= "Necklace" CASE 0: tmp$
= "Dyran crystals" nameAnItem$ = tmp$ + itemSpecialSuffix$(special$)
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CASE 2: tmp$
= "warriors" CASE 2: tmp$
= "swiftness" CASE 3: tmp$
= "martiality" CASE 1: tmp$
= "ilusionism" CASE 2: tmp$
= "invocation" CASE 3: tmp$
= "necromancy" CASE 1: tmp$
= "youthness" CASE 2: tmp$
= "longevity" CASE 3: tmp$
= "eternity" CASE 1: tmp$
= "protection" CASE 2: tmp$
= "guardian" CASE 1: tmp$
= "fatality" CASE 2: tmp$
= "brutality" CASE 3: tmp$
= "animality" CASE 1: tmp$
= "craftmanship" CASE 2: tmp$
= "technicism" CASE 3: tmp$
= "engineering" CASE 2: tmp$
= "exactitud" CASE 3: tmp$
= "precision" CASE 0: tmp$
= "firebolt" CASE 1: tmp$
= "blessing" CASE 2: tmp$
= "infravision" CASE 3: tmp$
= "teleport" CASE 5: tmp$
= "mana shield" itemSpecialSuffix$ = " of " + tmp$
itemSpecialSuffix$ = ""
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB fromPocketToHand
(slotIndex%
) inHand.kind = Pocket(slotIndex%).kind
inHand.lvl = Pocket(slotIndex%).lvl
inHand.ammount = Pocket(slotIndex%).ammount
inHand.special = Pocket(slotIndex%).special
cleanOnePocketSlot slotIndex%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB fromHandToPocket
(slotIndex%
) Pocket(slotIndex%).kind = inHand.kind
Pocket(slotIndex%).lvl = inHand.lvl
Pocket(slotIndex%).ammount = inHand.ammount
Pocket(slotIndex%).special = inHand.special
cleanYourHand
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION itemRequirementsMet%
() ' NEEDS TO BE MAKED, then apply it in itemManipulationSUB
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FOR i%
= 7 TO 22 ' INVENTORY IF fingerIsOnSurface%
(Pocket
(i%
).x
, Pocket
(i%
).y
, 32, 32) THEN itemInformation i%
IF Finger.clickL
AND (Pocket
(i%
).lvl
<> -1 AND inHand.lvl
= -1) THEN fromPocketToHand i% 'grabbing an item from a slot
fromHandToPocket i% 'droping an item into a slot
IF Finger.clickR
THEN ' if RIGHT click Hero.life = Hero.life + (Pocket(i%).lvl + 1) * 5 ' increase helth ¿ DRINKING A POTION
cleanOnePocketSlot i% ' and destroy the item ¾
SELECT CASE Pocket
(i%
).lvl
' <------------------ OTHER PAPER CASES? CASE 3: actualMenuWorking%
= -10 ' map CASE 3 ' <-------------------------I HAVE TO CHECK IF BOOK REQUIREMENTS ARE MET
FOR i%
= 0 TO 6 ' EQUIPPED IF fingerIsOnSurface%
(Pocket
(i%
).x
, Pocket
(i%
).y
, 32, 32) THEN itemInformation i%
IF Finger.clickL
AND (Pocket
(i%
).lvl
<> -1 AND inHand.lvl
= -1) THEN fromPocketToHand i% ' if LEFT click grab an item from a slot. No big deal on this
ELSEIF Pocket
(i%
).lvl
= -1 AND inHand.lvl
<> -1 THEN 'droping an item into a slot needs to check and inform some things IF itemFitsEquipmentSlot%
(i%
) THEN 'IF itemRequirementsMet% THEN
IF Finger.clickL
THEN fromHandToPocket i%
'ELSE
' 'printhudpromt "Requirements not met"
'END IF
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION itemFitsEquipmentSlot%
(indexOfSlot%
) SELECT CASE indexOfSlot%
' we are checking where you wanna put the item IF inHand.kind
= 13 THEN itemFitsEquipmentSlot%
= TRUE:
EXIT FUNCTION ' if you holding a helm CASE 4, 5, 6, 9, 15: itemFitsEquipmentSlot%
= TRUE:
EXIT FUNCTION 'if in hand you have: swords,axes,throws,bombs or wands CASE 7, 8 ' if a bow or crossbow in hand IF Pocket
(4).kind
<> -1 THEN '& left hand is occupied printHUDpromt "Left hand is occupied"
IF inHand.kind
= 12 THEN itemFitsEquipmentSlot%
= TRUE:
EXIT FUNCTION ' if you holding an armor CASE 14 ' if you have a shield in hand IF (Pocket
(2).kind
= 7 OR Pocket
(2).kind
= 8) THEN ' & on right hand you have a two handed weapon printHUDpromt "Can't use it with a two handed weapon"
CASE 10 'and you have arrows in hand IF Pocket
(2).kind
= 7 THEN ' & a bow equiped printHUDpromt "You need to equip a bow"
CASE 11 ' if you have a bolts in hand IF Pocket
(2).kind
= 8 THEN ' and a crossbow equiped printHUDpromt "You need to equip a crossbow"
itemFitsEquipmentSlot% = FALSE
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB itemInformation
(whichOfTheSlots%
) ' organize a bit this later
kindOfItem% = Pocket(whichOfTheSlots%).kind
lvlOfItem% = Pocket(whichOfTheSlots%).lvl
specialOfItem$ = Pocket(whichOfTheSlots%).special
IF whichOfTheSlots%
< 7 AND kindOfItem%
= -1 THEN CASE 2: tmp$
= "Right hand" CASE 4: tmp$
= "Left hand" CASE 5: tmp$
= "Right finger" CASE 6: tmp$
= "Left finger" tmp$ = nameAnItem$(kindOfItem%, lvlOfItem%, specialOfItem$)
tmp$ = "" ' kill me after testing!!!!!!!
tmp$ = "Opens some door"
tmp$
= "Heals" + STR$((lvlOfItem%
+ 1) * 5) + " points" '?
tmp$ = "Learn about this spell"
CASE 4, 5, 7, 8, 15 ' weapons 'PRINT "Damage:"; Pocket(whichOfTheSlots%).minDmg; " -"; Pocket(whichOfTheSlots%).maxDmg
CASE 6, 9, 10, 11 'ammunitions + throws 'PRINT "Damage:"; Pocket(whichOfTheSlots%).minDmg; " -"; Pocket(whichOfTheSlots%).maxDmg; " , Ammount:"; Pocket(whichOfTheSlots%).ammount
CASE 12, 13, 14 ' armors, helms & shields tmp$
= "Defense:" + STR$(calculateItemDefense%
(kindOfItem%
, lvlOfItem%
, specialOfItem$
)) tmp$
= "Ammount:" + STR$(Pocket
(whichOfTheSlots%
).ammount
) tmp$ = "You can wear it on your finger"
tmp$ = "You can wear it on your neck"
tmp$ = "" ' kill me after testing!!!!!!!
tmp$
= "+" + RIGHT$(specialOfItem$
, 1) + " to " tmp$ = tmp$ + "strenght"
tmp$ = tmp$ + "agility"
tmp$ = tmp$ + "power"
tmp$ = tmp$ + "vigor"
tmp$ = tmp$ + "defense"
tmp$ = ""
tmp$ = ""
tmp$ = ""
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB equipOurHero
() ' remove test items CASE "Barbarian" ' you get an axe, a shield, a potion and 100$ createItemInPocket 5, 0, 1, 2, "" ' axe
createItemInPocket 14, 0, 1, 4, "" ' shield
createItemInPocket 1, 0, 1, 21, "" ' potion
createItemInPocket 16, 0, 100, 22, "" ' 100 coins
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°TESTING
createItemInPocket 12, 2, 1, 7, "a2" ' armor
createItemInPocket 13, 3, 1, 8, "v3" ' helm
createItemInPocket 7, 0, 1, 9, "" ' bow
createItemInPocket 2, 3, 1, 10, "" ' map
createItemInPocket 17, 0, 1, 11, "p2" ' ring
createItemInPocket 10, 0, 50, 12, "" ' 50 arrows
createItemInPocket 17, 2, 1, 13, "d2" ' SAID for test!!!!!!!!!!
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
CASE "Clerig" 'you get a sword, a shield, a potion and 100$ createItemInPocket 4, 0, 1, 2, "" ' sword
createItemInPocket 14, 0, 1, 4, "" ' shield
createItemInPocket 16, 0, 100, 22, "" ' 100 coins
createItemInPocket 1, 0, 1, 21, "" ' potion
CASE "Assasin" ' you get a bow, 50 arrows, a potion and 100$ createItemInPocket 7, 0, 1, 2, "" ' bow
createItemInPocket 10, 0, 50, 4, "" ' 50 arrows
createItemInPocket 16, 0, 100, 22, "" ' 100 coins
createItemInPocket 1, 0, 1, 21, "" ' potion
CASE "Wizard" ' you get a wand, a book, a potion and 100$ createItemInPocket 15, 0, 1, 2, "" ' wand
createItemInPocket 16, 0, 100, 22, "" ' 100 coins
createItemInPocket 1, 0, 1, 21, "" ' potion
createItemInPocket 3, 0, 1, 20, "t0" ' book
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateHeroActualStrength%
() '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û HERO Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° tmp% = 0
tmp%
= tmp%
+ VAL(RIGHT$(Pocket
(i%
).special
, 1)) calculateHeroActualStrength% = Hero.strength + tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tmp% = 0
tmp%
= tmp%
+ VAL(RIGHT$(Pocket
(i%
).special
, 1)) calculateHeroActualAgility% = Hero.agility + tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tmp% = 0
tmp%
= tmp%
+ VAL(RIGHT$(Pocket
(i%
).special
, 1)) calculateHeroActualPower% = Hero.power + tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tmp% = 0
tmp%
= tmp%
+ VAL(RIGHT$(Pocket
(i%
).special
, 1)) calculateHeroActualVigor% = Hero.vigor + tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tmp% = 0
tmp%
= tmp%
+ (VAL(RIGHT$(Pocket
(i%
).special
, 1)) * 7) calculateHeroChanceToHit%
= INT(calculateHeroActualAgility
* 1.25) + 20 + tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
tmp% = 0
tmp% = tmp% + calculateItemDefense%(Pocket(i%).kind, Pocket(i%).lvl, Pocket(i%).special)
calculateHeroDefense% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateHeroBaseDmg%
() 'i should watch the case of no ammo, returning 0 IN PROCCES tmp% = 0
IF NOT Pocket
(2).kind
= -1 THEN ' you need to have something in hand. Could better be pocket(2&4).ammount to be checked, for the ammo case tmp% = tmp% + calculateItemBaseDmg%(Pocket(i%).kind, Pocket(i%).lvl, Pocket(i%).special)
calculateHeroBaseDmg% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateHeroMaxDmg%
() ' i should watch the case of no ammo, returning 0 tmp% = 0
tmp% = tmp% + calculateItemMaxDmg%(Pocket(i%).kind, Pocket(i%).lvl, Pocket(i%).special)
calculateHeroMaxDmg% = tmp%
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
calculateMaxLife%
= INT(calculateHeroActualVigor%
* 2.75)'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
calculateMaxMana%
= INT(calculateHeroActualPower%
* 3.25)'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CASE "Barbarian": Hero.image
= HeroImg&
(0) CASE "Clerig": Hero.image
= HeroImg&
(1) CASE "Assasin": Hero.image
= HeroImg&
(3) CASE "Wizard": Hero.image
= HeroImg&
(6) CASE "Barbarian": Hero.image
= HeroImg&
(2) CASE "Clerig": Hero.image
= HeroImg&
(5) CASE "Assasin": Hero.image
= HeroImg&
(4) CASE "Wizard": Hero.image
= HeroImg&
(7) '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawEnemies
() '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û ENEMIES Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IF Enemy
(i%
).map
= actualMapWorking%
THEN _PUTIMAGE (Enemy
(i%
).x
, Enemy
(i%
).y
), EnemyImg&
(Enemy
(i%
).lvl
) '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateEnemyBaseDmg%
(lvl%
) ' INCOMPLETE calculateEnemyBaseDmg% = (lvl% + 1)
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION calculateEnemyScore%
(lvl%
) ' UNDONE '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB loadEnemiesInitialVariables
() ' <---- I SHOULD RANDOM CREATE THEM AND THEIR ARRAY SHOULD ONLY BE FOR THE ONES ON actualMapWorking% , the rest should be on file .txt Enemy(0).map = 0
Enemy(0).x = 8 * 32
Enemy(0).y = 2 * 32 + 32
Enemy(0).lvl = 0
Enemy(0).life = 8
Enemy(1).map = 0
Enemy(1).x = 5 * 32
Enemy(1).y = 2 * 32 + 32
Enemy(1).lvl = 0
Enemy(1).life = 8
Enemy(2).map = 1
Enemy(2).x = 7 * 32
Enemy(2).y = 8 * 32 + 32
Enemy(2).lvl = 0
Enemy(2).life = 8
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CASE 0: nameAnEnemy$
= "rat" CASE 1: nameAnEnemy$
= "spiders" CASE 2: nameAnEnemy$
= "lizard" CASE 3: nameAnEnemy$
= "tarantula" CASE 4: nameAnEnemy$
= "frog" CASE 5: nameAnEnemy$
= "beatle" CASE 6: nameAnEnemy$
= "bug" CASE 7: nameAnEnemy$
= "dragon" CASE 8: nameAnEnemy$
= "living mushrooms" CASE 9: nameAnEnemy$
= "rabbit" CASE 10: nameAnEnemy$
= "small bat" CASE 11: nameAnEnemy$
= "big bat" CASE 12: nameAnEnemy$
= "snake" CASE 13: nameAnEnemy$
= "wolf" CASE 14: nameAnEnemy$
= "jabali" CASE 15: nameAnEnemy$
= "bear" CASE 16: nameAnEnemy$
= "stuffs" CASE 17: nameAnEnemy$
= "big stuff" CASE 18: nameAnEnemy$
= "scorpion" CASE 19: nameAnEnemy$
= "octopus" CASE 20: nameAnEnemy$
= "vampire" CASE 21: nameAnEnemy$
= "mummy" CASE 22: nameAnEnemy$
= "ghost" CASE 23: nameAnEnemy$
= "hidra" CASE 24: nameAnEnemy$
= "goblin" CASE 25: nameAnEnemy$
= "zombie" CASE 26: nameAnEnemy$
= "skeleton" CASE 27: nameAnEnemy$
= "orc" CASE 28: nameAnEnemy$
= "ciclope" CASE 29: nameAnEnemy$
= "baron of hell" CASE 30: nameAnEnemy$
= "stone golem" CASE 31: nameAnEnemy$
= "Lord of the Dark" '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB enemiesTurns
() ' INCOMPLETE DIM lastInfortaionOfWhatHappened$
lastInfortaionOfWhatHappened$ = ""
IF Enemy
(i%
).map
= actualMapWorking%
THEN drawMyFantasy
getMouseData
clockForFantasy% = clockForFantasy% - 1
clockForFantasy% = 120
enemyAI i%
'!!!!!! <-------------------------------------------------i should also place here the SUB for the enemy throwing attacks
'SOUND 440, 1
doWithFinger
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB enemyAI
(enemyFromArray%
) '<------------- I must build the AI for enemies' cosider particular cases later
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IF Enemy
(indexFromArray%
).x
<> Hero.x
THEN IF Enemy
(i%
).x
> Hero.x
THEN Enemy
(i%
).x
= Enemy
(i%
).x
- 32 IF Enemy
(i%
).x
< Hero.x
THEN Enemy
(i%
).x
= Enemy
(i%
).x
+ 32
IF Enemy
(indexFromArray%
).y
<> Hero.y
THEN
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawMechs
() '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û WORLD & MECHS Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° _PUTIMAGE (Mechs
(0).x
, Mechs
(0).y
), UtileryImg&
(5) ' PROVISORY
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawMap
() ' <-Have to hard code the maps... if i could came up with a random generator... geez
IF lastMapWorking%
<> actualMapWorking%
THEN ' check if map has changed IF _FILEEXISTS(".\worlds4.txt") THEN ' if map has changed we need to read again the maps file OPEN "worlds4.txt" FOR INPUT AS #4 ' ok, file found, we get ready to go INPUT #4, tmp%
' we need to check the fist data to see if matchs the actualmapworking WHILE tmp%
<> actualMapWorking%
' ¿ FOR k%
= 0 TO 279 ' ¿ ³ keep checking untill INPUT #4, tmp%
' ³ waste the unneeded data ³ we found the map INPUT #4, tmp%
' check again the first number ³ FOR i%
= 0 TO 19 ' ³ when found INPUT #4, tmp%
' ³ load the data WorldTiles%%(i%, j%) = tmp% ' ³
lastMapWorking% = actualMapWorking% ' ¾
fatalError "worlds4.txt"
END IF ' end of map check
_PUTIMAGE (i%
* 32, j%
* 32 + 32), WorldImg&
(WorldTiles%%
(i%
, j%
)) ' ³ actual drawing
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB loadMechsInitialVariables
() ' PROVISORY, load them from a CSV as maps later
Mechs(0).x = 128
Mechs(0).y = 128
Mechs(0).kind = 0
Mechs(0).map = 0
Mechs(0).state = 0
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB getMouseData
() ''°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û PLAYER INPUTS Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Finger.clickL = TRUE ' ³ DEBOUNCE
Finger.clickL = FALSE ' ³ CLICK
Finger.oldClickL = Finger.tmpClickL ' Ù
Finger.clickR = TRUE ' ³ DEBOUNCE
Finger.clickR = FALSE ' ³ CLICK
Finger.oldClickR = Finger.tmpClickR ' Ù
inHand.x = Finger.x
inHand.y = Finger.y
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
getMouseData
keyboardInputs
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB keyboardInputs
() ' <-------------------------------------------------------No more keyboard inputs of any kind? Think in playability
'only in game and if it's players turn
'hold CTRL for throw an attack (long distance) YOU NEED TO HAVE A THROW WEAPON ON Pocket(2)!!!! AND AMMO IN Pocket(4)!!!! else should draw the cross, and if i can display "No ammo"... great. Also have to check the case of BOMBS & THROWS
'hold SHIFT for launching same spell as before, if no spell "?" sign and HUDpromt, if no mana then cross and HUDpromt too
'hold ALT to force a movement over an item instead of picking..... or maybe for the Rest One TURN ?
'SPACEBAR could accelerate the action... maybe
'P key could pause with SLEEP and HUDpromt "PAUSED Press any key to continue"
'TAB for map
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
'° what's the best way for motion? ° numpad? QWEASDZXC? some way with
'°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
'F1 for help
'F2 for new game
'F3 for save game
'F4 for load game
'F5 for pause
'number 1 for POCKET, 2 for SPELL, 3 for STATS
'if TAB pressed and MAP is on pocket then SHOW MAP, press again and takes you back to the game
actualMenuWorking% = -4
CASE -1, -2, -3, -6, -7, -10: actualMenuWorking%
= 0 IF actualMapWorking%
> -1 THEN actualMenuWorking% = 0
actualMenuWorking% = -4
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB closeWindowButton
(x%
, y%
) '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û GENERAL PROGRAM Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° IF fingerIsOnSurface%
(x%
, y%
, 16, 16) AND inHand.lvl
= -1 THEN printHUDpromt "Back to game"
CASE -1, -2, -3, -6, -7, -10: actualMenuWorking%
= 0 IF actualMapWorking%
> -1 THEN actualMenuWorking% = 0
actualMenuWorking% = -4
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LINE (0, 0)-(639, 31), GREEN4
, BF
'background line/box ¿ LINE (0, 15)-(639, 15), GREEN1
' ³
_PUTIMAGE (8, 0), BonusImg&
(1) ' big heart image ¿ lifeAsPercent%
= CINT((Hero.life
* 100) / calculateMaxLife%
) ' ³ drawFourHeartAsPercentage 32, 3, lifeAsPercent% ' ³ HEALTH
LOCATE 1, 10 ' written values on screen ³
_PUTIMAGE (144, 0), BonusImg&
(6) ' big star image ¿ manaAsPercent%
= CINT((Hero.mana
* 100) / calculateMaxMana%
) ' ³ barShowingPercentage 160, 4, manaAsPercent% ' ³ MANA
_PUTIMAGE (280, 0), FingerImg&
(5) ' little flag image ¿ xpAsPercent%
= CINT(((Hero.xp
- Hero.prevNextXp
) * 100) / (Hero.nextXp
- Hero.prevNextXp
)) ' ³ barShowingPercentage 296, 4, xpAsPercent% ' ³ EXPERIENCE
IF inHand.lvl
= -1 AND gameTurn%
= -1 THEN ' no items in hand, and it has to be your turn IF fingerIsOnSurface%
(440, 0, 48, 16) THEN ' ¿ printHUDpromt "Look at you inventory" ' ³
IF Finger.clickL
THEN actualMenuWorking%
= -1 ' ³
IF fingerIsOnSurface%
(496, 0, 48, 16) THEN ' ¿ printHUDpromt "Select a spell to perform" ' ³
IF Finger.clickL
THEN actualMenuWorking%
= -2 ' ³
IF fingerIsOnSurface%
(552, 0, 40, 16) THEN ' ¿ printHUDpromt "Character statistics" ' ³
IF Finger.clickL
THEN actualMenuWorking%
= -3 ' ³
IF fingerIsOnSurface%
(600, 0, 32, 16) THEN ' ¿ printHUDpromt "Game main menu" ' ³
IF Finger.clickL
THEN actualMenuWorking%
= -4 ' ³ COLOR GREEN1
, GREEN4
' ³ not players turn or LOCATE 1, 56 ' ³ he's grabbing something, PRINT "POCKET SPELLS STATS MENU";
'³ decive him LINE (0, 15)-(639, 15), GREEN1
' divisory line
IF Hero.attributePoints
> 0 THEN lvlUpHUDButton
600, 17
COLOR GREEN1
, GREEN4
' leave normal printing color before leaving, so we don't conflictuate with other stuff
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB TESTER
() ' <KILL ME AFTER TESTINGS> PRINT (Finger.y \
16) + 1;
",";
(Finger.x \
8) + 1 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB lvlUpHUDButton
(x%
, y%
) IF fingerIsOnSurface%
(x%
, y%
, 32, 16) AND inHand.lvl
= -1 THEN printHUDpromt "Increase your attributes"
IF Finger.clickL
THEN actualMenuWorking%
= -3 '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB showHistory
(momentOfHistory%
) 'dude, use your fantasy
PRINT "This warrior history start here." '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IF _FILEEXISTS(".\fantasy1.png") THEN ' check if tileset is there CAN I CALL IT "fantasy1.fts"? XD
MainImage&
= _LOADIMAGE(".\fantasy1.png", 32) ' load fantasy tileset in 32bit mode
LightImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ light _PUTIMAGE (0, 0), MainImage&
, LightImg&
(i%
), (i%
* 32, 0)-(i%
* 32 + 31, 31) ' Ù _PUTIMAGE (0, 0), MainImage&
, WorldImg&
(i%
), (i%
* 32, 32)-(i%
* 32 + 31, 63) ' ³ tiles for WorldImg&
(i%
+ 8) = _NEWIMAGE(32, 32, 32) ' ³ the world _PUTIMAGE (0, 0), MainImage&
, WorldImg&
(i%
+ 8), (i%
* 32, 64)-(i%
* 32 + 31, 95) ' ³ WorldImg&
(i%
+ 16) = _NEWIMAGE(32, 32, 32) ' ³ _PUTIMAGE (0, 0), MainImage&
, WorldImg&
(i%
+ 16), (i%
* 32, 96)-(i%
* 32 + 31, 127) ' Ù PotionImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ potions _PUTIMAGE (0, 0), MainImage&
, PotionImg&
(i%
), (i%
* 32, 160)-(i%
* 32 + 31, 191) ' Ù SwordImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ swords _PUTIMAGE (0, 0), MainImage&
, SwordImg&
(i%
), (i%
* 32, 224)-(i%
* 32 + 31, 255) ' Ù _PUTIMAGE (0, 0), MainImage&
, AxeImg&
(i%
), (i%
* 32, 256)-(i%
* 32 + 31, 287) ' Ù ArmorImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ armors _PUTIMAGE (0, 0), MainImage&
, ArmorImg&
(i%
), (i%
* 32, 352)-(i%
* 32 + 31, 383) ' Ù HelmImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ helms _PUTIMAGE (0, 0), MainImage&
, HelmImg&
(i%
), (i%
* 32, 384)-(i%
* 32 + 31, 415) ' Ù ShieldImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ shields _PUTIMAGE (0, 0), MainImage&
, ShieldImg&
(i%
), (i%
* 32, 416)-(i%
* 32 + 31, 447) ' Ù WandImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ wands _PUTIMAGE (0, 0), MainImage&
, WandImg&
(i%
), (i%
* 32, 448)-(i%
* 32 + 31, 479) ' Ù HeroImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ heros _PUTIMAGE (0, 0), MainImage&
, HeroImg&
(i%
), (i%
* 32, 576)-(i%
* 32 + 31, 607) ' Ù _PUTIMAGE (0, 0), MainImage&
, EnemyImg&
(i%
), (i%
* 32, 608)-(i%
* 32 + 31, 639) ' ³ EnemyImg&
(i%
+ 8) = _NEWIMAGE(32, 32, 32) ' ³ enemies _PUTIMAGE (0, 0), MainImage&
, EnemyImg&
(i%
+ 8), (i%
* 32, 640)-(i%
* 32 + 31, 671) ' ³ EnemyImg&
(i%
+ 16) = _NEWIMAGE(32, 32, 32) ' ³ _PUTIMAGE (0, 0), MainImage&
, EnemyImg&
(i%
+ 16), (i%
* 32, 672)-(i%
* 32 + 31, 703) ' ³ EnemyImg&
(i%
+ 24) = _NEWIMAGE(32, 32, 32) ' ³ _PUTIMAGE (0, 0), MainImage&
, EnemyImg&
(i%
+ 24), (i%
* 32, 704)-(i%
* 32 + 31, 735) ' Ù
LvlImg&
(i%
) = _NEWIMAGE(16, 16, 32) ' ¿ character _PUTIMAGE (0, 0), MainImage&
, LvlImg&
(i%
), (i%
* 16, 768)-(i%
* 16 + 15, 783) ' Ù level
ThrowImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ trhowable _PUTIMAGE (0, 0), MainImage&
, ThrowImg&
(i%
), (i%
* 32, 288)-(i%
* 32 + 31, 319) ' Ù weapons BombImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ bombs _PUTIMAGE (0, 0), MainImage&
, BombImg&
(i%
), (i%
* 32, 320)-(i%
* 32 + 31, 351) ' Ù ArrowImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ arrows _PUTIMAGE (0, 0), MainImage&
, ArrowImg&
(i%
), (i%
* 32 + 96, 320)-(i%
* 32 + 127, 351) ' Ù (as weapon) _PUTIMAGE (0, 0), MainImage&
, FingerImg&
(i%
), (i%
* 16, 736)-(i%
* 16 + 15, 751) ' ³ mouse FingerImg&
(i%
+ 3) = _NEWIMAGE(16, 16, 32) ' ³ pointers _PUTIMAGE (0, 0), MainImage&
, FingerImg&
(i%
+ 3), (i%
* 16, 752)-(i%
* 16 + 15, 767) ' Ù
KeysImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ keys _PUTIMAGE (0, 0), MainImage&
, KeysImg&
(i%
), (i%
* 32 + 64, 128)-(i%
* 32 + 95, 159) ' Ù UtileryImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ utilery _PUTIMAGE (0, 0), MainImage&
, UtileryImg&
(i%
), (i%
* 32, 512)-(i%
* 32 + 31, 543) ' Ù SpellImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ spells _PUTIMAGE (0, 0), MainImage&
, SpellImg&
(i%
), (i%
* 32, 544)-(i%
* 32 + 31, 575) ' Ù LifeImg&
(i%
) = _NEWIMAGE(8, 8, 32) ' ¿ hearts _PUTIMAGE (0, 0), MainImage&
, LifeImg&
(i%
), (i%
* 8, 784)-(i%
* 8 + 7, 791) ' Ù
BonusImg&
(i%
) = _NEWIMAGE(16, 16, 32) ' ¿ bonus _PUTIMAGE (0, 0), MainImage&
, BonusImg&
(i%
), (i%
* 16 + 48, 736)-(i%
* 16 + 63, 751) ' Ù DirArrowImg&
(i%
) = _NEWIMAGE(16, 16, 32) ' ¿ direction _PUTIMAGE (0, 0), MainImage&
, DirArrowImg&
(i%
), (i%
* 16 + 48, 752)-(i%
* 16 + 63, 767) ' Ù arrows
ManaImg&
(i%
) = _NEWIMAGE(8, 8, 32) ' ¿ mana bar _PUTIMAGE (0, 0), MainImage&
, ManaImg&
(i%
), (i%
* 8, 792)-(i%
* 8 + 7, 799) ' Ù
BowImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ bows & _PUTIMAGE (0, 0), MainImage&
, BowImg&
(i%
), (i%
* 32 + 96, 288)-(i%
* 32 + 127, 319) ' Ù crossbows
PaperImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ papers, map _PUTIMAGE (0, 0), MainImage&
, PaperImg&
(i%
), (i%
* 32, 192)-(i%
* 32 + 31, 223) ' Ù & scrolls BookImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ books _PUTIMAGE (0, 0), MainImage&
, BookImg&
(i%
), (i%
* 32 + 128, 192)-(i%
* 32 + 159, 223) ' Ù MoneyImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ coins, gem _PUTIMAGE (0, 0), MainImage&
, MoneyImg&
(i%
), (i%
* 32, 480)-(i%
* 32 + 31, 511) ' Ù & jewel JewelImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ rings & _PUTIMAGE (0, 0), MainImage&
, JewelImg&
(i%
), (i%
* 32 + 128, 480)-(i%
* 32 + 159, 511) ' Ù neckless
ChestImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ open & _PUTIMAGE (0, 0), MainImage&
, ChestImg&
(i%
), (i%
* 32, 128)-(i%
* 32 + 31, 159) ' Ù closed chest SpearImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ spears _PUTIMAGE (0, 0), MainImage&
, SpearImg&
(i%
), (i%
* 32 + 192, 320)-(i%
* 32 + 223, 351) ' Ù WonderImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ weird _PUTIMAGE (0, 0), MainImage&
, WonderImg&
(i%
), (i%
* 32 + 192, 512)-(i%
* 32 + 223, 543) ' Ù things BannerImg&
(i%
) = _NEWIMAGE(32, 32, 32) ' ¿ banner _PUTIMAGE (0, 0), MainImage&
, BannerImg&
(i%
), (i%
* 32 + 192, 544)-(i%
* 32 + 223, 575) ' Ù & sign
ELSE ' in case the file fantasy1.png is missing
PRINT "ERROR: file ";
CHR$(34);
"fantasy1.png";
CHR$(34);
" not found" '¿ SLEEP ' wait for keystroke ³ ERROR CASE
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB loadProgramInitialVariables
()
actualMenuWorking% = -4 ' leading to the Opening Menu
actualMapWorking% = -1 ' with no map yet
gameTurn% = -1 ' the player's turn, monsters are from they direct array
clockForFantasy% = 120 ' clock is loaded
lastMapWorking% = actualMapWorking% 'for drawMap check
'initialize mouse position
Finger.x = 319
Finger.y = 239
' EQUIPPED positions
Pocket(0).x = 516: Pocket(0).y = 136 ' head
Pocket(1).x = 556: Pocket(1).y = 147 ' neck
Pocket(2).x = 472: Pocket(2).y = 188 ' right hand
Pocket(3).x = 516: Pocket(3).y = 188 ' torso
Pocket(4).x = 560: Pocket(4).y = 188 ' right hand
Pocket(5).x = 481: Pocket(5).y = 234 'right finger
Pocket(6).x = 550: Pocket(6).y = 234 'left finger
'252,136 POCKET positions
Pocket(i%).x = 252 + (i% - 7) * 34
Pocket(i%).y = 136
Pocket(i% + 4).x = 252 + (i% - 7) * 34
Pocket(i% + 4).y = 136 + 34
Pocket(i% + 8).x = 252 + (i% - 7) * 34
Pocket(i% + 8).y = 136 + 68
Pocket(i% + 12).x = 252 + (i% - 7) * 34
Pocket(i% + 12).y = 136 + 102
'let's also set some variables of the hand
inHand.x = Finger.x
inHand.y = Finger.y
cleanYourHand
Pocket(i%).map = -1 ' ³ during all game .map for
NEXT i%
' ³ pocket and inHand is always -1 inHand.map = -1 ' ¾
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawItemSlots
(begX
, begY
) LINE (begX
, begY
)-(begX
+ 32, begY
+ 32), GREEN1
, B
LINE (begX
+ 1, begY
+ 1)-(begX
+ 31, begY
+ 31), GREEN2
, BF
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawFourHeartAsPercentage
(x%
, y%
, percent%
) _PUTIMAGE (x%
+ 8, y%
), LifeImg&
(0) ' ³ health _PUTIMAGE (x%
+ 16, y%
), LifeImg&
(0) ' ³ 99 to 75 %
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB printHUDpromt
(whatDoIPrint$
) IF actualMapWorking%
<> -1 THEN LOCATE 2, 1 ' promt line position COLOR GREEN1
, GREEN4
'always normal color for writing '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB barShowingPercentage
(x%
, y%
, percent%
)
_PUTIMAGE (x%
, y%
), ManaImg&
(0) ' opening bar _PUTIMAGE (x%
+ 40, y%
), ManaImg&
(6) ' closing bar '
_PUTIMAGE (x%
+ 32, y%
), ManaImg&
(5) ' ³ 74 to 50 %
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB drawMenuBack
(strX
, strY
, endX
, endY
) LINE (strX
- 3, strY
- 3)-(endX
+ 3, endY
+ 3), GREEN1
, B
LINE (strX
- 2, strY
- 2)-(endX
+ 2, endY
+ 2), GREEN2
, B
LINE (strX
- 1, strY
- 1)-(endX
+ 1, endY
+ 1), GREEN3
, B
LINE (strX
, strY
)-(endX
, endY
), GREEN4
, BF
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB fatalError
(fileNotFound$
) PRINT "Fatal error: file " + fileNotFound$
+ " not found" unloadImages
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drawMap
'drawPortals
'drawItemsOnGround
drawMechs
drawHero
drawEnemies
drawHUD
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION fingerIsOnSurface%
(begX%
, begY%
, imagePixelsX%
, imagePixelsY%
) IF ((Finger.x
>= begX%
AND Finger.x
<= begX%
+ (imagePixelsX%
- 1)) AND (Finger.y
>= begY%
AND Finger.y
<= begY%
+ (imagePixelsY%
- 1))) THEN fingerIsOnSurface% = TRUE
fingerIsOnSurface% = FALSE
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB doWithFinger
() '°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Û ACTION PERFORMING Û°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
IF gameTurn%
= -1 THEN ' if it's the player turn
IF Finger.y
> 31 THEN ' if Finger is in on the gameboard sector% = checkFingerSector% ' lets get the playable sector where the Finger is
priority% = checkPriorityAtSector%(sector%)
'
'
CASE 0 ' there's nothing important (out of playable area) _PUTIMAGE (Finger.x
- 1, Finger.y
- 1), FingerImg&
(0) ' normal finger
CASE 1 ' there's an enemy _PUTIMAGE (Finger.x
- 1, Finger.y
- 1), BonusImg&
(3), , (16, 0)-(0, 16) ' attack mouse printHUDpromt "Attack enemy"
allowedMotions sector%
_PUTIMAGE (Finger.x
- 1, Finger.y
- 1), BonusImg&
(7) ' sand clock itemManipulation
_PUTIMAGE (Finger.x
- 1, Finger.y
- 1), FingerImg&
(0) ' normal finger _PUTIMAGE (Finger.x
- 8, Finger.y
- 8), BonusImg&
(2) ' grabbing hand _PUTIMAGE (Finger.x
- 1, Finger.y
- 1), FingerImg&
(0) ' on a menu
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FUNCTION checkPriorityAtSector%
(where%
)
checkPriorityAtSector% = 0 ' Out of playable area
'1rst priority: ° ENEMIES °- - - - - - - - - - - - - - - - - - - - -
IF Enemy
(i%
).map
= actualMapWorking%
THEN IF Enemy
(i%
).x
= Hero.x
- 32 AND Enemy
(i%
).y
= Hero.y
+ 32 THEN IF Enemy
(i%
).x
= Hero.x
AND Enemy
(i%
).y
= Hero.y
+ 32 THEN IF Enemy
(i%
).x
= Hero.x
+ 32 AND Enemy
(i%
).y
= Hero.y
+ 32 THEN IF Enemy
(i%
).x
= Hero.x
- 32 AND Enemy
(i%
).y
= Hero.y
THEN IF Enemy
(i%
).x
= Hero.x
+ 32 AND Enemy
(i%
).y
= Hero.y
THEN IF Enemy
(i%
).x
= Hero.x
- 32 AND Enemy
(i%
).y
= Hero.y
- 32 THEN IF Enemy
(i%
).x
= Hero.x
AND Enemy
(i%
).y
= Hero.y
- 32 THEN IF Enemy
(i%
).x
= Hero.x
+ 32 AND Enemy
(i%
).y
= Hero.y
- 32 THEN
'2nd priority: ° MECHS °- - - - - - - - - - - - - - - - - - - - - - - - - - -
'I should create some Mechs first, shouldn't i? XD
'3rd priority : ° ITEMS °- - - - - - - - - - - - - - - - - - - - - - - - - - -
IF Items
(i%
).map
= actualMapWorking%
THEN 'checkPriorityAtSector% = 3: EXIT FUNCTION
'4rth priority: ° WORLD °- - - - - - - - - - - - - - - - - - - - - - - -
checkPriorityAtSector% = 4
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IF fingerIsOnSurface%
(Hero.x
- 32, Hero.y
+ 32, 32, 32) THEN ' sector 1 checkFingerSector% = 1
ELSEIF fingerIsOnSurface%
(Hero.x
, Hero.y
+ 32, 32, 32) THEN ' sector 2 checkFingerSector% = 2
ELSEIF fingerIsOnSurface%
(Hero.x
+ 32, Hero.y
+ 32, 32, 32) THEN ' sector 3 checkFingerSector% = 3
ELSEIF fingerIsOnSurface%
(Hero.x
- 32, Hero.y
, 32, 32) THEN ' sector 4 checkFingerSector% = 4
ELSEIF fingerIsOnSurface%
(Hero.x
, Hero.y
, 32, 32) THEN ' sector 5 checkFingerSector% = 5
ELSEIF fingerIsOnSurface%
(Hero.x
+ 32, Hero.y
, 32, 32) THEN ' sector 6 checkFingerSector% = 6
ELSEIF fingerIsOnSurface%
(Hero.x
- 32, Hero.y
- 32, 32, 32) THEN ' sector 7 checkFingerSector% = 7
ELSEIF fingerIsOnSurface%
(Hero.x
, Hero.y
- 32, 32, 32) THEN ' sector 8 checkFingerSector% = 8
ELSEIF fingerIsOnSurface%
(Hero.x
+ 32, Hero.y
- 32, 32, 32) THEN ' sector 9 checkFingerSector% = 9
ELSE ' nothing to do, further away from playable sectors checkFingerSector% = 0
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB allowedMotions
(where%
)
printHUDpromt "Move down & left" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(9) ' ³ Hero.y = Hero.y + 32 ' ³
Hero.x = Hero.x - 32 '
gameTurn% = 0
printHUDpromt "Move down" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(10) ' ³ Hero.y = Hero.y + 32 '
gameTurn% = 0
printHUDpromt "Move down & right" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(2) ' ³ Hero.y = Hero.y + 32 ' ³
Hero.x = Hero.x + 32 '
gameTurn% = 0
printHUDpromt "Move left" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(7) ' ³ Hero.x = Hero.x - 32 '
gameTurn% = 0
printHUDpromt "Rest one turn" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), FingerImg&
(4) ' ¾
'!!!!!!!!!!!!!!!!!!!!
gameTurn% = 0
'!!!!!!!!!!!!!!!!!!!!
printHUDpromt "Move right" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(1) ' ³ Hero.x = Hero.x + 32 '
gameTurn% = 0
printHUDpromt "Move up & left" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(8) ' ³ Hero.y = Hero.y - 32 ' ³
Hero.x = Hero.x - 32 '
gameTurn% = 0
printHUDpromt "Move up" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(4) ' ³ Hero.y = Hero.y - 32 '
gameTurn% = 0
printHUDpromt "Move up & right" ' ¿
_PUTIMAGE (Finger.x
- 8, Finger.y
- 8), DirArrowImg&
(3) ' ³ Hero.y = Hero.y - 32 ' ³
Hero.x = Hero.x + 32 '
gameTurn% = 0
_PUTIMAGE (Finger.x
- 1, Finger.y
- 1), FingerImg&
(0) ' normal finger
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SUB readyToGo
() ' STILL HAVE TO WORK ON to show the image of GO in the mouse printHUDpromt "Your turn, " + Hero.id
clockForFantasy% = clockForFantasy% - 1
clockForFantasy% = 120
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -