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

Username:   Password: 
 RegisterRegister   
 Need Some Help with Menu for my game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
neufelni




PostPosted: Thu Apr 28, 2005 2:04 pm   Post subject: Need Some Help with Menu for my game

I am making a mini golf game. I need some help with my menu. Here is the code:

code:

View.Set ("graphics:600;600,nocursor")
colourback (2)
cls

%Menu variables

%font variables
var font1 : int := Font.New ("Arial:20")
var font2 : int := Font.New ("Arial Black:30")
var font3 : int := Font.New ("Comic Sans MS:70")
var font4 : int := Font.New ("Comic Sans MS:30")

%variables for the triangle
var trix : array 1 .. 3 of int := init (418, 450, 418)
var triy : array 1 .. 3 of int := init (505, 495, 480)
var inputy : int := 310
var select : string (1)

%Menu
Font.Draw ("Welcome to ", 50, 550, font1, 7)
Font.Draw ("Nick Neufeld's ", 100, 500, font2, 7)
delay (1000)

for w : 1 .. 49
    Font.Draw ("MINI G   LF", 20, 375, font3, w)
    Draw.FillOval (410, 405, 40, 20, 7)
    Draw.FillOval (390, 390, 15, 15, white)
    Draw.ThickLine (420, 405, 420, 500, 5, darkgrey)
    Draw.FillPolygon (trix, triy, 3, 12)
    delay (20)
end for

%Menu Options
Font.Draw ("New Game", 150, 300, font4, 45)
Font.Draw ("Load Game", 150, 240, font4, 45)
Font.Draw ("View High Scores", 150, 180, font4, 45)
Font.Draw ("Help", 150, 120, font4, 45)
Font.Draw ("Exit", 150, 60, font4, 45)

%Selecting Options
loop
    Draw.FillOval (130, inputy, 9, 9, white)
    getch (select)
    if inputy = 70 then
        inputy := inputy - 0 
    elsif select = (KEY_DOWN_ARROW) then
        Draw.FillOval (130, inputy, 9, 9, green)
        inputy := inputy - 60
    elsif inputy = 310 then
        inputy := inputy + 0
    elsif select = (KEY_UP_ARROW) then
        Draw.FillOval (130, inputy, 9, 9, green)
        inputy := inputy + 60
    end if
    exit when select = (KEY_ENTER)
end loop
cls


Where would I place the:

if inputy = 70 then
inputy := inputy - 0

so that the ball does not go below the word exit and you can still move the ball.
Sponsor
Sponsor
Sponsor
sponsor
Token




PostPosted: Thu Apr 28, 2005 4:54 pm   Post subject: (No subject)

you had close to the right idea, what you had to do is make sure that the ball wasnt on the top or bottom one before moving it, you did that for the moving up, but it wouldent let it move up when it got to the bottom, so heres the fixed code.

code:

View.Set ("graphics:600;600,nocursor")
colourback (2)
cls

%Menu variables

%font variables
var font1 : int := Font.New ("Arial:20")
var font2 : int := Font.New ("Arial Black:30")
var font3 : int := Font.New ("Comic Sans MS:70")
var font4 : int := Font.New ("Comic Sans MS:30")

%variables for the triangle
var trix : array 1 .. 3 of int := init (418, 450, 418)
var triy : array 1 .. 3 of int := init (505, 495, 480)
var inputy : int := 310
var select : string (1)

%Menu
Font.Draw ("Welcome to ", 50, 550, font1, 7)
Font.Draw ("Nick Neufeld's ", 100, 500, font2, 7)
delay (1000)

for w : 1 .. 49
    Font.Draw ("MINI G   LF", 20, 375, font3, w)
    Draw.FillOval (410, 405, 40, 20, 7)
    Draw.FillOval (390, 390, 15, 15, white)
    Draw.ThickLine (420, 405, 420, 500, 5, darkgrey)
    Draw.FillPolygon (trix, triy, 3, 12)
    delay (20)
end for

%Menu Options
Font.Draw ("New Game", 150, 300, font4, 45)
Font.Draw ("Load Game", 150, 240, font4, 45)
Font.Draw ("View High Scores", 150, 180, font4, 45)
Font.Draw ("Help", 150, 120, font4, 45)
Font.Draw ("Exit", 150, 60, font4, 45)

%Selecting Options
loop
    Draw.FillOval (130, inputy, 9, 9, white)
    getch (select)

    if select = (KEY_DOWN_ARROW) and inputy > 120 then
        Draw.FillOval (130, inputy, 9, 9, green)
        inputy := inputy - 60
    elsif select = (KEY_UP_ARROW) and inputy < 310 then
        Draw.FillOval (130, inputy, 9, 9, green)
        inputy := inputy + 60
    end if
    exit when select = (KEY_ENTER)
end loop
cls
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  [ 2 Posts ]
Jump to:   


Style:  
Search: