Wednesday, March 5, 2014

Flappy Ball

# Minimalist version of flappy bird, Work in progress
# Click to jump
graphsize 600,400
fastgraphics
Dim obstaclehight(10)
birdy=200
dy=-1
lifes=3

for level = 1 to 5
  # Generate obstacles
   for n = 0 to 9
     obstaclehight[n] = 150+ int(rand*(10+40*level))-20*level
   next n
   # restart point after losing a life
   start:
   # End game code
   if lifes = 0 then
       color black
       font "arial",50,50
       text 50,50,"End"
       refresh
       end
   end if
   pause 1
   # Running code
   for x = 1 to 2200 step 1
       color yellow
       rect 0,0,600,400
       color black
       font "arial",50,50
       text 50-x,50,"Level:"+(level)
       if level < 5 then text 2200-x,50,"Level:"+(level+1)
       if level = 5 then text 2200-x,50,"End"
       # Drawing columns
       for n = 0 to 9
          color darkgreen
          rect 300+n*200-x,0,50,400
          color yellow
          rect 300+n*200-x,obstaclehight[n],50,100
         # Ball death
           if 300+n*200-x=50 or 300+n*200-x=0 then
               if birdy < obstaclehight[n] or birdy > obstaclehight[n]+100 then
                  lifes=lifes-1
                   goto start
                end if
            end if
         next n
   # Ball draw
   color red
   circle 50,birdy,10
   color white
   circle 52,birdy-2,3
   color black
   circle 53,birdy-2,2
   rect 56,birdy+2,5,3
   color black
   font "arial",20,100
   text 10,10,"Lifes"+lifes
   # Movement
   birdy=birdy+dy
   dy=dy+.015
   if clickx>0 then dy=-1
   clickclear
   refresh
  next x
next level
end

6 comments:

  1. Nice.... Like the blog, just shows what you can do with basic!

    I made a small change ...added a line between 44 and 45

    say "Aaargh!"

    So when you die you get some feedback.. Going to have to look at the rest of the program work out how it does the rest of what it does...

    ReplyDelete
  2. Aha, I see how you print the level, have changed that sub so it also prints a score...

    Added these lines in after between the two end if originally on lines 46 & 47:

    score = score + 1
    print "score = " + score

    After setting score up as 0 in the first section (where you originally defined your variables).

    then added this line in the #Ball draw section

    text 400,10,"Score: " + score

    I have thoughts about how to make levels more difficult as the "bird" continues.

    ReplyDelete
  3. Flappy Bird game has been removed from the google play store, you can download the Flappy bird .apk file directly from the link given below and simply install on your android device or tablet.

    ReplyDelete
  4. What file do we save as

    ReplyDelete
  5. I could not agree at all with the opinions of other friends who are certainly very useful for me Obat Darah Tinggi

    ReplyDelete

  6. Retro-Style Gameplay. With a hint of Space Invaders the gameplay is reminiscent of old school games. You move Stanley left and right to counter-attack the never ending waves of vicious enemies. The gun auto-shoots so your only task is to coordinate your eye-finger movement and avoid being touched.
    Flappy Bird
    Flappy games
    Flappy Attack

    ReplyDelete