Author Topic: ASCII Treasure (Game)  (Read 6428 times)

MrFreyer

  • Jr. Member
  • **
  • Posts: 50
ASCII Treasure (Game)
« on: September 13, 2012, 04:02:48 pm »
Hi,

I'm working on a small game, called "ASCII Trasure", just as a hobby.
It's a mix of an round-based-adventure and a rpg. The graphic is just made of ascii-symbols.
On asciitreasure.de.to you can download the Testversion. I have also a more enhanced version, but it needs some tweaks before I will upload it.

Greetings

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2806
  • Press any key to continue or any other key to quit
Re: ASCII Treasure (Game)
« Reply #1 on: September 13, 2012, 05:44:37 pm »
Really cool!  I watched the videos and the water flow and light test videos are really neat.

I love pure ASCII games.  I once created ASCIIpede, an ASCII version of Centipede.  Creating games in pure ASCII can be quite challenging, but if done right are really cool, like yours.

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: ASCII Treasure (Game)
« Reply #2 on: September 14, 2012, 07:09:14 am »
Is the source code actually included? There were several bas files but none looked like it.
I 'm not putting stuff on my C: drive; could you change it to use relative paths instead?

MrFreyer

  • Jr. Member
  • **
  • Posts: 50
Re: ASCII Treasure (Game)
« Reply #3 on: September 14, 2012, 12:19:27 pm »
Yeah, I have changed the path problem in the actual version already. I will upload it in the next few hours.
My mistake was, that i wrote every CHAIN-commands like this: "C:\...". But I mentioned, that this is absolutely not necessary.
The source code is not included as .bas files, there are just .exe files. Would you like to see the sorce code?

Greetings

EDIT:
I have uploaded the new version now.
« Last Edit: September 14, 2012, 03:34:52 pm by MrFreyer »

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: ASCII Treasure (Game)
« Reply #4 on: September 14, 2012, 07:27:16 pm »
Thanks. Looks funny, I just wish I had a clue what I was doing  :P I bought a bridge, a ladder and a torch, but had no idea how to equip or use them.
By the way, I loaded test adventure 2 and was just playing with the keys, moving left and right, when I started getting Line: 1171 Illegal function call (reproducible, but takes a while)

It might look slightly better with _PRINTMODE _KEEPBACKGROUND.
« Last Edit: September 14, 2012, 07:32:36 pm by Kopecjay »

iamdenteddisk

  • Hero Member
  • *****
  • Posts: 2735
Re: ASCII Treasure (Game)
« Reply #5 on: September 14, 2012, 08:13:04 pm »
looks really cool, needs bg sound and effects, kudos!


MrFreyer

  • Jr. Member
  • **
  • Posts: 50
Re: ASCII Treasure (Game)
« Reply #6 on: September 15, 2012, 03:43:33 am »
If you open the option menu, you can turn the music on or off. But the music is allready very annoying. To compose a good sound, I need more time ;D

Like in the manual:
For walking (or swimming), press the arrow-keys left or right.
If you press the up-key, an arrow up will apear (instead of your character). Now you can press left-key or right-key for jumping to the left or right (or press another time the up-key, for jumping 2 fields up).

If you press the tabulator-key (key with an arrow to the left and an arrow to the right), you open the inventory. Now choose "Inventory" and you will see all your available items. Select an item with the cursor. Now you can press a number-key (1 till 9) to set the item to this hotkey.
Back in the game, just press the number-key and you hold the item in your hand.

If you press the space-key, a questionmark will apear (instead of your character). If you character has an item in his hand, you can set the item by presseing an arrow key. NOTE: If your character have a torch in his hand, you can see a lot more in the dark.

The number-key 0 is already for unequiping the hand. If you have no item equiped, you will take items with the spacebar
(to hit a monster, also just press spacebar and the arrow-keys but have no item equiped).

The Test-Map 3 have a major bug. The water will flow out of the screen :D

EDIT:
...and the game needs an Errorhandler ^^
I also will try the _PRINTMODE _KEEPBACKGROUNG

EDIT EDIT:
I can't use _PRINTMODE, because i use the SCREEN 0. But it would looks better, if I could use all 16 colors for background, not just 8 colors :(
« Last Edit: September 15, 2012, 05:38:02 am by MrFreyer »

