[RESOLVED] Diffrente pictures in a growing array-VBForums
Results 1 to 4 of 4

Thread: [RESOLVED] Diffrente pictures in a growing array

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2014
    Posts
    21

    Resolved [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.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    16,716

    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Hyperactive Member
    Join Date
    Dec 2014
    Posts
    336

    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.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2014
    Posts
    21

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.