Results 1 to 10 of 10

Thread: help in animation game

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    27

    Cool help in animation game

    My friend is making a duck hunt game. He went through the process of making the for statements to move the duck(s) around. He wants to know how to have it done randomely, with a different pattern of movement each time.

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217

    Re: help in animation game

    What is your question?
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: help in animation game

    We really can't help with that until we see some of the code he already has.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    27

    Cool Re: help in animation game

    Option Explicit
    Dim x As Integer, y As Integer, c As Integer
    Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)

    Private Sub command1_click()
    Do
    Command1.Visible = False
    imgbird.Visible = True
    x = 1000
    For y = 125 To 8000 Step 10
    imgbird.Top = y - 50
    imgbird.Left = x
    x = x + 16
    Sleep 1
    DoEvents
    Next y
    c = c + 1
    For y = 8000 To 125 Step -10
    imgbird.Top = y + 50
    imgbird.Left = x
    Sleep 1
    DoEvents
    Next y
    For y = 125 To 8000 Step 10
    imgbird.Top = y + 50
    imgbird.Left = x
    x = x - 19
    Sleep 2
    DoEvents
    Next y
    Loop While c < 4
    End Sub
    Private Sub birdisdead()
    imgdead.Visible = True
    imgbird.Visible = False
    Dim deadbird As Integer
    For deadbird = y To 11100 Step 20
    imgdead.Top = deadbird
    imgdead.Left = x
    Sleep 4
    DoEvents
    Next deadbird
    End Sub

    Private Sub Form_Load()
    Form1.BackColor = vbBlack
    'c = 0
    End Sub

    Private Sub imgbird_Click()
    birdisdead
    imgbird.Visible = False
    End Sub

  5. #5
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217

    Re: help in animation game

    Next time use vbcode tags.

    Any you still haven't told us what the problem is.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  6. #6
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: help in animation game

    He wants the bird to move in a random direction every time

  7. #7
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: help in animation game


  8. #8
    Junior Member
    Join Date
    Apr 2004
    Location
    Holland
    Posts
    22

    Re: help in animation game

    you could place the duck image in a frame, and put this code in a timer.

    VB Code:
    1. Randomize
    2.  
    3. imgDuck.Left = Int((Frame1.Width - imgDuck.Width + 1) * Rnd)
    4. imgDuck.Top = Int((Frame1.Height - imgDuck.Height + 1) * Rnd)

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    27

    Talking Re: help in animation game

    My friend is making a duck hunt game. For one level, he wants multiple birds to fly out on the screen in random directions (as well as random birds). Any help would be appreciated.
    Thanks guys

  10. #10
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: help in animation game

    Read your other post, this is a dual post!!
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Posting Permissions

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



Click Here to Expand Forum to Full Width