Work in Progress

Work in progress

0

Tinycloud778 2019-08-23 19:58

I’m trying to make a structure to my programs and tried to do DIM again, I was doing well until I encountered this bug where when a bullet is moving if you shoot another bullet the old bullet will stop and the new one will start moving, why does this happen

Bug Hunter.nx | Open in app
2019-08-23 19:58

was8bit 2019-08-24 04:13

See if you can figure out what I did :)

It’s abit advanced... you have to make your bullets programable...

Bug Hunter Remix.nx | Open in app
2019-08-24 04:13

was8bit 2019-08-26 07:28

Each variable begins with “B” meaning Bullet..

bx,by is bullet pixel position
bdx,bdy is bullet direction of movement
bi is Index, used to indicate it bullet is in use (activated) or not
bs is Sprite# or cell image the bullet will use...

When you make a request to fire a bullet, the SUB checks to see if their is an available bullet (one not being used) and if so, choose the first available bullet and set it up and activate it.,

The DRAW SUB checks all possible bullets, and for any bullet that is active it draws it (sprite#=10+bullet#) it also is responsible for deactivating a bullet that moves off the screen...


was8bit 2019-08-26 07:30

Once a bullet is deactivated, it is now able to be used again... this method limits player to what’re number of total bullets you programmed for... in this case, 6 (0-5) are available... if you have 6 active bullets on the screen, player won’t be able to fire any more until a bullet gets deactivated....


was8bit 2019-08-26 07:32 (Edited)

I have a bullet example program here :)

https://lowresnx.inutilis.com/topic.php?id=334

If bullets are sprites, then you can have a maximum of 64 bullets... this example has 60 available simultaneous bullets...

Tap the screen to adjust the random factor... with a single digit you almost use all 60 bullets at once :)

The numbers up top record each of the 60 available bullets,.. 0=available, 1=in use... most of the early ones are used constantly as the check loop starts looking for available bullets starting at the top of the list...


was8bit 2019-08-26 07:40

Remember, bx(0) is the same as manually typing bx0 and bx(1) as bx1

Just like bx0 and bx1 are 2 different variables, bx(0) and bx(1) are two different variables...


Tinycloud778 2019-08-26 15:56

Ok thanks


Log in to reply.