Multiple Missiles

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Multiple Missiles

Post by MrVertigo »

I’ve become very confused trying to imagine how to make a ship that would fire multiple missiles in BASIC. If you could fire multiple missiles from one location, or from various locations as you moved left and right, how would you even keep track of them all to keep them travelling up the screen?
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Multiple Missiles

Post by dr beep »

make arrays where you keep coordinates and direction like this with max 5 simultaneously

dim y(5)
dim x(5)
dim d(5)

then in a loop add new or delete old missiles and move them

however I suspect that the game will become slow. better try coding assembler
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Re: Multiple Missiles

Post by MrVertigo »

Thank you! I was thinking an array must be involved somehow, but I couldn’t think how.

As you say, probably not something I’d use in the real world, but I just couldn’t think how it could be done.

When using machine code on the ZX81 would there be a limit to how many missiles and enemy missiles could be used simultaneously?
User avatar
Paul
Posts: 1517
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Multiple Missiles

Post by Paul »

Definitely not more than the number of characters per screen
768?
In theory, there is no difference between theory and practice. But, in practice, there is.
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Re: Multiple Missiles

Post by MrVertigo »

That would be a busy screen :D
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Multiple Missiles

Post by dr beep »

MrVertigo wrote: Mon Jul 17, 2023 12:23 pm Thank you! I was thinking an array must be involved somehow, but I couldn’t think how.

As you say, probably not something I’d use in the real world, but I just couldn’t think how it could be done.

When using machine code on the ZX81 would there be a limit to how many missiles and enemy missiles could be used simultaneously?
Speed will play a role then. It takes time to calculate the moving missiles.
Memory is another.

See LUNAPARK81. I move 20 persons in 1K
or better see my game where you must capture 20 moving dots to see about speed.
https://www.sinclairzxworld.com/viewtop ... ots#p49692
MrVertigo
Posts: 106
Joined: Fri May 27, 2022 9:06 pm

Re: Multiple Missiles

Post by MrVertigo »

I will study them with interest!
Post Reply