Page 1 of 1

Multiple Missiles

Posted: Mon Jul 17, 2023 3:31 am
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?

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 8:32 am
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

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 12:23 pm
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?

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 12:56 pm
by Paul
Definitely not more than the number of characters per screen
768?

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 1:56 pm
by MrVertigo
That would be a busy screen :D

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 2:58 pm
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

Re: Multiple Missiles

Posted: Mon Jul 17, 2023 3:51 pm
by MrVertigo
I will study them with interest!