Hi, I'm trying to figure out how I got my pointers to point to typed arrays in the past, and it even let me use a regular typed variable (SETARRAY PortrtImgs(),Char(X).PortrtPointer) to store the location and I had a another array that set to this, but I can't get it to work from scratch, so I tried this instead: , anyhelp?
Gosh, I'm really rusty, so it's super embarrassing :P
It gives me "Array handle is invalid" or something along those lines, and yes I looked at help w/ F1.
type Tthisthing
Gabah
endtype
dim thisthing(20) AS Tthisthing
thisthing(0).gabah=2355
Makearray arraypointer()
setarray arraypointer(),getarray(thisthing().tthisthing)
arraypointer() is an integer array
thisthing().tthisthing is a type a array
[pbcode]
type Tthisthing
Gabah
endtype
dim thisthing(20) AS Tthisthing
thisthing(0).gabah=2355
Makearray arraypointer().tThisThing
setarray arraypointer(),getarray(thisthing().tthisthing)
print ArrayPointer(0).gabah
sync
waitkey
[/pbcode]
I know, I was wondering how to make an pointer to point at typed arrays, thanks
Why would you want to ?
Why not? Pointers can make everything nice and generalized
Well, what's stopping you ? Declare a pointer and assign it.
What was stopping me was pointing to a typed array, just it seems you helped me with that?
Dim MyPointer as MyType pointer
See Help ->About -> Types
Also,
See Projects->tutorials->types
Yes, I got it the gist of it in the second post, thank you very much Kevin.
This is what I originally wanted to do, and it works fine, except when it gets to changing enemy position X, Y, it says Apointer() pointer is not a defined typed array?:
PSUB Create_Enemy(CreateNumb,PosX,PosY)
`Save a multitude of redundant code lines by pointing to typed arrays, stream-lined.
SELECT CreateNumb
CASE 0
SETARRAY APointer().tPOINTToType,ECell(0).pointr
CASE 1
SETARRAY APointer().tPOINTToType,NEWENEMY(0).pointr
ENDSELECT
ThisNum=GETARRAYELEMENTS(APointer().tPOINTToType,1)+1
REDIM APointer(ThisNum) AS tPOINTToType
`HAVING TROUBLE HERE \/
`APointer(ThisNum).X#=PosX
`APointer(ThisNum).X#=PosY
ENDPSUB
otherwise I'd just do this if thats not possible, but makes it so I have to just add redundant code:
SELECT CreateNumb
CASE 0
ThisNum=GETARRAYELEMENTS(ECell().Enemystruct,1)+1
REDIM ECell(thisnum) AS Enemystruct
ECell(thisnum).X# = blah blah
CASE 1
ThisNum=GETARRAYELEMENTS(THISNewMonster().Enemystruct,1)+1
REDIM THISNewMonster(thisnum) AS Enemystruct
THISNewMonster(thisnum).X# = blah blah
CASE 2
ThisNum=GETARRAYELEMENTS(THISNewMonster2().Enemystruct,1)+1
REDIM THISNewMonster2(thisnum) AS Enemystruct
THISNewMonster2(thisnum).X# = blah blah
ENDSELECT
Sorry, but I'm really rusty :P
Or would it be EVEN better still if I just made all the enemies inside one array instead of creating lots of different arrays for each enemy type? I.e:
Type Tenemy
EnemyNum
thisX#,ThisY#, blahblah#
endtype
dim Enemy(A large number).Tenemy
then pick through their behaviors/animations/etc depending on their Enemy(X).EnemyNum?
See Type Collections (http://www.underwaredesign.com/forums/index.php?topic=1640.0)
thank you very much, kevin
That's pretty cool, will that work with version 1.47 and IDE 1.1.5F?
get up to date (http://www.underwaredesign.com/forums/index.php?topic=1182.msg13730#msg13730)
Which version do you recommend? I need working mapping/world "rays". Sorry to bother you so much :)
1.63g
Cool, so all the mapping/world stuffs was hooked back up again, eh?
they we're never removed.
ahh.. I get it now, you think 1.63 is the Dx7 update, it's just the old stock version. 1.69 is the current BETA of the rebuilt versions. They don't have maps etc
Ah, I see, I was thinking all the 1.6Xx versions had the stuff cut so they could be rebuilt. I see now.