A83: Re: Galaxian algorithm


[Prev][Next][Index][Thread]

A83: Re: Galaxian algorithm




Heh, I should write a tutorial on this.

Basically, you create an array of bullets.  You need to store the
coordinates, direction traveling, type, etc.  Depends what you're doing.
Oh, but this is asm, no arrays.  Doesn't matter.  You set asside memory the
size of the array you need.  You create an update loop, and run through all
of them.  Have a byte or bit to determine if they are active.  If they are,
update them.  If you have different types that do different things, you
might need to setup a jump table to the routine to update that specific one,
just like in any OOP programming lanuage (pass the routine a pointer to the
bullet in the array).  When adding one, loop through the array, and find an
inactive or empty spot, and add it.  Simple.  Set them all to inactive in
the beginning of the game or whatever.  To delete one, set it to inactive.

This is the easiest way to do bullets.  If you need an example of a jump
table, I can provide one.

> I'm having a little trouble figuring out how does Galaxian handle the
> bullets, move so many sprites and keep track of them. I could figure out
the
> source more easily if I knew the basic idea behind the code. Anyone care
to
> help? Patrick Davidson, perhaps, if you're on this list? =)
>
> From: Chris (Man in the Moon)




References: