selecting a particular type.

Blitz3D Forums/Blitz3D Programming/selecting a particular type.

Pongo(Posted 2009) [#1]
I'm using types To move some things about, but I'm having a small issue I need help with.

First, I create the types

Type box
Field label
End Type

a.box = New box
a\label = "Box A"
b.box = New.box
b\label = "Box B"
c.box = New box
c\label = "Box C"


Now I assign an "active" To one of the types.
active.box = a.box


This all works, since I can do this.
For loop = Each box
	Print loop\label$
Next

Print

Print active\label$


Now,... I want To be able To change the "Active" To a different Type.

For loop = Each box
	If MouseHit(1)
		If ImagesCollide (cursor,MouseX(),MouseY(),0,boximage,loop\xpos,loop\ypos,0)
			active.box = loop
		EndIf
	EndIf
Next


This does not appear to work though. The "active" type never changes.


Ross C(Posted 2009) [#2]
Shouldn't this be:

For loop.box = Each box
	If MouseHit(1)
		If ImagesCollide (cursor,MouseX(),MouseY(),0,boximage,loop\xpos,loop\ypos,0)
			active.box = loop.box
		EndIf
	EndIf
Next



Pongo(Posted 2009) [#3]
yea,... I missed that.

I had a problem with my imagescollide statement too. The types were working properly all along.

I've got it sorted now.