[RESOLVED] Diffrente pictures in a growing array
I'v come across a weird problem.
I'm still working on my Slug(snake) game, but i'v come to yet another impass.
My slug ofc is growing when it hits a "food" and it copyes the Snakejoint(0) to the next joints.
Is there a way to force it to copy let's say SnakeJoint(1)?
Snake Creation the snake starts with 3 joints and two slime trails. The slime trails we'll ignore for starters.
Code:
For i = 0 To 3 Step (1)
SlangeLed(i).Left = (120 - 10 * i)
SlangeLed(i).Top = 120
Next i
Finding food and growing a joint
Code:
Public Sub Findfood()
'Adds joint after eating a food
If SnakeJoint(0).Left = Picturefood.Left And SnakeJoint(0).Top = Picturefood.Top Then
Load SnakeJoint(længde)
SnakeJoint(længde).Visible = True
wmp2.URL = "Sounds\Effects\nom.wav"
Call Placefood
længde = længde + 1
'Adds points when a food is eaten
Point1 = Point1 + 10
point3 = point3 + Point1
ScoreTal.Caption = point3
End If
End Sub
Anything else you need from the code let me know.
Re: Diffrente pictures in a growing array
After loading new control (SnakeJoint), you can then manipulate the properties, i.e.,
Code:
...
Load SnakeJoint(lengde)
Set SnakeJoint(lengde).Picture = SnakeJoint(1).Picture
... set other properties as needed
Re: Diffrente pictures in a growing array
to make it simple for yourself,
create all pieces when you start the program.
with that you don't need to use "Load" or "Unload" at all.
of course you need to have a lot of pieces or set a "max" amount of length the snake can be.
all pieces can be assigned pictures too.
then when you play, you only need to make the pictures visible or invisible and the .left/.top properties.
Re: Diffrente pictures in a growing array
Code:
Set SnakeJoint(lengde).Picture = SnakeJoint(1).Picture
So easy and I dittent see it.
Can't see the forest for the trees.
Thank you Sir, you made me a very happy homer.