Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help me get this shooting program working!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wk1989




PostPosted: Thu Jun 02, 2005 9:54 pm   Post subject: Help me get this shooting program working!

I want it so that each time a user clicks and releases the mouse button over one of the balloons he gets 1 point, the program exits when he gets 20 points. The parts in my program work by themselves, but when i put together, they just stop working! Help me!!!

code:

setscreen ("graphics:1000;650,offscreenonly")
var numberOfBalloons, balloonX, balloonY, balloon1X, balloon1Y, score,increase : int

%Balloon1 procedure.
balloon1Y := 130
balloon1X := 30
balloonX := 12
balloonY := 30
score := 0
  var mouseX, mouseY, mouseB : int
 
 
procedure increaseScore
score := score+1
end increaseScore
procedure balloon1


    for rising : 1 .. 5

        randint (balloonX, 1, maxx)
        randint (increase, 5, 40)
        drawfilloval (balloon1X, balloon1Y, 50, 50, blue)
        drawline (balloon1X, balloon1Y - 50, balloon1X, balloon1Y - 150, black)

        if balloon1Y > maxy then
            balloon1Y := 25
        end if
        balloon1Y := balloon1Y + 50
        randint (balloon1X, 1, maxx)


        %Second balloon
        randint (balloonX, 50, 500)

        randint (increase, 5, 40)
        drawfilloval (balloonX, balloonY, 50, 50, 3)
        drawline (balloonX, balloonY - 50, balloonX, balloonY - 150, black)

        if balloonY > maxy then
            balloonY := 15
        end if
        balloonY := balloonY + increase

        View.Update
        delay (1500)
        cls
       
        %Checks if hit or miss

          if mouseB not= 0 and whatdotcolor (mouseX, mouseY) not=0 then
         
        drawfillbox (0,0,maxx,maxy, black)
         delay (100)
         View.Update
       
   
increaseScore
     
       
    end if
    end for
end balloon1


loop
    mousewhere (mouseX, mouseY, mouseB)
    put mouseX, mouseY, mouseX, mouseB
    delay (100)
 
    balloon1

   
 put score
 exit when score>5
end loop


Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: