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

Username:   Password: 
 RegisterRegister   
 Need help with turing game menu
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shamoy




PostPosted: Wed May 07, 2014 4:45 pm   Post subject: Need help with turing game menu

So im making a game in turing and im using loops, if statements, and mousewhere for a flat design button. The only problem is that when I press the button and let go, it doesnt take me to the next part of the program. Can anyone help me on this? Thanks ^_^


Game.zip
 Description:

Download
 Filename:  Game.zip
 Filesize:  895.58 KB
 Downloaded:  141 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Wed May 07, 2014 9:16 pm   Post subject: RE:Need help with turing game menu

Correct me if I'm wrong, but it doesn't look like there is a next part of the program. This is all I have in the main loop:

Turing:

loop

    mousewhere (mouseX, mouseY, button)

    delay (6)

    if mouseX > 415 and mouseX < 865 and mouseY > 170 and mouseY < 425 and button = 0 then

        delay (1)

        Pic.Draw (hoverButton, 0, 0, picCopy)

        delay (1)

    elsif button = 1 and mouseX > 415 and mouseX < 865 and mouseY > 170 and mouseY < 425 and button = 1 then

        delay (1)

        Pic.Draw (pressedButton, 0, 0, picCopy)

        delay (1)

    else

        delay (1)

        Pic.Draw (unpressedButton, 0, 0, picCopy)

        delay (1)

    end if

end loop
TWizard




PostPosted: Thu May 08, 2014 2:18 pm   Post subject: RE:Need help with turing game menu

The question now is, where do you want the next part to be? you will need to create another menu image, and type out more positions for the menu items you want to have.
Shamoy




PostPosted: Thu May 08, 2014 4:14 pm   Post subject: Re: Need help with turing game menu

my plan is to display another picture when the game starts but i dont know what to do to make it exit the loop after i click it and let go
Raknarg




PostPosted: Thu May 08, 2014 4:38 pm   Post subject: RE:Need help with turing game menu

Maybe keep track of the clicking state. If It was clicking in the previous frame, but now it is not, then you know the user has clicked the button.

Turing:

loop
    if isClicking() then
        clicking := true
    elsif clicking then
        clicked := true
        clicking := false
    end if

    if clicked then
        clicked := false
        %do domething
    end if
end loop
Shamoy




PostPosted: Sat May 10, 2014 10:16 am   Post subject: Re: Need help with turing game menu

how would i be able to integrate that into my code though?
Shamoy




PostPosted: Sat May 10, 2014 2:06 pm   Post subject: Re: Need help with turing game menu

so i updated it and wanted to see if i could make it exit this way but the problem is that after i click it, i want it to exit when i let go of it (not when i directly click it)

code:
% Looping to display different button images

loop

    mousewhere (mouseX, mouseY, button)

    delay (6)

    if mouseX < 415 and button = 0 or mouseX > 865 and button = 0 or mouseY < 170 and button = 0 or mouseY > 425 and button = 0 then

        delay (1)

        Pic.Draw (unpressedButton, 0, 0, picCopy)

        delay (1)

    elsif mouseX > 415 and mouseX < 865 and mouseY > 170 and mouseY < 425 and button = 0 then

        delay (1)

        Pic.Draw (hoverButton, 0, 0, picCopy)

        delay (1)


    elsif mouseX > 415 and mouseX < 865 and mouseY > 170 and mouseY < 425 and button = 1 then

        loop

            delay (1)

            Pic.Draw (pressedButton, 0, 0, picCopy)

            if mouseX > 415 and mouseX < 865 and mouseY > 170 and mouseY < 425 and button = 0 then

                delay (1)

                Pic.Draw (unpressedButton, 0, 0, picCopy)

                delay (150)
               
                clicked := true
               
            end if

            exit when clicked = true
           
        end loop

    end if

    exit when clicked = true

end loop

% Next part
[/url]
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  [ 7 Posts ]
Jump to:   


Style:  
Search: