Array documentation
Maybe i've missed it in the documentation but there isnt much on how to use arrays in angelscript, multidimensional arrays, initializer lists, etc.
Any examples (using angelcode) how to use arrays?
I agree that the documentation is lacking. This is what I have so far:
Array's from the script language reference
In AngelScript multidimensional arrays work like arrays of arrays. Kind of like if you had declared a variable with type vector<vector<int>>
I'd like to add that I'm not too satisfied with the way arrays work in AngelScript, and I have plans to change this in the not so far future, but nothing is decided yet.
Array's from the script language reference
In AngelScript multidimensional arrays work like arrays of arrays. Kind of like if you had declared a variable with type vector<vector<int>>
I'd like to add that I'm not too satisfied with the way arrays work in AngelScript, and I have plans to change this in the not so far future, but nothing is decided yet.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Alright thanks.
Heres one of the NPC's i have in my game
Maybe in the next version you can make it so we can use initializer lists like that, instead of having to put it on the same line as int[] tiles; (because you cant set the value of classes property outside of a function)
EDIT: or even better would be to make it so you can set the classes properties outside of a function like this:
Heres one of the NPC's i have in my game
class SomeNpc{ float x; float y; float depth; int[] tiles; void OnCreate() { tiles = {0x0200, 0x0300, 0x0201, 0x0301}; } void OnDraw() { DrawTiles(tiles, x, y, 2, 2); //Draw a 2x2 block of tiles at x, y }}
Maybe in the next version you can make it so we can use initializer lists like that, instead of having to put it on the same line as int[] tiles; (because you cant set the value of classes property outside of a function)
EDIT: or even better would be to make it so you can set the classes properties outside of a function like this:
class SomeNpc{ float x = 32; float y = 64; float depth = 1; int[] tiles = {0x0200, 0x0300, 0x0201, 0x0301}; DoSomething(x, y); //Even calling functions would work :) void OnDraw() { DrawTiles(tiles, x, y, 2, 2); //Draw a 2x2 block of tiles at x, y }}
That's not a bad idea. I'll see what I can do.
Thanks,
Andreas
Thanks,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement