I built a game in BASIC
Re: I built a game in BASIC
Nice!!
Suggestions:
what about a fake RUN ?
If inkey$="R" then Print "RUN"
followed by another inkey$ to wait for Enter
A key to speed up the aircraft and another one to shoot a laser which destroys mountains and aliens. Make an energy bar decrease when hitting such keys.
Too bright anf too little contrasat for me. Could you make it on a Mars-like planet? dark red, dark green..
Suggestions:
what about a fake RUN ?
If inkey$="R" then Print "RUN"
followed by another inkey$ to wait for Enter
A key to speed up the aircraft and another one to shoot a laser which destroys mountains and aliens. Make an energy bar decrease when hitting such keys.
Too bright anf too little contrasat for me. Could you make it on a Mars-like planet? dark red, dark green..
Re: I built a game in BASIC
I thought that was pretty good! For a BASIC game, ala 1982, it had the right ingredients: colour, sound, cheesy UDG graphics mixed with vectors, and simple gameplay. I couldn't help smiling as I played it.
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
Re: I built a game in BASIC
Yeah I think thats the plan, this was a good learning experience, but I need more powerR-Tape wrote: ↑Fri Mar 22, 2019 9:58 pm I think it's pretty good as it is, especially as it was done on a real Speccy. Personally, I'd take everything I've learned from this and put it into practise in a new project, but some people like to keep refining their work.
(Small & easy fix: "Altitude" is spelt wrong on level 2.)
Good to know, thank you for that.Ast A. Moore wrote: ↑Fri Mar 22, 2019 10:08 pm Looks really good. It like the gameplay and the color scheme!
One tiny improvement would be to make the game run automatically after loading. Simply add a LINE 1 statement when you save the game
I know whet you mean, I did try on level 7. Space to have a black background, unfortunately the way I move the ship is to move forward then, print " " over where the ship was. By just adding print paper 0;" " it slowed everything down so I was stuck using just white. Until/if I master Machine Code.. then we can have what we want
Thanks for all the positivity..
For those interested the code is pretty heavily REM'ed.
To check all the levels just edit line 9170 set Q to a number between 1 and 8 for the 8 levels.
The code is
0-999 Game Loop
1000 - 1999 Game Screen
2000-2999 Levels
6000-6999 UDGs
9000 - 9999 Set Up
The following are the Variables
A - Cell1 posx
B - Cell1 posy
C - Number of cells caught
D - Time bar delete 8x8 square
E - Cell2 posx
F - Cell2 posy
G - Ground
H - Target number of cells to collect
i - loop var
J - Array Counter for cells start X position
K
L - Lives
M - Fuel Cell 1 Active
N - Fuel Cell 2 Active
O
P
Q - Level your on/next level
R - Speed of the cells
S - Score
T - Time
U - next move posx ship
V - next move posy ship
W - Time bar counter
X - Ship current posx
Y - Ship current posy
Z - Counter for speed and animation of cells
######
HS - High Score
TBF - Time Bonus Flag (0 on, 1 off)
During development I timed the "Kessel Run" that is from the far left of the screen - hit stop watch and "n", stop stop watch when you get to the other side. make sure no fuel cells are caught or hit the ground.
Initially the game loop as at 3000 - 3999 and the run was roughly 7.8secs. On recommendation i moved the game loop to the top of the program and the run dropped to approx. 6.2 secs! I tried other variations of optimisation but nothing else had such a drastic effect.
Re: I built a game in BASIC
Note: you can set the paper colour outside of any print statements, just by writing PAPER 0. You'd probably want to change the border colour too, and you'll obviously need to change the message colours.
Nice game, thanks!
Nice game, thanks!
- Einar Saukas
- Bugaboo
- Posts: 3100
- Joined: Wed Nov 15, 2017 2:48 pm
Re: I built a game in BASIC
I recommend to keep this sentence, but use SAVE LINE anyway, for convenience.R-Tape wrote: ↑Fri Mar 22, 2019 10:15 pmTrue, but I must say that I loved this touch as part of the backstory:Ast A. Moore wrote: ↑Fri Mar 22, 2019 10:08 pm One tiny improvement would be to make the game run automatically after loading. Simply add a LINE 1 statement when you save the game, as in:
Your story begins at "RUN"...
It's going to feel even more authentic, since there's a long tradition of small mismatches between type-ins and their instructions
- 5MinuteRetro
- Manic Miner
- Posts: 766
- Joined: Mon Nov 13, 2017 12:21 pm
- Location: UK
- Contact:
Re: I built a game in BASIC
I just tried this, on ZXDS. Looks nice but it doesn't respond to the suggested controls. Perhaps I'm doing something wrong?
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
Re: I built a game in BASIC
I don't know, but it could be the same issue that I had in my emulator, namely that when the keys are polled (beginning at line 170), the value that is matched includes the ear bit (bit 6). If, after loading a tape, bit 6 is set, the keys won't be identified correctly. You could add a line 171 PRINT AT 0,0; IN 32766 to see what happens.5MinuteRetro wrote: ↑Sun Mar 24, 2019 10:07 pm I just tried this, on ZXDS. Looks nice but it doesn't respond to the suggested controls. Perhaps I'm doing something wrong?
A very nice game by the way. It really has that authentic feel.
My ZX Spectrum emulator project: https://softspectrum48.weebly.com.
- 5MinuteRetro
- Manic Miner
- Posts: 766
- Joined: Mon Nov 13, 2017 12:21 pm
- Location: UK
- Contact:
Re: I built a game in BASIC
I barely understand that but I think I'll probably figure out/remember how to add a line of BASIC, so I'll give that a go -- thanks!Magnus wrote: ↑Mon Mar 25, 2019 4:39 amI don't know, but it could be the same issue that I had in my emulator, namely that when the keys are polled (beginning at line 170), the value that is matched includes the ear bit (bit 6). If, after loading a tape, bit 6 is set, the keys won't be identified correctly. You could add a line 171 PRINT AT 0,0; IN 32766 to see what happens.5MinuteRetro wrote: ↑Sun Mar 24, 2019 10:07 pm I just tried this, on ZXDS. Looks nice but it doesn't respond to the suggested controls. Perhaps I'm doing something wrong?
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
Re: I built a game in BASIC
Sorry if this was a bit cryptic, but if you add the line I suggested, the program would print 255 in the upper left corner of the screen if my theory is correct and bit 6 is set. It doesn't solve anything though, the emulator should be modified in that case.5MinuteRetro wrote: ↑Mon Mar 25, 2019 10:17 amI barely understand that but I think I'll probably figure out/remember how to add a line of BASIC, so I'll give that a go -- thanks!Magnus wrote: ↑Mon Mar 25, 2019 4:39 am I don't know, but it could be the same issue that I had in my emulator, namely that when the keys are polled (beginning at line 170), the value that is matched includes the ear bit (bit 6). If, after loading a tape, bit 6 is set, the keys won't be identified correctly. You could add a line 171 PRINT AT 0,0; IN 32766 to see what happens.
My ZX Spectrum emulator project: https://softspectrum48.weebly.com.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: I built a game in BASIC
No, but you could play around with the Issue 2 Keyboard feature, if the emulator has it.5MinuteRetro wrote: ↑Sun Mar 24, 2019 10:07 pm I just tried this, on ZXDS. Looks nice but it doesn't respond to the suggested controls. Perhaps I'm doing something wrong?
The keyboard polling in the game should be changed from polling ports and expecting a particular value to a simple INKEY$ statement. Then the game will work on all Spectrums:
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
- 5MinuteRetro
- Manic Miner
- Posts: 766
- Joined: Mon Nov 13, 2017 12:21 pm
- Location: UK
- Contact:
Re: I built a game in BASIC
Still not entirely sure what this is meant to do but... I just added the line successfully. The number 255 does indeed appear at the top-left corner, and the it changes as I press the game's control keys, so clearly the code knows I'm inputting something -- but still no movement from the ship.
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro
Re: I built a game in BASIC
Had a go at it, it's a nice game and very responsive considering it's written in BASIC. I didnt managed to see all the levels but broke into the game so I could see them, along with the victory screen..
So was it completely written on a Speccy? If so, the discussions about getting it to work on various emulators is quite funny, it's usually the other way round..
So was it completely written on a Speccy? If so, the discussions about getting it to work on various emulators is quite funny, it's usually the other way round..
My Speccy site: thirdharmoniser.com
Re: I built a game in BASIC
Well, that confirms my theory at least . Maybe the author would be kind enough to change the code to use inkey$ as Ast A. Moore proposed in a previous post. Or, you could give it a try yourself.5MinuteRetro wrote: ↑Mon Mar 25, 2019 11:35 amStill not entirely sure what this is meant to do but... I just added the line successfully. The number 255 does indeed appear at the top-left corner, and the it changes as I press the game's control keys, so clearly the code knows I'm inputting something -- but still no movement from the ship.
My ZX Spectrum emulator project: https://softspectrum48.weebly.com.
Re: I built a game in BASIC
Yes, it's a much better situation for us emulator authors .Morkin wrote: ↑Mon Mar 25, 2019 1:06 pm Had a go at it, it's a nice game and very responsive considering it's written in BASIC. I didnt managed to see all the levels but broke into the game so I could see them, along with the victory screen..
So was it completely written on a Speccy? If so, the discussions about getting it to work on various emulators is quite funny, it's usually the other way round..
My ZX Spectrum emulator project: https://softspectrum48.weebly.com.
Re: I built a game in BASIC
Hehe the irony is not lost on me, editing a game built in a zx spectrum so it works on a zx spectrum emulator
I will make the inkey() change plus add recognition that you’ve set a new high score and there are a couple of bugs that I might try and solve. Won’t be able to do anything till next week though - sry.
Thanks again for all the positivity
I will make the inkey() change plus add recognition that you’ve set a new high score and there are a couple of bugs that I might try and solve. Won’t be able to do anything till next week though - sry.
Thanks again for all the positivity
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: I built a game in BASIC
Well, it’s not so much the fault of an emulator as one of the quirks of the Spectrum itself. Some emulators have an option of enabling or disabling the pre–Issue 3 Spectrum keyboard behavior; others don’t. In this instance, the game was (presumably) developed on a later 48K Speccy, which returns a different value of Bit 6 upon reading from port 254. As is, the game wouldn’t work on real Issue 1 and Issue 2 Spectrums either.
There were a bunch of commercial games that suffered from the same problem, so in that respect the game is as genuine as they come.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: I built a game in BASIC
Can't you just put something in the code to, e.g. do an IN on the title screen when no keys are pressed, then put that in a variable and then do something like key = var - IN xxxxx to work out the key being pressed? That way you don't lose the ability to move diagonally, as you do with INKEY$.
I think the use of keys B/N for left/right so they're in separate IN commands is clever, though you don't need to detect both of those pressed at once so O/P with the same IN isn't too hard.
It's a good game and very fast and responsive for BASIC. I did think about the suggestion of a penalty for missing a drop, but losing time is probably all the penalty you need. I do think the time limit is a bit tight though, especially as the third screen gets very crowded. You may have got too good at your own game while working on it!
I think the use of keys B/N for left/right so they're in separate IN commands is clever, though you don't need to detect both of those pressed at once so O/P with the same IN isn't too hard.
It's a good game and very fast and responsive for BASIC. I did think about the suggestion of a penalty for missing a drop, but losing time is probably all the penalty you need. I do think the time limit is a bit tight though, especially as the third screen gets very crowded. You may have got too good at your own game while working on it!
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: I built a game in BASIC
I don’t think the ship can move diagonally now, so, nothing is lost.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.