Results 1 to 2 of 2

Thread: Flappy Bird Generating Tubes

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2015
    Posts
    1

    Flappy Bird Generating Tubes

    Hi, i'm making my own version of Flappy Bird. I have to generate tube that are different heights, but i was having trouble with generating them. Could anybody help me?Name:  Flappy-Birds.png
Views: 10376
Size:  52.2 KB
    Here is a picture for reference.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,687

    Re: Flappy Bird Generating Tubes

    I've personally never played the game, but I assume that they're just obstacles that the bird needs to avoid and that you have images that represent the tubes. If both assumptions are correct then you should create a collection(array, list, etc.) of bitmaps. That collection should store the various representations of the tubes. Finally use a Random object to generate a random number between 0 and the length of the collection(-1 for 0 based indices) and use that number to get the item by it's index:
    Code:
    Dim r As New Random
    Dim tubes() As Bitmap = {Tube1, Tube2, Tube3, Tube4}
    
    Private Function RandomTube() As Bitmap
        Dim index As Integer = r.Next(0, 4)
    
        Return tubes(index)
    End Function
    With that being said, I know that Jacob Roman has a codebank contribution of Flappy Birds in the Game Demos forum.

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