A downloadable game

Tiles

=====

Commodore 64 Game - BASIC 10 Liner Contest, 2025

Author: Josip Retro Bits (Josip Kalebic)

Platform: C64

Language: Commodore BASIC V2

Category: PUR-80


Play and rules:

===============

The goal of the game is to fill the whole game area with tiles collect and collect all numbers in ascending order. There is only one rule: Moving in the same direction cancels the previous tile, which disappears. If you hit more than 3 times into the wall or already taken location, game ends. Once the whole game area is filled with tiles, move more than 3 times in any direction and game will end with a "Victory" message :)


Controls:

=========

Joystick in Port B

Use numpad if running in VICE emulator.


Code overview:

==============

(code is written using CBM prg studio)

------------

Line 0

?"{clear}{gray}":fOi=.to17:?sP9);:fOj=.to21:?cH(160-(j*i=0orj=21ori=17)*6);:nE:?:nE

Build the wall around game area.

------------

Line 1

fOz=.to3:pO1114+(pE(162)aN14)*40+(pE(53266)aN14)+2,49+z:nE:?sP17)"tiles!"

Create 4 random numbers and place them inside game area; prints game name

------------

Line 2

a$(1)="{reverse on}{sh pound}{cm asterisk}{down}{left}{left}{reverse off}{cm asterisk}{sh pound}":a$(0)="  {down}{left}{left}  ":x=10:y=2:pO53281,0:b=1:t=1:e$="{left}/80":gO6

Define tile string and other game paramterse; goto 6: creates first tile in top left corner.

------------

Line 3 and 4

d=pE(56320):on-(d=127)gO3:k=-(h>.)*h-(h=.)*k:dy=(nOdaN1)*-2+(nOdaN2):z=y:q=x

dx=(nOdaN4)*-.5+(nOdaN8)*.25:x=x+dx:y=y+dy:i=1024+y*40+x:g=pE(i):j=pE(i+41)

Read Joystick inputs; calulate new x and y values; peek x,y new position

------------

Line 5

h=-(g-48)*(g>48aNg<53):ifg=233org=102orj=102tHx=q:y=z:s=s+1:h=.:on-(s<4)gO3:gO8

Detects if player hit number or already taken postion; if player hits wall or already  taken poistion more than 3 times, game jumps to line 8; game end 

------------

Line 6

w=y:u=x:r=1:f=1:goS9:t=t+1:w=z:u=q:r=d+(od=d)*d:f=1+(od=d):goS9:ifod=dtHt=t-1

Prints tile on new location; if move direction is same as previous then it deletes the previous tile.

------------

Line 7

?"{home}{yellow}"k"{home}{down}"t""e$:s=.:od=d:on-(h=.or(h-k=1))gO3

Prints current score and number of collected numbers; If numbers are collected in incorrect order continue on line 8 (game ends)

------------

Line 8

?"{home}{down}{down}{right}"mI("{red}victory!",1,1-(t=80)*9):eN

End of the game; prints "Vicrtory" if all game area is filled with tiles.

------------

Line 9

pO781,w:pO782,u:sY65520:pO646,r:?a$(f):reT

Subroutine to print or delete tile at requested position on the screen. 

------------

Download

Download
tiles.bas 847 bytes
Download
tiles.prg 646 bytes
Download
tiles_description.md 2.8 kB

Install instructions

Loading in VICE(C64 emulator):

==============================

Start VICE; Choose "File"->"Smart attach" and select "tiles.prg" file.

Type RUN <enter> to start the game.

Drag and drop into "tiles.prg" VICE window  into the VICE window.

Game will automaticly strart.

Leave a comment

Log in with itch.io to leave a comment.