Type Array Trixx
Blitz3D Forums/Blitz3D Programming/Type Array Trixx
| ||
Hello there... im totally new to blitz but have mr. Fredborg in my class to assist me, but should not drain once source :)... Im having a problem with understanding type vs. array's, normally im using Lingo or proccesing.. and i want to make a object that holds a cube objecs, some x,y,z stuff and so on, all in diff variables types.. BUT.. im not that found of having to run through the hole type just to alter on object 954'... I would love to do something like this obj[954].x = 5..... yes array's of more dimmentionls are good, but ran into a problem with having a createCube() plus float points in the same array.. ? guess to have a pointer for a object you need an integer.. ?? so my greate idea was to make a type... and do something like this.. dim objArray(1000) type obj field pointer field x#, y#, z# end type for 1 = 1 to 1000 objArray(i).obj = new obj ; inspired from player1.obj = new obj next but had no luck doing so...... is there anyway to do something like this, or a better way to organise many objects and having an easy way to alter just one... Have one idea. to make a function that run's through all the type's until it finds the one we are looking for (by and ID number), what is fastest array's or types???... Thanks in advanced, andgreatings to everyone in here, love that blitz speed. :) Mads Ny |
| ||
Hey Mads :) Use: Dim objArray.obj(1000) for i = 0 to 1000 objArray(i) = New obj ...and it should work! |
| ||
Just out of curiosity does anyone know if it would be faster to iterate through all type instances using for p.obj = each obj / next or just ... for l=0 to 10:do_something_with( objarray(l) ):next ? I guess I should try it myself ... |
| ||
Thanks Fredborg.. :)... im in the game now... with a payed version and all... and YES it works, im super happy, I can do... ObjArray(60)\x :))))) that's so nice.. thnks again.. Mads Ny |