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

Username:   Password: 
 RegisterRegister   
 Can anyone help with my game?!??
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
blaze423




PostPosted: Thu Jun 05, 2008 7:00 pm   Post subject: Can anyone help with my game?!??

This is part of my code. There are two pictures of cars and I used the mousewhere command to make the pictures kind of like buttons. So when the user clicks on either car , it will go to display (the actual game part) . But I want the car that they pressed to appear on to display but I can't seem to do that.
Can anyone help and give some advice to make it better???? Smile


Turing:

import GUI
setscreen ("nocursor") %Hides cursor
setscreen ("noecho")

%Declaration Section
var mainButton, quitButton, playButton, rulesButton : int := 0
var font2 := Font.New ("Batang:20")
var font4 := Font.New ("Arial:16")
var mainWin := Window.Open ("position:300;300, graphics:640;400") %The main window.
var pictureID, pictureID2 : int
var item : array 1 .. 2 of int
item (1) := (pictureID)
item (2) := (pictureID2)
var picHeight, picHeight2, picWidth, picWidth2 : int





proc input
    title
    var rangeX, rangeY, button : int := 0
    Font.Draw ("Pick your car...", 100, 300, font4, 7)
    pictureID := Pic.FileNew ("car1.jpg")
    pictureID := Pic.Scale (pictureID, 250, 200)
    Pic.Draw (pictureID, 25, 100, picMerge)
    pictureID2 := Pic.FileNew ("car2.jpg")
    pictureID2 := Pic.Scale (pictureID2, 250, 200)
    Pic.Draw (pictureID2, 400, 100, picMerge)
    GUI.Hide (playButton)
    GUI.Hide (rulesButton)
    GUI.Show (mainButton)
    loop
        mousewhere (rangeX, rangeY, button)
        if button = 1 then
            if rangeX >= 25 and rangeX <= 25 + picWidth and rangeY >= 100 and rangeY <= 100 + picHeight or rangeX >= 400 and rangeX <= 400 + picWidth2 and rangeY >= 100 and rangeY <= 100 + picHeight2
                    then
                introduction
                item (1) := pictureID
            end if
        end if
        exit when button = 1
    end loop
end input

proc display
    picHeight := Pic.Height (pictureID)
    picWidth := Pic.Width (pictureID)
    picHeight2 := Pic.Height (pictureID2)
    picWidth2 := Pic.Width (pictureID2)
    if item (1) = (pictureID) then
        pictureID := Pic.FileNew ("car1.jpg")
        pictureID := Pic.Scale (pictureID, 250, 200)
        Pic.Draw (pictureID, 25, 100, picMerge)
    end if
    if item (2) = (pictureID2) then
        pictureID2 := Pic.FileNew ("car2.jpg")
        pictureID2 := Pic.Scale (pictureID2, 250, 200)
        Pic.Draw (pictureID2, 400, 100, picMerge)
    end if
 

end display



%Buttons
mainButton := GUI.CreateButton (270, 50, 100, "Main Menu", menu)
quitButton := GUI.CreateButtonFull (275, 100, 100, "Quit", GUI.Quit, 0, KEY_ESC, false)
rulesButton := GUI.CreateButton (275, 150, 100, "Rules", rules)
playButton := GUI.CreateButton (275, 200, 100, "Play", input)

%Main Program
introduction
loop
    exit when GUI.ProcessEvent     %Exits when the user presses the quit button
end loop
goodbye
%end program


MOD EDIT: Remember your syntax tag!
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Fri Jun 06, 2008 6:25 am   Post subject: Re: Can anyone help with my game?!??

Would be nice to have these pictures to use. Please upload them.
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: