Ok I've just made my Types for my BreakOut game. Got it to loop and create them.
Type Box Field X,Y,Alive End Type ;Box
For X = 30 To 60 Step 15
For Y = 15 To 150 Step 15
Box.Box = New Box
Box\X = X
Box\Y = Y
Box\Alive = 1
Next
Next
Then display them.
For Box.Box = Each Box ; Show Box
If Box\Alive = 1 Then DrawImage BoxFN,Box\Y,Box\X
Next
But using this code I've created myself. When a Object is hit, instead of it removing the one it hit. It removes the last object from memory created.
For Box.Box = Each Box
If Box\Alive = 1 And Ball\Direction = 4 And Box\X + ImageHeight(BoxFN) + 1 > Ball\X Then Ball\Direction = 3 : Box\Alive = 0 ; Bottom
If Box\Alive = 1 And Ball\Direction = 1 And Box\X + ImageHeight(BoxFN) + 1 > Ball\X Then Ball\Direction = 2 : Box\Alive = 0 ; Bottom
Next
How can I get it to remove the Object it hit. And not the last Object in the que?, Thank you all in advance.
Type Box Field X,Y,Alive End Type ;Box
For X = 30 To 60 Step 15
For Y = 15 To 150 Step 15
Box.Box = New Box
Box\X = X
Box\Y = Y
Box\Alive = 1
Next
Next
Then display them.
For Box.Box = Each Box ; Show Box
If Box\Alive = 1 Then DrawImage BoxFN,Box\Y,Box\X
Next
But using this code I've created myself. When a Object is hit, instead of it removing the one it hit. It removes the last object from memory created.
For Box.Box = Each Box
If Box\Alive = 1 And Ball\Direction = 4 And Box\X + ImageHeight(BoxFN) + 1 > Ball\X Then Ball\Direction = 3 : Box\Alive = 0 ; Bottom
If Box\Alive = 1 And Ball\Direction = 1 And Box\X + ImageHeight(BoxFN) + 1 > Ball\X Then Ball\Direction = 2 : Box\Alive = 0 ; Bottom
Next
How can I get it to remove the Object it hit. And not the last Object in the que?, Thank you all in advance.