MrFreyer

  • Jr. Member
  • **
  • Posts: 50
Re: ASCII Treasure (Game)
« Reply #7 on: September 15, 2012, 05:07:22 am »
Ok, the Error-Message "1171" was caused through the enemy respawn.
The Respawn-points in the map-files was setted wrong in my map-creator.

I attached the fixed files. Put them into the folder ASCII Treassure\sourcecode\maps. The 3 old map files can be deleted.
Then just start a new game... Now the Test-Map 3 is also provisorily fixed.

Lachie Dazdarian

  • Sr. Member
  • ****
  • Posts: 280
    • http://games.freebasic.net
Re: ASCII Treasure (Game)
« Reply #8 on: September 15, 2012, 05:46:32 am »
That looks like a rather neat and thought-out project, will some cool features (light, water).

Looking forward to future versions.

Do you have a clear image of the final version, or will you extreme develop it via user feedback as you go?

Billbo

  • Hero Member
  • *****
  • Posts: 1143
Re: ASCII Treasure (Game)
« Reply #9 on: September 15, 2012, 10:52:21 am »
MrFreyer,

I must be missing something. In your
post with the three(3) new maps, you
indicate that the 3 old ones can be
deleted. In the file I downloaded,
under the maps dir there is only
MAP_1.bas. Just curious.

Bill

iamdenteddisk

  • Hero Member
  • *****
  • Posts: 2735
Re: ASCII Treasure (Game)
« Reply #10 on: September 15, 2012, 01:22:23 pm »
see if there is anything in these you can use.

Code: [Select]
'Declare Variables
DIM Map(20, 20) AS INTEGER, PlayerX AS INTEGER, PlayerY AS INTEGER, PlayerBG AS INTEGER
'color chart to help you edit program
' 0 = black       4 = red           8 = grey             12 = light red
' 1 = blue        5 = magenta       9 = light blue       13 = light magenta
' 2 = green       6 = brown        10 = light green      14 = yellow
' 3 = cyan        7 = white        11 = light cyan       15 = bright white


SCREEN 13
_FULLSCREEN
PlayerX = 2
PlayerY = 2

'Load Map
FOR y = 1 TO 20
    FOR x = 1 TO 20
        READ Map(x, y)
        ' IF Map(x, y) = 9 THEN
        '   PlayerX = x
        '  PlayerY = y
        ' END IF
    NEXT
NEXT

start:
'Setup Game values
PlayerBG = 3 'should be same as floor

