'=======================================================1. IDENTIFICATION
'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
'º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ASCII TERRAIN ENGINE ÛÛßßÛÛ ÛÛßßÛÛ º
'º ÛÛ Û ÛÛ v.1.2 ÛÛ ÞÛÛ ÛÛÛÛÛ º [attachment=1]
'º ÛÛ Û Û Û ÛÛ ÛÛÜÞÛÛ ÛÛÜÜÛÛ º
'º Û Û Û For Game Developers ßß º
'º ÛÛ Û Û Û ÛÛ By Virtusoroca, 2020 ÛÛßßßß ÛÛ ÛÛ º
'º ÛÛ Û Û ÛÛ Made in QB64 ÛÛßßÛÛ ÛÛÜÜÛÛ º
'º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ For more: README.TXT ÛÛÜÜÛÛ ÛÛ º
'ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
'========================================================================================2. SYSTEM SETTINGS
WindowWidth = 1200 ' Sets Window Width with 1200 pixels
WindowHeight = 800 ' Sets Window Height with 800 pixels
ColorMode = 256 ' Sets Color Mode with 256 colors
SCREEN _NEWIMAGE(WindowWidth
, WindowHeight
, ColorMode
) ' Sets Window: 1200x800, 256 colors _TITLE "Ascii Terrain Engine v. 1.2" ' Asign title to the window OPTION BASE 1 ' Sets first element of arrays to 1 not 0 '=======================================================3. DECLARATIONS
'-------------------------------------------------------3.1. Subroutines
'.......................................................3.1.1. Maps
DECLARE SUB LoadMapStructure
()' Loads MapStructure files (0s and 1s) DECLARE SUB ReadMapStructure
()' Interprets MapStructure files (0s and 1s) DECLARE SUB LoadMapDesign
()' Loads MapDesign files DECLARE SUB PrintMapDesign
()' Prints MapDesign on screen '.......................................................3.1.2. Players
DECLARE SUB LoadPlayerStructure
()' Loads PlayerStructure files (0s and 1s) DECLARE SUB ReadPlayerStructure
()' Interprets PlayerStructure files (0s and 1s) DECLARE SUB LoadPlayerDesign
()' Loads PlayerDesign files DECLARE SUB PrintPlayerDesign
()' Prints PlayerDesign on screen DECLARE SUB MovePlayer
()' Detect keyboard input and calculates collision events '.......................................................3.1.3. General
DECLARE SUB LoadIntro
()' Loads information from System files DECLARE SUB PrintIntro
()' Prints system information on screen DECLARE SUB LoadGame
()' Executes the load/read files routines DECLARE SUB ChangeLevel
()' Stores conditions and executes maps transitions DECLARE SUB DebugScreen
()' Prints status for debug (right side of the screen) '-------------------------------------------------------3.2. Types
'.......................................................3.2.1. Files
TYPE FilesLibrary
' Stores loaded files information TYPE FileLines
' Stores data extracted from loaded files TYPE FileTiles
' Stores interpreted characters extracted from lines b
AS INTEGER ' Stores block property (1=True)'.......................................................3.2.2. Players
TYPE Players
' Stores Players information '.......................................................3.2.2. Fields
TYPE Fields
' Stores field calculations (currently: collision events) '-------------------------------------------------------3.3. Variables (Part1)
'.......................................................3.3.1. General
SkipIntro = 0 ' Option (0=False, 1= TRUE)
DebugMode = 0 ' Option (0=False, 1= TRUE)
NumSystemFiles = 3 ' Specifies the number SystemFiles to handle
'.......................................................3.3.2. Maps
NumLevels = 2 ' Specifies the total number of maps
CurrentLevel = 1 ' Specifies the maps currently active
'.......................................................3.3.3, Players
NumPlayers = 2 ' Specifies the total number of Players
'-------------------------------------------------------3.4. Arrays (Part 1)
'.......................................................3.4.1. General
DIM SHARED SystemFile
(NumSystemFiles
) AS FilesLibrary
' Creates a type array of (currently) 3 elements for handling SystemFlies '.......................................................3.4.2. Maps
DIM SHARED MapStructure
(NumLevels
) AS FilesLibrary
' Creates a type array of (currently) 2 elements for handling MapStructure files DIM SHARED MapDesign
(NumLevels
) AS FilesLibrary
' Creates a type array of (currently) 2 elements for handling MapDesign files '.......................................................3.4.3. Players
DIM SHARED PlayerStructure
(NumPlayers
) AS FilesLibrary
' Creates a type array of (currently) 2 elements for handling PlayersStructure files DIM SHARED PlayerDesign
(NumPlayers
) AS FilesLibrary
' Creates a type array of (currently) 2 elements for handling PlayersDesign files DIM SHARED Player
(NumPlayers
) AS Players
' Creates a type array of (currently) 2 elements for handling Players on screen '-------------------------------------------------------3.5. Variables (Part2)
'.......................................................3.5.1. General
SystemFile(1).p = "./AppTitle.txt" ' Specifies file path to the Title image on Intro screen
SystemFile(1).h = 23 ' Specifies height of the same file
SystemFile(1).w = 51 ' Specifies width of the same file
SystemFile(2).p = "./AppLogo.txt" ' Specifies file path to the Logo image on Intro screen
SystemFile(2).h = 7 ' Specifies height of the same file
SystemFile(2).w = 15 ' Specifies width of the same file
SystemFile(3).p = "./AppInfo.txt" ' Specifies file path to the QB64 logo and additional info on Intro screen
SystemFile(3).h = 16 ' Specifies height of the same file
SystemFile(3).w = 28 ' Specifies width of the same file
'.......................................................3.5.2. Maps
FOR A
= 1 TO NumLevels
' Initiate loop for 1 to (currently) 2 MapStructure(A).h = 45 ' Assigns height for all MapStructure files to be loaded
MapStructure(A).w = 100 ' Assigns height for all MapStructure files to be loaded
MapStructure(A).a = MapStructure(A).h * MapStructure(A).w 'Calculates and asigns the area of all MapStructure files to be loaded
MapStructure(1).p = "./MapStructure1.txt" ' Specifies the path for MapStructure file of Level 1
MapDesign(1).p = "./MapDesign1.txt" ' Specifies the path for MapDesign file of Level 1
MapDesign(1).t = "DEMO 1 RogueLike" ' Specifies the name for MapDesign file of Level 2
MapDesign(1).tx = 12 ' Specifies the X coordinate for Title of Level 1
MapDesign(1).ty = 72 ' Specifies the Y coordinate for Title of Level 1
MapStructure(2).p = "./MapStructure2.txt" ' Specifies the path for MapStructure file of Level 2
MapDesign(2).p = "./MapDesign2.txt" ' Specifies the path for MapDesign file of Level 2
MapDesign(2).t = "DEMO 2 UnderDevelopment" ' Specifies the name for MapDesign file of Level 1
MapDesign(2).tx = 2 ' Specifies the X coordinate for Title of Level 2
MapDesign(2).ty = 2 ' Specifies the X coordinate for Title of Level 2
'.......................................................3.5.3. Players
PlayerStructure(1).p = "./PlayerStructure1.txt" ' Specifies the path for PlayerStructure file of Player 1
PlayerDesign(1).p = "./PlayerDesign1.txt" ' Specifies the path for PlayerDesign file of Player 1
PlayerStructure(1).h = 3 ' Specifies the hight of PlayerStructure file of Player 1
PlayerStructure(1).w = 3 ' Specifies the width of PlayerStructure file of Player 1
Player(1).a = 1 ' Sets Player 1 as active for Level 1
Player(1).x = 22 ' Sets x coordinate for start position of Player 1
Player(1).y = 79 ' Sets y coordinate for start position of Player 1
Player(1).d = "Still" ' Sets starting direction label of Player 1
PlayerStructure(2).p = "./PlayerStructure1.txt" ' Specifies the path for PlayerStructure file of Player 2
PlayerDesign(2).p = "./PlayerDesign1.txt" ' Specifies the path for PlayerDesign file of Player 2
PlayerStructure(2).h = 3 ' Specifies the hight of PlayerStructure file of Player 2
PlayerStructure(2).w = 3 ' Specifies the width of PlayerStructure file of Player 2
Player(2).a = 1 ' Sets Player 1 as active for Level 1
Player(2).x = 22 ' Sets x coordinate for start position of Player 2
Player(2).y = 76 ' Sets y coordinate for start position of Player 2
Player(2).d = "Still" ' Sets starting direction label of Player 2
'---------------------------------------------------------------------------------------------------------------3.6. Arrays (Part 2)
'...3.6.1. General
DIM SHARED SystemLine
(NumSystemFiles
, SystemFile
(1).h
) AS FileLines
' Creates a type array to store line strings of loaded files (System) '...3.6.2. Maps
DIM SHARED MapLine
(NumLevels
, MapStructure
(NumLevels
).h
) AS FileLines
' Creates a type array to store line strings extracted of loaded files (Maps) DIM SHARED MapTile
(NumLevels
, MapStructure
(NumLevels
).h
, MapStructure
(NumLevels
).w
) AS FileTiles
' Creates a type array to store tiles (characters) extracted from loaded lines (Maps) '...3.6.3. Players
DIM SHARED PlayerTile
(NumPlayers
, PlayerStructure
(NumPlayers
).h
, PlayerStructure
(NumPlayers
).w
) AS FileTiles
' Creates a type array to store line strings extracted of loaded files (Players) DIM SHARED PlayerLine
(NumPlayers
, PlayerStructure
(NumPlayers
).h
) AS FileLines
' Creates a type array to store tiles (characters) extracted from loaded lines (Players) DIM SHARED PlayerCollisionField
(NumPlayers
, 3, 3) AS Fields
' Creates a type array of (currently) 18 positions to store collision calculation for current direction of Player (2 x 3x3 characters) '=======================================================4. MAIN ROUTINE
LoadIntro ' See "Declarations" above
PrintIntro ' See "Declarations" above
LoadGame ' See "Declarations" above
PRINT "Loading data..." ' Gives the program a few seconds to data sink in _DELAY 3 ' Sets a 3 seconds delay before start DO ' Initiates Game as a DO/UNTIL loop ChangeLevel ' See "Declarations" above
_LIMIT 60 ' Sets the refresh rate of the screen at 30 frames per second MovePlayer ' See "Declarations" above
PrintMapDesign ' See "Declarations" above
PrintPlayerDesign ' See "Declarations" above
DebugScreen ' See "Declarations" above
_DISPLAY ' Turns off auto refresh of screen (avoids flickering) PCOPY 1, _DISPLAY ' Reloads screen previously stored as 1, considering changes (as movement) LOOP UNTIL KeyPress
= "Q" ' Closes game loop when "Q" is pressed '=======================================================5. SUB ROUTINES
'-------------------------------------------------------5.1. LoadIntro
FOR B
= 1 TO NumSystemFiles
FOR A
= 1 TO SystemFile
(B
).h
INPUT #1, SystemLine
(B
, A
).n
'-------------------------------------------------------5.2. PrintIntro
FOR A
= 1 TO SystemFile
(1).h
LOCATE A
+ 4, (150 - SystemFile
(1).w
) / 2 FOR A
= 1 TO SystemFile
(2).h
FOR A
= 1 TO SystemFile
(3).h
LOCATE A
+ SystemFile
(1).h
+ 6, (150 - SystemFile
(3).w
) / 2 '-------------------------------------------------------5.3. LoadGame
LoadMapStructure
ReadMapStructure
LoadMapDesign
LoadPlayerStructure
ReadPlayerStructure
LoadPlayerDesign
'-------------------------------------------------------5.4. LoadMapStructure
FOR A
= 1 TO MapStructure
(CurrentLevel
).h
INPUT #1, MapLine
(CurrentLevel
, A
).n
FOR B
= 1 TO MapStructure
(CurrentLevel
).w
MapTile
(CurrentLevel
, A
, B
).s
= MID$(MapLine
(CurrentLevel
, A
).n
, B
, 1)'-------------------------------------------------------5.5. LoadPlayerStructure
FOR A
= 1 TO PlayerStructure
(C
).h
INPUT #1, PlayerLine
(C
, A
).n
FOR B
= 1 TO PlayerStructure
(C
).w
PlayerTile
(C
, A
, B
).s
= MID$(PlayerLine
(C
, A
).n
, B
, 1)'-------------------------------------------------------5.6. ReadMapStructure
FOR A
= 1 TO MapStructure
(CurrentLevel
).h
FOR B
= 1 TO MapStructure
(CurrentLevel
).w
MapTile(CurrentLevel, A, B).b = 0
MapTile(CurrentLevel, A, B).b = 1
'-------------------------------------------------------5.7. ReadPlayerStructure
FOR A
= 1 TO PlayerStructure
(C
).h
FOR B
= 1 TO PlayerStructure
(C
).w
PlayerTile(C, A, B).b = 0
PlayerTile(C, A, B).b = 1
'-------------------------------------------------------5.8. LoadMapDesign
FOR A
= 1 TO MapStructure
(CurrentLevel
).h
INPUT #1, MapLine
(CurrentLevel
, A
).n
FOR B
= 1 TO MapStructure
(CurrentLevel
).w
MapTile
(CurrentLevel
, A
, B
).d
= MID$(MapLine
(CurrentLevel
, A
).n
, B
, 1)'-------------------------------------------------------5.9. LoadPlayerDesign
FOR A
= 1 TO PlayerStructure
(C
).h
INPUT #1, PlayerLine
(C
, A
).n
FOR B
= 1 TO PlayerStructure
(C
).w
PlayerTile
(C
, A
, B
).d
= MID$(PlayerLine
(C
, A
).n
, B
, 1)'-------------------------------------------------------5.10. PrintMapDesign
FOR A
= 1 TO MapStructure
(CurrentLevel
).h
FOR B
= 1 TO MapStructure
(CurrentLevel
).w
PRINT MapTile
(CurrentLevel
, A
, B
).d
IF MapTile
(CurrentLevel
, A
, B
).s
= "1" THEN PRINT MapTile
(CurrentLevel
, A
, B
).s
LOCATE MapDesign
(CurrentLevel
).tx
, MapDesign
(CurrentLevel
).ty
PRINT MapDesign
(CurrentLevel
).t
'-------------------------------------------------------5.11. PrintPlayerDesign
FOR A
= 1 TO PlayerStructure
(C
).h
FOR B
= 1 TO PlayerStructure
(C
).w
IF PlayerTile
(C
, A
, B
).d
<> " " THEN LOCATE Player
(C
).x
+ A
- 1, Player
(C
).y
+ B
- 1 PRINT PlayerTile
(C
, A
, B
).d
IF PlayerTile
(C
, A
, B
).s
= "1" THEN LOCATE Player
(C
).x
+ A
- 1, Player
(C
).y
+ B
- 1 PRINT PlayerTile
(C
, A
, B
).s
'-------------------------------------------------------5.12. MovePlayer !!! REWRITE !!! CONDENSE AND IMPROVE: EDGE-SENSITIVITY FOR BIGGER THAN 3X3 PLAYER
'...............................................5.12.1.Player1 UP
PlayerCollisionField(1, 1, 1).b = PlayerTile(1, 1, 1).b * MapTile(CurrentLevel, (Player(1).x - 1), Player(1).y + 0).b
PlayerCollisionField(1, 1, 2).b = PlayerTile(1, 1, 2).b * MapTile(CurrentLevel, (Player(1).x - 1), Player(1).y + 1).b
PlayerCollisionField(1, 1, 3).b = PlayerTile(1, 1, 3).b * MapTile(CurrentLevel, (Player(1).x - 1), Player(1).y + 2).b
PlayerCollisionField(1, 2, 1).b = PlayerTile(1, 2, 1).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 0).b
PlayerCollisionField(1, 2, 2).b = PlayerTile(1, 2, 2).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 1).b
PlayerCollisionField(1, 2, 3).b = PlayerTile(1, 2, 3).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 2).b
PlayerCollisionField(1, 3, 1).b = PlayerTile(1, 3, 1).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 0).b
PlayerCollisionField(1, 3, 2).b = PlayerTile(1, 3, 2).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 1).b
PlayerCollisionField(1, 3, 3).b = PlayerTile(1, 3, 3).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 2).b
IF (PlayerCollisionField
(1, 1, 1).b
= 0) AND (PlayerCollisionField
(1, 1, 2).b
= 0) AND (PlayerCollisionField
(1, 1, 3).b
= 0) AND (PlayerCollisionField
(1, 2, 1).b
= 0) AND (PlayerCollisionField
(1, 2, 2).b
= 0) AND (PlayerCollisionField
(1, 2, 3).b
= 0) AND (PlayerCollisionField
(1, 3, 1).b
= 0) AND (PlayerCollisionField
(1, 3, 2).b
= 0) AND (PlayerCollisionField
(1, 3, 3).b
= 0) THEN Player(1).x = Player(1).x - 1
Player(1).d = "Up"
ELSE Player
(1).x
= Player
(1).x
'...........................................5.12.2.Player1 DOWN
PlayerCollisionField(1, 1, 1).b = PlayerTile(1, 1, 1).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 0).b
PlayerCollisionField(1, 1, 2).b = PlayerTile(1, 1, 2).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 1).b
PlayerCollisionField(1, 1, 3).b = PlayerTile(1, 1, 3).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 2).b
PlayerCollisionField(1, 2, 1).b = PlayerTile(1, 2, 1).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 0).b
PlayerCollisionField(1, 2, 2).b = PlayerTile(1, 2, 2).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 1).b
PlayerCollisionField(1, 2, 3).b = PlayerTile(1, 2, 3).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 2).b
PlayerCollisionField(1, 3, 1).b = PlayerTile(1, 3, 1).b * MapTile(CurrentLevel, (Player(1).x + 3), Player(1).y + 0).b
PlayerCollisionField(1, 3, 2).b = PlayerTile(1, 3, 2).b * MapTile(CurrentLevel, (Player(1).x + 3), Player(1).y + 1).b
PlayerCollisionField(1, 3, 3).b = PlayerTile(1, 3, 3).b * MapTile(CurrentLevel, (Player(1).x + 3), Player(1).y + 2).b
IF (PlayerCollisionField
(1, 1, 1).b
= 0) AND (PlayerCollisionField
(1, 1, 2).b
= 0) AND (PlayerCollisionField
(1, 1, 3).b
= 0) AND (PlayerCollisionField
(1, 2, 1).b
= 0) AND (PlayerCollisionField
(1, 2, 2).b
= 0) AND (PlayerCollisionField
(1, 2, 3).b
= 0) AND (PlayerCollisionField
(1, 3, 1).b
= 0) AND (PlayerCollisionField
(1, 3, 2).b
= 0) AND (PlayerCollisionField
(1, 3, 3).b
= 0) THEN Player(1).x = Player(1).x + 1
Player(1).d = "Down"
ELSE Player
(1).x
= Player
(1).x
'...........................................5.12.3.Player1 LEFT
PlayerCollisionField(1, 1, 1).b = PlayerTile(1, 1, 1).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y - 1).b
PlayerCollisionField(1, 1, 2).b = PlayerTile(1, 1, 2).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 0).b
PlayerCollisionField(1, 1, 3).b = PlayerTile(1, 1, 3).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 1).b
PlayerCollisionField(1, 2, 1).b = PlayerTile(1, 2, 1).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y - 1).b
PlayerCollisionField(1, 2, 2).b = PlayerTile(1, 2, 2).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 0).b
PlayerCollisionField(1, 2, 3).b = PlayerTile(1, 2, 3).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 1).b
PlayerCollisionField(1, 3, 1).b = PlayerTile(1, 3, 1).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y - 1).b
PlayerCollisionField(1, 3, 2).b = PlayerTile(1, 3, 2).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 0).b
PlayerCollisionField(1, 3, 3).b = PlayerTile(1, 3, 3).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 1).b
IF (PlayerCollisionField
(1, 1, 1).b
= 0) AND (PlayerCollisionField
(1, 1, 2).b
= 0) AND (PlayerCollisionField
(1, 1, 3).b
= 0) AND (PlayerCollisionField
(1, 2, 1).b
= 0) AND (PlayerCollisionField
(1, 2, 2).b
= 0) AND (PlayerCollisionField
(1, 2, 3).b
= 0) AND (PlayerCollisionField
(1, 3, 1).b
= 0) AND (PlayerCollisionField
(1, 3, 2).b
= 0) AND (PlayerCollisionField
(1, 3, 3).b
= 0) THEN Player(1).y = Player(1).y - 1
Player(1).d = "Left"
ELSE Player
(1).y
= Player
(1).y
'...........................................5.12.4.Player1 RIGHT
PlayerCollisionField(1, 1, 1).b = PlayerTile(1, 1, 1).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 1).b
PlayerCollisionField(1, 1, 2).b = PlayerTile(1, 1, 2).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 2).b
PlayerCollisionField(1, 1, 3).b = PlayerTile(1, 1, 3).b * MapTile(CurrentLevel, (Player(1).x + 0), Player(1).y + 3).b
PlayerCollisionField(1, 2, 1).b = PlayerTile(1, 2, 1).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 1).b
PlayerCollisionField(1, 2, 2).b = PlayerTile(1, 2, 2).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 2).b
PlayerCollisionField(1, 2, 3).b = PlayerTile(1, 2, 3).b * MapTile(CurrentLevel, (Player(1).x + 1), Player(1).y + 3).b
PlayerCollisionField(1, 3, 1).b = PlayerTile(1, 3, 1).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 1).b
PlayerCollisionField(1, 3, 2).b = PlayerTile(1, 3, 2).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 2).b
PlayerCollisionField(1, 3, 3).b = PlayerTile(1, 3, 3).b * MapTile(CurrentLevel, (Player(1).x + 2), Player(1).y + 3).b
IF (PlayerCollisionField
(1, 1, 1).b
= 0) AND (PlayerCollisionField
(1, 1, 2).b
= 0) AND (PlayerCollisionField
(1, 1, 3).b
= 0) AND (PlayerCollisionField
(1, 2, 1).b
= 0) AND (PlayerCollisionField
(1, 2, 2).b
= 0) AND (PlayerCollisionField
(1, 2, 3).b
= 0) AND (PlayerCollisionField
(1, 3, 1).b
= 0) AND (PlayerCollisionField
(1, 3, 2).b
= 0) AND (PlayerCollisionField
(1, 3, 3).b
= 0) THEN Player(1).y = Player(1).y + 1
Player(1).d = "Right"
ELSE Player
(1).y
= Player
(1).y
'...........................................5.12.5.Player2 UP
PlayerCollisionField(2, 1, 1).b = PlayerTile(2, 1, 1).b * MapTile(CurrentLevel, (Player(2).x - 1), Player(2).y + 0).b
PlayerCollisionField(2, 1, 2).b = PlayerTile(2, 1, 2).b * MapTile(CurrentLevel, (Player(2).x - 1), Player(2).y + 1).b
PlayerCollisionField(2, 1, 3).b = PlayerTile(2, 1, 3).b * MapTile(CurrentLevel, (Player(2).x - 1), Player(2).y + 2).b
PlayerCollisionField(2, 2, 1).b = PlayerTile(2, 2, 1).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 0).b
PlayerCollisionField(2, 2, 2).b = PlayerTile(2, 2, 2).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 1).b
PlayerCollisionField(2, 2, 3).b = PlayerTile(2, 2, 3).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 2).b
PlayerCollisionField(2, 3, 1).b = PlayerTile(2, 3, 1).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 0).b
PlayerCollisionField(2, 3, 2).b = PlayerTile(2, 3, 2).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 1).b
PlayerCollisionField(2, 3, 3).b = PlayerTile(2, 3, 3).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 2).b
IF (PlayerCollisionField
(2, 1, 1).b
= 0) AND (PlayerCollisionField
(2, 1, 2).b
= 0) AND (PlayerCollisionField
(2, 1, 3).b
= 0) AND (PlayerCollisionField
(2, 2, 1).b
= 0) AND (PlayerCollisionField
(2, 2, 2).b
= 0) AND (PlayerCollisionField
(2, 2, 3).b
= 0) AND (PlayerCollisionField
(2, 3, 1).b
= 0) AND (PlayerCollisionField
(2, 3, 2).b
= 0) AND (PlayerCollisionField
(2, 3, 3).b
= 0) THEN Player(2).x = Player(2).x - 1
Player(2).d = "Up"
ELSE Player
(2).x
= Player
(2).x
'...........................................5.12.6.Player2 DOWN
PlayerCollisionField(2, 1, 1).b = PlayerTile(2, 1, 1).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 0).b
PlayerCollisionField(2, 1, 2).b = PlayerTile(2, 1, 2).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 1).b
PlayerCollisionField(2, 1, 3).b = PlayerTile(2, 1, 3).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 2).b
PlayerCollisionField(2, 2, 1).b = PlayerTile(2, 2, 1).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 0).b
PlayerCollisionField(2, 2, 2).b = PlayerTile(2, 2, 2).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 1).b
PlayerCollisionField(2, 2, 3).b = PlayerTile(2, 2, 3).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 2).b
PlayerCollisionField(2, 3, 1).b = PlayerTile(2, 3, 1).b * MapTile(CurrentLevel, (Player(2).x + 3), Player(2).y + 0).b
PlayerCollisionField(2, 3, 2).b = PlayerTile(2, 3, 2).b * MapTile(CurrentLevel, (Player(2).x + 3), Player(2).y + 1).b
PlayerCollisionField(2, 3, 3).b = PlayerTile(2, 3, 3).b * MapTile(CurrentLevel, (Player(2).x + 3), Player(2).y + 2).b
IF (PlayerCollisionField
(2, 1, 1).b
= 0) AND (PlayerCollisionField
(2, 1, 2).b
= 0) AND (PlayerCollisionField
(2, 1, 3).b
= 0) AND (PlayerCollisionField
(2, 2, 1).b
= 0) AND (PlayerCollisionField
(2, 2, 2).b
= 0) AND (PlayerCollisionField
(2, 2, 3).b
= 0) AND (PlayerCollisionField
(2, 3, 1).b
= 0) AND (PlayerCollisionField
(2, 3, 2).b
= 0) AND (PlayerCollisionField
(2, 3, 3).b
= 0) THEN Player(2).x = Player(2).x + 1
Player(2).d = "Down"
ELSE Player
(2).x
= Player
(2).x
'...........................................5.12.7.Player2 LEFT
PlayerCollisionField(2, 1, 1).b = PlayerTile(2, 1, 1).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y - 1).b
PlayerCollisionField(2, 1, 2).b = PlayerTile(2, 1, 2).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 0).b
PlayerCollisionField(2, 1, 3).b = PlayerTile(2, 1, 3).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 1).b
PlayerCollisionField(2, 2, 1).b = PlayerTile(2, 2, 1).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y - 1).b
PlayerCollisionField(2, 2, 2).b = PlayerTile(2, 2, 2).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 0).b
PlayerCollisionField(2, 2, 3).b = PlayerTile(2, 2, 3).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 1).b
PlayerCollisionField(2, 3, 1).b = PlayerTile(2, 3, 1).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y - 1).b
PlayerCollisionField(2, 3, 2).b = PlayerTile(2, 3, 2).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 0).b
PlayerCollisionField(2, 3, 3).b = PlayerTile(2, 3, 3).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 1).b
IF (PlayerCollisionField
(2, 1, 1).b
= 0) AND (PlayerCollisionField
(2, 1, 2).b
= 0) AND (PlayerCollisionField
(2, 1, 3).b
= 0) AND (PlayerCollisionField
(2, 2, 1).b
= 0) AND (PlayerCollisionField
(2, 2, 2).b
= 0) AND (PlayerCollisionField
(2, 2, 3).b
= 0) AND (PlayerCollisionField
(2, 3, 1).b
= 0) AND (PlayerCollisionField
(2, 3, 2).b
= 0) AND (PlayerCollisionField
(2, 3, 3).b
= 0) THEN Player(2).y = Player(2).y - 1
Player(2).d = "Left"
ELSE Player
(2).y
= Player
(2).y
'...........................................5.12.8.Player2 RIGHT
PlayerCollisionField(2, 1, 1).b = PlayerTile(2, 1, 1).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 1).b
PlayerCollisionField(2, 1, 2).b = PlayerTile(2, 1, 2).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 2).b
PlayerCollisionField(2, 1, 3).b = PlayerTile(2, 1, 3).b * MapTile(CurrentLevel, (Player(2).x + 0), Player(2).y + 3).b
PlayerCollisionField(2, 2, 1).b = PlayerTile(2, 2, 1).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 1).b
PlayerCollisionField(2, 2, 2).b = PlayerTile(2, 2, 2).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 2).b
PlayerCollisionField(2, 2, 3).b = PlayerTile(2, 2, 3).b * MapTile(CurrentLevel, (Player(2).x + 1), Player(2).y + 3).b
PlayerCollisionField(2, 3, 1).b = PlayerTile(2, 3, 1).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 1).b
PlayerCollisionField(2, 3, 2).b = PlayerTile(2, 3, 2).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 2).b
PlayerCollisionField(2, 3, 3).b = PlayerTile(2, 3, 3).b * MapTile(CurrentLevel, (Player(2).x + 2), Player(2).y + 3).b
IF (PlayerCollisionField
(2, 1, 1).b
= 0) AND (PlayerCollisionField
(2, 1, 2).b
= 0) AND (PlayerCollisionField
(2, 1, 3).b
= 0) AND (PlayerCollisionField
(2, 2, 1).b
= 0) AND (PlayerCollisionField
(2, 2, 2).b
= 0) AND (PlayerCollisionField
(2, 2, 3).b
= 0) AND (PlayerCollisionField
(2, 3, 1).b
= 0) AND (PlayerCollisionField
(2, 3, 2).b
= 0) AND (PlayerCollisionField
(2, 3, 3).b
= 0) THEN Player(2).y = Player(2).y + 1
Player(2).d = "Right"
ELSE Player
(2).y
= Player
(2).y
'-------------------------------------------------------5.13. ChangeLevel
'...................................................5.13.1.Level 1 to 2
IF Player
(1).y
>= 97 AND CurrentLevel
= 1 THEN CurrentLevel = 2
Player(1).y = 4
Player(2).a = 0
LoadGame
'...............................................5.13.2.Level 2 to 1
CurrentLevel = 1
Player(1).y = 96
Player(2).a = 1
LoadGame
'-------------------------------------------------------5.14. DebugScreen
DebugX = 3
DebugY = 105
PRINT "Current Level:"; CurrentLevel
PRINT "MapStructure (File): "; MapStructure
(CurrentLevel
).p
PRINT "MapDesign (File): "; MapDesign
(CurrentLevel
).p
PRINT "MapDesign (Title): "; MapDesign
(CurrentLevel
).t
PRINT "PlayerStructure(1): "; PlayerStructure
(1).p
PRINT "PlayerDesign(1): "; PlayerDesign
(1).p
PRINT "MovePlayer(1) [Last move]: "; Player
(1).d
PRINT "Player(1).x: "; Player
(1).x
PRINT "Player(1).y: "; Player
(1).y
PRINT "PlayerStructure(1) x MapStructure("; CurrentLevel;
")" PRINT "(CollisionField for last KeyPress)" PRINT PlayerCollisionField
(1, 1, 1).b; PlayerCollisionField
(1, 1, 2).b; PlayerCollisionField
(1, 1, 3).b
PRINT PlayerCollisionField
(1, 2, 1).b; PlayerCollisionField
(1, 2, 2).b; PlayerCollisionField
(1, 2, 3).b
PRINT PlayerCollisionField
(1, 3, 1).b; PlayerCollisionField
(1, 3, 2).b; PlayerCollisionField
(1, 3, 3).b
PRINT "Arrows = Move Player 1" PRINT "'WASD' = Move Player 2" PRINT "F1 = Debug Mode (ON/OFF)" PRINT "F5 = Reload files (edit on the fly)" LoadGame
'=======================================================6. END OF PROGRAM