How To

How do you use arrays

2

TrashCan Games 2020-01-13 13:02

The help forum on arrays isn’t really helping me and I’ve needed to use it for a long time now


Timo 2020-01-13 16:00

Do you mean the chapter "Arrays" in "BASIC Tutorial for Beginners" is not helping? What is unclear?


was8bit 2020-01-13 19:26

The easiest way is to see your own work redone with arrays... it should work instantly... if not, please post any questions :)


was8bit 2020-01-13 19:54 (Edited)

Also, posted a remix version with cars that try to hit the runners ;)

Did not have to use arrays for moving the cars ;)

Had to use arrays to adjust runner position when hit...

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


TrashCan Games 2020-01-14 02:18

Thanks I kind of get it now after looking at my own game using arrays


was8bit 2020-01-14 02:28

It does help seeing the same written one way, then the other way :)

Easiest way is to see it as...

X1
X2
X3

Is the exact same as
X(1)
X(2)
X(3)

Only difference is that usually loops help process them ...

FOR I=1 TO 3
X(I)=8
NEXT I

Which is the exact same as

X(1)=8
X(2)=8
X(3)=8


TrashCan Games 2020-01-14 02:33

Yeah I figured that out I just programmed a little program using arrays


was8bit 2020-01-14 02:39

I also used a special way to load data that takes up less space...

FOR I=1 TO 5
READ RY(I)
NEXT I
DATA 8,24,40,56,72

Is exactly the same as ...
RY(1)=8
RY(2)=24
RY(3)=40
RY(4)=56
RY(5)=72

The DATA is READ in order ...


Log in to reply.