'Game Loop
DO
    'DRAW Map
    FOR x = 1 TO 20
        FOR y = 1 TO 20
            LOCATE y, x
            IF Map(x, y) = 0 THEN COLOR 8 'floor
            IF Map(x, y) = 0 THEN PRINT CHR$(35)
            IF Map(x, y) = 1 THEN COLOR 1 'water
            IF Map(x, y) = 1 THEN PRINT CHR$(177)
            IF Map(x, y) = 2 THEN COLOR 6 'walls
            IF Map(x, y) = 2 THEN PRINT CHR$(178)
            IF Map(x, y) = 4 THEN COLOR 0 'exits
            IF Map(x, y) = 4 THEN PRINT CHR$(219)
            IF Map(x, y) = 3 THEN COLOR 0 'entrance
            IF Map(x, y) = 3 THEN PRINT CHR$(219)
            IF Map(x, y) = 5 THEN COLOR 14 'torches
            IF Map(x, y) = 5 THEN PRINT CHR$(15)
            IF Map(x, y) = 6 THEN COLOR 4 'life
            IF Map(x, y) = 6 THEN PRINT CHR$(3)
            IF Map(x, y) = 7 THEN COLOR 13 'snakes
            IF Map(x, y) = 7 THEN PRINT CHR$(168)
            IF Map(x, y) = 8 THEN COLOR 5 'gold
            IF Map(x, y) = 8 THEN PRINT CHR$(165)

        NEXT

    NEXT

    'Draw Player
    LOCATE PlayerY, PlayerX
    COLOR 4 'player color
    PRINT CHR$(2)

    'collision test for exit or events***************
    IF (PlayerX) = 16 AND (PlayerY) = 19 THEN
        SOUND 500, 3
        SOUND 250, 3
        SOUND 500, 3
        SOUND 250, 3
        SOUND 90, 3
        SOUND 500, 3
        CLS
        PRINT "well done!"
        SLEEP
        SYSTEM
    END IF
    IF (PlayerX) = 12 AND (PlayerY) = 8 THEN
        SOUND 500, 3
        SOUND 250, 3
        SOUND 90, 3
        CLS
        PRINT "you fell in a trap and starved to death!"
        SLEEP
        SYSTEM
    END IF

    'color chart to help you edit program
    ' 0 = black       4 = red           8 = grey             12 = light red
    ' 1 = blue        5 = magenta       9 = light blue       13 = light magenta
    ' 2 = green       6 = brown        10 = light green      14 = yellow
    ' 3 = cyan        7 = white        11 = light cyan       15 = bright white

    LOCATE 1, 22 'side bar
    COLOR 12
    PRINT "health:"

    LOCATE 2, 22 'side bar
    COLOR 14
    PRINT "gold:"
    LOCATE 3, 22 'side bar
    COLOR 8
    PRINT "equip:"

    LOCATE 4, 22 'side bar
    COLOR 13
    PRINT "holding:"


    'keep going untill solved or escape pushed*****
    DO
        P$ = INKEY$
    LOOP UNTIL P$ <> ""

    'Change player pos back to orginal data value
    Map(PlayerX, PlayerY) = PlayerBG

    'Check input and move player
    IF P$ = CHR$(0) + "H" AND Map(PlayerX, PlayerY - 1) < 2 THEN
        PlayerY = PlayerY - 1
    ELSEIF P$ = CHR$(0) + "P" AND Map(PlayerX, PlayerY + 1) < 2 THEN
        PlayerY = PlayerY + 1
    ELSEIF P$ = CHR$(0) + "M" AND Map(PlayerX + 1, PlayerY) < 2 THEN
        PlayerX = PlayerX + 1
    ELSEIF P$ = CHR$(0) + "K" AND Map(PlayerX - 1, PlayerY) < 2 THEN
        PlayerX = PlayerX - 1
    END IF

    'Get the background data value
    PlayerBG = Map(PlayerX, PlayerY)
    'Set player on map
    'Map(PlayerX, PlayerY) = 0 'player starting piont data symbol



LOOP UNTIL P$ = CHR$(27)
'legend 20by20 Ytop to bottom X left to right
'0=floor1=water2=wall3=enterence4=exit
'5=torch6=life7=snakes8=gold9=enemy
'Map Data
DATA 2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,2
DATA 2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,2,2,5,2,2,2,0,2,2,2,2,2,2,5,2,2,2,2,2
DATA 2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,2,5,2,2,2
DATA 2,5,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,2,2,2,2,2,2,2,2,5,2,2,0,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,2,2
DATA 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,2
DATA 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,2,0,2,2,5,2,2,2,2,2,2,2,2,2,5,2,2,2,2
DATA 2,2,0,2,2,2,2,2,2,2,2,2,5,2,2,2,2,2,2,2
DATA 2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,2
DATA 2,1,1,1,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,2,2,2,2



error handling with this.

Code: [Select]
ON ERROR GOTO ErrorTrap



SCREEN 0:
CLS
LINE (0, 0)-(10, 10), 1, BF 'Attempt to draw a blue box.
'This will cause an "Illegal function
'call" error because no graphics mode
'is set while the program is running.
END




