I wanted to try out Arrays so I created a new blank project (r60). On the start of the layout I'm trying to create a array by first setting the size and then i have a sub-event with a For each XY element that sets the value at CurX and CurY to 10+Random(5)
The above seems to have no effect. Nothings happen. It seems like all values in the array is 0... I'm not even sure the For Each XY element part is running at all...
What am I doing wrong? Or are arrays bugged in R60?
Develop games in your browser. Powerful, performant & highly capable.
I created an array for a path, but I didn't use CurX and CurY though. I just used a counter instead. I'm not sure on the best way to use CurX and CurY and CurValue.
I think I found the issue:
I was using random() when getting and setting values in the array... random returns a float value and it seems arrays accept them but then you just get weird or "blank" results... no errors or anything. It seems you have to keep this in mind when using arrays.
Forgot to add:
Mostly a actual error/crash of some kind is much better then silently ignoring a error. If array don't like float values for X, Y, Z I would much prefer if the runtime crashed when you try to use a float value. It's like creating a try/catch statement and then just leave the catch statement empty with no error handling = bad.
Edit: Ah, you CAN edit. :p
I fixed a bug with float values for array indices. However, in your project, the problem somehow seems to be that there are no instances of the Map array object. I suppose you deleted the layout you originally added the array to, but didn't delete the object type. Since it has no instances it essentially doesn't exist so you'll always get 0 for all the expressions on the object.
I'm not sure how to fix this! It seems to be an oversight in the editor. I'll see what I can do.