Showing posts with label BASIC. Show all posts
Showing posts with label BASIC. Show all posts

Glutton - Eat The Matrix

Glutton is a puzzle game based on the game Greed. When I first read the description, I wasn't convinced it was even much of a game. I coded up a version in BASIC from scratch for the Dragon (should run fine on a Tandy too). Available on GitHub as usual.

The basics of the game are that moving onto a numbered square moves you n steps in that direction. You must stay on the board and cannot step on a square twice. Keep playing until you cannot make a move. Get a high a score as possible.

It's oddly addictive. My highest score is 251. Have fun!



SeptTandy 2024 - Introducing ECHO-CO

SeptTandy is underway and I have had fun with this SFX tool. It's still a bit rough in places but the concept seems solid enough.



The asterisk is a selector you can  move up and down to choose an attribute to modify. There's a list of keyboard controls which will be documented but it's pretty easy to modify a sound and play around with it.

SOUND at the top is the bank you are working on. You can have 10 sounds in total at once. I am going to add a soundboard mode where you can play with all the sounds at once. There'll also be an option to print the sounds to the printer. In my case this will be the XRoar file output. Still deciding whether to save to disk as an option.

The WIP code is on GitHub if you want an early look. Beep beep!


The Joy Stick Man

 I did say stick man would be back!

I have had a game idea for a while which would be a good fit for the stickman from Lucky Egg. It's called 'Cash Grab' and some of the code and the GFX could be reused but I needed up and down movement for the game. Once I had this coded I realised this could be a useful little example for someone learning Dragon/Coco basic so here it is. Oh yes, I wanted it to have joystick control too so I added this and backported it to Lucky Egg too.

Code is below but you can also find it on Github.

In the next blog post, we'll take a look at interacting with objects on screen.

10 DIMH(16),I(16),A(1),B(1),X,Y,V,W
20 FORI=0TO15:H(I)=I*16:NEXT
30 REM SET UP GRAPHICS
40 PMODE0,1:PCLS:SCREEN1,1
50 GET(0,0)-(15,15),B
60 FORL=0TO7:READD:POKE1536+(L*16),D:NEXT
70 GET(0,0)-(15,15),A
80 REM SET STARTING POSITION
90 X=8:Y=5:V=1:W=1
100 PCLS:GOTO210
110 REM GAME LOOP
120 A$=INKEY$:IFA$="P"THENX=X+1ELSEIFA$="O"THENX=X-1
130 IFA$="Q"THENY=Y-1ELSEIFA$="A"THENY=Y+1
140 J=JOYSTK(0):IFJ=0THENX=X-1ELSEIFJ=63THENX=X+1
150 J=JOYSTK(1):IFJ=0THENY=Y-1ELSEIFJ=63THENY=Y+1
160 IFX<0THENX=0
170 IFX>15THENX=15
180 IFY<1THENY=1
190 IFY>11THENY=11
200 IF X=V AND Y=W THEN 120
210 PUT(H(X),H(Y))-(H(X)+15,H(Y)+15),A,PSET:PUT(H(V),H(W))-(H(V)+15,H(W)+15),B,PSET:V=X:W=Y
220 GOTO 120 : REM CONTINUE LOOP
230 REM STICK MAN
240 DATA24,60,24,126,24,24,36,66
250 REM

Revisiting Flip Bits and Porting To The MC-10

 Last year, I had fun writing a version of the Flipping Bits Game (from the Rosetta Code site) from scratch. It's a nice relaxed puzzle especially if you are into binary. Recently whilst browsing through my retro code, I realised this game would only require minor changes to port to the MC-10.

So I made the changes rather quickly and then found a bug. Levels 1 to 9 are hand coded whereas later levels are randomly generated (though always solvable). Thankfully the fix was easy enough and, yes, I remembered to fix the Dragon/Tandy version too!

The downside of the game is a little slow in places - PLEASE WAIT pops up between every move. It has to check the entire 2D array after each move against the solution. Luckily the MC-10 has an excellent BASIC compiler. I ran it through that and it is now almost instant in response. It really cool to get that speed boost! This makes me very excited for the various tools being created at the moment for the Tandy and the Dragon. Hopefully more people will be able to code that BASIC game they always wanted to.

Have some flipping fun! Here's the MC-10 version - C10 file in the media folder.

Let's Go Racing with 7 Lines of Code

 My recent type-in Death Valley is a favourite of mine. Games like it efficiently use the text screen auto-scrolling to great a fast action game in just a short bit of code. I thought it would be fun to write such a game from scratch and getting it going on the Dragon and the BBC.

It only takes a few lines, and with just minor changes it runs on the BBC too. With 40 columns rather than 32, the Beeb is slightly easier to get a higher score.

The Dragon version will, of course, run on the Coco but not the MC-10 which sadly lacks the STRING$ function and ELSE.



BBC Basic

10 L=0:R=39:D=16:S=0:CLS
20 PRINT STRING$(L+1,"X") + STRING$(D-(L+1)," ")+ "V"+ STRING$(R-(D+1)," ")+STRING$(40-(R),"X");
30 A$=INKEY$(0):IFA$="Q"THEND=D-1:IF D<1 THEN D=1
40 IFA$="P"THEN D=D+1:IF D>38 THEN D=38
50 IFRND(10)=1THEN L=L+1 
60 IFRND(10)=1THEN R=R-1
70 S=S+1:IFD=L OR D=R THEN CLS:PRINT "CRASH!!":PRINT "SCORE:":PRINT S:STOP ELSE GOTO 20

Dragon / Tandy Coco

10 L=0:R=31:D=16:S=0:CLS
20 PRINT STRING$(L+1,"X") + STRING$(D-(L+1)," ")+ "V"+ STRING$(R-(D+1)," ")+STRING$(32-(R),"X");
30 A$=INKEY$:IFA$="Q"THEND=D-1:IF D<1 THEN D=1
40 IFA$="P"THEN D=D+1:IF D>30 THEN D=30
50 IFRND(10)=1THEN L=L+1 
60 IFRND(10)=1THEN R=R-1
70 S=S+1:IFD=L OR D=R THEN CLS:PRINT "CRASH!!":PRINT "SCORE:":PRINT S:STOP ELSE GOTO 20

Might see if I can get this one running on other systems! Drive safely now...

Glutton - Eat The Matrix

Glutton is a puzzle game based on the game Greed . When I first read the description, I wasn't convinced it was even much of a game. I c...