Work in Progress

Space Invaders

4

Tinycloud778 2019-06-20 20:58 (Edited)

I’m trying to recreate the original space invaders

Credits:
Thanks to Timo for helping me with some loops
And Was8bit for some explanation of some loops

Space Inavders.nx | Open in app
2019-06-25 18:07
Space Inavders.nx | Open in app
2019-06-24 18:47

was8bit 2019-06-20 23:26

Looking nice :)


Tinycloud778 2019-06-21 01:54

Thanks


was8bit 2019-06-21 16:31

Oooo... cool :)


Tinycloud778 2019-06-21 16:55

Thanks, if you have any ideas on how to delete enemies after they’ve been hit please leave a suggestion


Tinycloud778 2019-06-21 20:21

Don’t worry I already found a solution


was8bit 2019-06-22 06:51

Looking good :)


Tinycloud778 2019-06-22 15:20

Thanks


Timo 2019-06-23 11:07

I looked at your code and it's a perfect example for replacing a lot of repeated code with FOR loops and arrays. Do you have questions about my tutorial?

Here an example for a FOR loop. This is a part of your code:

IF SPRITE HIT(15,2) THEN
SPRITE OFF 2
BX=-10
END IF

IF SPRITE HIT(15,3) THEN
SPRITE OFF 3
BX=-10
END IF

IF SPRITE HIT(15,4) THEN
SPRITE OFF 4
BX=-10
END IF
...

It's the same code with different numbers. This can be improved with a FOR loop:

FOR I=2 TO 14
IF SPRITE HIT(15,I) THEN
SPRITE OFF I
BX=-10
END IF
NEXT I

This already handles all sprites from number 2 to 14 :)


was8bit 2019-06-23 11:23 (Edited)

When I first encountered LOOPS and ARRAYS, the whole concept was very confusing... it just takes getting used to them.. much like getting used to CALCULUS... I felt like I was hitting my head against the wall for months.. until one day it just went *BING* in my mind, and I got it ;) .... (that is, i finally understood HOW they work)


Tinycloud778 2019-06-24 18:42

For now arrays, DIM, and loops are a little confusing to me but i'll learn how to use them

:)


Tinycloud778 2019-06-24 18:44

also thanks for the help, i'll add the FOR loop in the next version


was8bit 2019-06-24 20:47

I’ll post something later... :)


was8bit 2019-06-25 05:54

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

Both of these are identical..

One method is manually repeating similar things ( as in alien1, alien2)
The other method uses DIM and arrays with loops (as in alien(I))

Since both of my programs are practically identical, this will allow you to compare how the manual method works and maybe help you figure out how the array method works :)


was8bit 2019-06-25 05:56 (Edited)

I also “cheated” abit and used a SUB for both.... hopefully this will show you how powerful and useful a well written SUB can be :)


Tinycloud778 2019-06-25 18:07

Thanks


Timo 2019-06-25 19:03

Nice, starts to be really playable :)


Tinycloud778 2019-06-25 21:01

Thank you


was8bit 2019-06-25 23:38

Glad to help


Log in to reply.