ErrorTrap:
COLOR 7, 0
'******************************ERR is between 0-255***********************
'*********check if its a known error if var ERR= "int 1 to 76 "documented*
IF ERR = 1 THEN PRINT " NEXT without FOR "
'END IF
IF ERR = 2 THEN PRINT " SYNTAX error "
'END IF
IF ERR = 3 THEN PRINT " RETURN without GOSUB "
'END IF
IF ERR = 4 THEN PRINT " Out of DATA "
'END IF
IF ERR = 5 THEN PRINT " Illegal function call "
'END IF
IF ERR = 6 THEN PRINT " Overflow "
'END IF
IF ERR = 7 THEN PRINT " Out of memory "
'END IF
IF ERR = 8 THEN PRINT " Lable not defined "
'END IF
IF ERR = 9 THEN PRINT " Subscript out of range "
'END IF
IF ERR = 10 THEN PRINT " Duplicate deffinition "
'END IF
IF ERR = 11 THEN PRINT " Devision by zero  "
'END IF
IF ERR = 12 THEN PRINT " Illegal in direct mode  "
'END IF
IF ERR = 13 THEN PRINT " Type mismatch "
'END IF
IF ERR = 14 THEN PRINT " Out of string space  "
'END IF
IF ERR = 15 THEN PRINT " undefined  "
'END IF
IF ERR = 16 THEN PRINT " string formula to complex "
'END IF
IF ERR = 17 THEN PRINT " cannot continue"
'END IF
IF ERR = 18 THEN PRINT " function not defined"
'END IF
IF ERR = 19 THEN PRINT " No resume"
'END IF
IF ERR = 20 THEN PRINT " resume without error"
'END IF
IF ERR = 21 THEN PRINT "not defined "
'END IF
IF ERR = 22 THEN PRINT "not defined "
'END IF
IF ERR = 23 THEN PRINT "not defined "
'END IF
IF ERR = 24 THEN PRINT " Device time out"
'END IF
IF ERR = 25 THEN PRINT " device fault "
'END IF
IF ERR = 26 THEN PRINT " FOR without NEXT"
'END IF
IF ERR = 27 THEN PRINT "Out of paper"
'END IF
IF ERR = 28 THEN PRINT "not defined "
'END IF
IF ERR = 29 THEN PRINT "WHILE without WEND "
'END IF
IF ERR = 30 THEN PRINT "WEND without WHILE "
'END IF
IF ERR = 31 THEN PRINT "not defined "
'END IF
IF ERR = 32 THEN PRINT "not defined "
'END IF
IF ERR = 33 THEN PRINT "Duplicate lable "
'END IF
IF ERR = 34 THEN PRINT "not defined "
'END IF
IF ERR = 35 THEN PRINT "Subprogram not defined "
'END IF
IF ERR = 36 THEN PRINT "not defined "
'END IF
IF ERR = 37 THEN PRINT "Argument count mismatch "
'END IF
IF ERR = 38 THEN PRINT "Array not defined "
'END IF
IF ERR = 39 THEN PRINT "not defined "
'END IF
IF ERR = 40 THEN PRINT "Variable required "
'END IF
IF ERR = 41 THEN PRINT "not defined "
'END IF
IF ERR = 42 THEN PRINT "not defined "
'END IF
IF ERR = 43 THEN PRINT "not defined "
'END IF
IF ERR = 44 THEN PRINT "not defined "
'END IF
IF ERR = 45 THEN PRINT "not defined "
'END IF
IF ERR = 46 THEN PRINT "not defined "
'END IF
IF ERR = 47 THEN PRINT "not defined "
'END IF
IF ERR = 48 THEN PRINT "not defined "
'END IF
IF ERR = 49 THEN PRINT "not defined "
'END IF
IF ERR = 50 THEN PRINT "Field Overflow "
'END IF
IF ERR = 51 THEN PRINT "Internal error "
'END IF
IF ERR = 52 THEN PRINT "Bad file name or number "
'END IF
IF ERR = 53 THEN PRINT "File not found "
'END IF
IF ERR = 54 THEN PRINT "Bad file mode "
'END IF
IF ERR = 55 THEN PRINT "File allready open "
'END IF
IF ERR = 56 THEN PRINT "FIELD statement active "
'END IF
IF ERR = 57 THEN PRINT "Device I/O error "
'END IF
IF ERR = 58 THEN PRINT "File already exist "
'END IF
IF ERR = 59 THEN PRINT "Bad record length "
'END IF
IF ERR = 60 THEN PRINT "not defined "
'END IF
IF ERR = 61 THEN PRINT "Disk full "
'END IF
IF ERR = 62 THEN PRINT "Input past end of file "
'END IF
IF ERR = 63 THEN PRINT "Bad record number "
'END IF
IF ERR = 64 THEN PRINT "Bad file name "
'END IF
IF ERR = 65 THEN PRINT "not defined "
'END IF
IF ERR = 66 THEN PRINT "not defined "
'END IF
IF ERR = 67 THEN PRINT "Too many files "
'END IF
IF ERR = 68 THEN PRINT "Device unavailable "
'END IF
IF ERR = 69 THEN PRINT "Communication buffer overflow "
'END IF
IF ERR = 70 THEN PRINT "Permission denied "
'END IF
IF ERR = 71 THEN PRINT "Disk not ready "
'END IF
IF ERR = 72 THEN PRINT "Disk media error "
'END IF
IF ERR = 73 THEN PRINT "Advanced feature not available "
'END IF
IF ERR = 74 THEN PRINT "Rename across disk "
'END IF
IF ERR = 75 THEN PRINT "Path file acess error "
'END IF
IF ERR = 76 THEN PRINT "path not found "
'END IF



