TYPES

Blitz3D Forums/Blitz3D Beginners Area/TYPES

MIKEYFYN(Posted 2003) [#1]
I AM QUITE NEW TO BLITZ, I UNDERSTAND THE USEFULNESS OF TYPES BUT CAN SOMEONE TELL ME IF I CAN DO THE FOLLOWING

IF I HAVE A TYPE CALLED WORM WITH FIELDS WORMS\X,WORMS\Y,WORMS\DIRECTION ETC
CAN I TRANSFER THE 'FIRST' VALUE OF WORMS\DIRECTION TO THE SECOND WORMS\DIRECTION WITHIN THE EACH WORMS LOOP. IF SO PLEASE TELL ME HOW.

THANKS
MIKEYFYN


GfK(Posted 2003) [#2]
You could use an array.
Dim Worm.worm(5)

For N = 0 to 5
  Worm(N) = New Worm
Next

Worm(1)\X = Worm(0)\X
Worm(1)\Y = Worm(0)\Y

You could also give your CAPS LOCK key a press. Typing everything in capitals on the net is considered to be shouting/rude.


darklordz(Posted 2003) [#3]
yea...


MIKEYFYN(Posted 2003) [#4]
no offence intended thanks for the help. I will give it a try.


FlameDuck(Posted 2003) [#5]
CAN I TRANSFER THE 'FIRST' VALUE OF WORMS\DIRECTION TO THE SECOND WORMS\DIRECTION WITHIN THE EACH WORMS LOOP.
Yes. You don't even need a for-each loop. Witness
Type mytype
	Field a,b,c
End Type

m.mytype = New mytype
m\a = 1
m\b = 2
m\c = 3

m.mytype = New mytype
m\a = 4
m\b = 5
m\c = 6

m=First mytype
n.mytype = After m

n\a = m\a

Print n\a

WaitKey
You can ofcourse do it itteratively aswell.


MIKEYFYN(Posted 2003) [#6]
Many thanks for the snippet of code and your help

Mikeyfyn