PRINT "Error#: "; ERR

RESUME Quit
Quit:
END


Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: ASCII Treasure (Game)
« Reply #11 on: September 15, 2012, 01:33:11 pm »
Alright I think I 'm getting the hang of this. I linked my items to hotkeys, then equipped my ladder and set it on the ground. Wasn't able to climb it or anything, but hey that's a start. I killed some enemies and then went on to die in the water at some point - is there a breath mechanic?

Quote
I can't use _PRINTMODE, because i use the SCREEN 0. But it would looks better, if I could use all 16 colors for background, not just 8 colors

You can create your own screen with _NEWIMAGE. Don't know if other screens would mess your text locations, but surely there must be a way to emulate SCREEN 0 with additional colors and functionality. If you 'd like to share your source code that 'd help.




Clippy

  • Hero Member
  • *****
  • Posts: 19399
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
Re: ASCII Treasure (Game)
« Reply #12 on: September 15, 2012, 02:35:13 pm »
Quote
I can't use _PRINTMODE, because i use the SCREEN 0. But it would looks better, if I could use all 16 colors for background, not just 8 colors

Code: [Select]
OUT &H3C8, 0  'change color 0 intensities
OUT &H3C9, 63
OUT &H3C9, 63
OUT &H3C9, 63
QB64 WIKI: Main Page
Download Q-Basics Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
QB64 SDL

MrFreyer

  • Jr. Member
  • **
  • Posts: 50
Re: ASCII Treasure (Game)
« Reply #13 on: September 16, 2012, 10:52:41 am »
Quote
Do you have a clear image of the final version, or will you extreme develop it via user feedback as you go?

I have no image about the final version, because I don't know if there will be a final version or if I want to work for a long time on it, because it's fun ^^
Yeah, I think user feedback can also be a good thing, but you have to check carefully, if it fits into the rest of the game.

Quote
I must be missing something. In your
post with the three(3) new maps [...]

Maybe you have downloaded the first testversion? There was just 1 map-file.

Quote
see if there is anything in these you can use. [...]

Hihi looks funny. I don't want a view from above.
The map-drawing-procedure is nearly the same like I used. Every "field" has a different value. Depending on it's value, it has a different color, a different ascii-sign, different attributes and so on... but I don't use the DATA. And thank you for the ERROR-HANDLE-routine. It would be a good inspiration or help for me ;)

Quote
Wasn't able to climb it or anything,

Was it just one piece of ladder? Than your character hang already on it (if there would be a hole under the ladder, he did not fall into it).
Try to place more ladder-pieces above your ladder-piece.

Quote
is there a breath mechanic

Yes  ;D There IS a breath mechanic. But there is no indicator for your breath...  :P

Quote
You can create your own screen with _NEWIMAGE

I will test the _NEWIMAGE keyword, but here are the parts of the sourcecode, where I could need some help with the colors:

I've declared the SCREEN:
Code: [Select]
_TITLE "ASCII Treasure"
SCREEN 0
WIDTH 100, 77
_SCREENMOVE _MIDDLE

And thats for drawing the screen:
Code: [Select]
y& = 1
x& = 0
FOR set.tile& = 1 TO 7000
    x& = x& + 1
    LOCATE y&, x&

    IF tile&(y&, x&) = 0 THEN
        IF tile.light&(y&, x&) = 1 THEN COLOR 3, 0: PRINT "Û" 'Nothing
        IF tile.light&(y&, x&) = 0 THEN COLOR 0, 0: PRINT "°"
    END IF
   
    IF tile&(y&, x&) = 1 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 8, 7: PRINT "ð" ELSE COLOR 0, 0: PRINT "°" 'Intrusive Rock
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 2 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 10, 2: PRINT "°" ELSE COLOR 0, 0: PRINT "°" 'Grass
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 3 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 6, 0: PRINT "±" ELSE COLOR 0, 0: PRINT "°" 'Earth
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 4 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 7, 0: PRINT "²" ELSE COLOR 0, 0: PRINT "°" 'Stone
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 5 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 8, 0: PRINT "Û" ELSE COLOR 0, 0: PRINT "°" 'Rock
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 6 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 7, 0: PRINT "Û" ELSE COLOR 0, 0: PRINT "°" 'Wall
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 10 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 1, 0: PRINT "Û" ELSE COLOR 0, 0: PRINT "°" 'Water
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 11 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 12, 0: PRINT "Û" ELSE COLOR 0, 0: PRINT "°" 'Lava
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 20 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 9, 1: PRINT "~" ELSE COLOR 0, 0: PRINT "°" 'Watersource
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 21 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 12, 4: PRINT "~" ELSE COLOR 0, 0: PRINT "°" 'Lavasource
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 50 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 14, 3: PRINT "" ELSE COLOR 0, 0: PRINT "°" 'Treasure
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 97 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 15, 3: PRINT "ë" ELSE COLOR 0, 0: PRINT "°" 'Bag
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 98 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 6, 3: PRINT "" ELSE COLOR 0, 0: PRINT "°" 'Chest
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 99 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 15, 3: PRINT "" ELSE COLOR 0, 0: PRINT "°" 'Homesign
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 100 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 6, 3: PRINT "-" ELSE COLOR 0, 0: PRINT "°" 'Bridge
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 101 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 6, 3: PRINT "ð" ELSE COLOR 0, 0: PRINT "°" 'Ladder
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 102 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 8, 3: PRINT "å" ELSE COLOR 0, 0: PRINT "°" 'Bomb
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 103 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 8, 3: PRINT "#" ELSE COLOR 0, 0: PRINT "°" 'Fence
        GOTO NEXTMAPTILE
    END IF
    IF tile&(y&, x&) = 104 THEN
        IF tile.light&(y& - 1, x&) = 1 OR tile.light&(y& + 1, x&) = 1 OR tile.light&(y&, x& + 1) = 1 OR tile.light&(y&, x& - 1) = 1 OR tile.light&(y& - 1, x& - 1) = 1 OR tile.light&(y& - 1, x& + 1) = 1 OR tile.light&(y& + 1, x& + 1) = 1 OR tile.light&(y& + 1, x& - 1) = 1 THEN COLOR 6, 3: PRINT "i" ELSE COLOR 0, 0: PRINT "°" 'Torch
        GOTO NEXTMAPTILE
    END IF
    NEXTMAPTILE:
    IF x& = 100 THEN x& = 0: y& = y& + 1
NEXT set.tile&

My problem is, that I just can use the first eight (dark) colors as background colors in SCREEN 0. But I will keep SCREEN 0, because I can change the size of the screen...

EDIT:
_NEWIMAGE is awesome :D A blame, that i haven't found this keyword before ^^
Now I will use SCREEN _NEWIMAGE(800,600,256)
The screen will have the same size like before, but I have a lot more different colors. For both, back- and foreground :))
« Last Edit: September 16, 2012, 11:24:23 am by MrFreyer »

Clippy

  • Hero Member
  • *****
  • Posts: 19399
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
Re: ASCII Treasure (Game)
« Reply #14 on: September 16, 2012, 11:21:28 am »
In SCREEN 0 the _NEWIMAGE(80, 25, 0) dimensions refer to text blocks instead of pixels. That can be a shock when you forget...  :D
QB64 WIKI: Main Page
Download Q-Basics Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
QB64 SDL