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

Username:   Password: 
 RegisterRegister   
 Help with Randomize pics and difficulty settings
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shippuo23




PostPosted: Wed Apr 15, 2009 9:15 am   Post subject: Help with Randomize pics and difficulty settings

What is it you are trying to achieve?
I need to make a game where I have Pictures going down the screen and they must be pressed by a key before they hit the bottom of the screen

What is the problem you are having?
I need to randomize my pictures when they come down the screen and need help with the difficulty settings please help



Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


setscreen ("graphics")

var key : string
key := ""
process keys
    key := ""
    if hasch then
        key := getchar
        Input.Flush
    end if
end keys


procedure Monsta
    var Monsta : int := Pic.FileNew ("Monsta.bmp")
    for y : 200 .. 600
        Pic.Draw (Monsta, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "m"
                then
            cls
            exit
        end if
    end for
end Monsta

procedure Witch
    var Witch : int := Pic.FileNew ("Witch.jpg")
    for y : 200 .. 600
        Pic.Draw (Witch, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "w"
                then
            cls
            exit
        end if
    end for
end Witch

procedure ghost
    var ghost : int := Pic.FileNew ("ghost.jpg")
    for y : 200 .. 600
        Pic.Draw (ghost, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "g"
                then
            cls
            exit
        end if
    end for
end ghost

loop
    put "Do you want to play this Game?(y or n):" ..
    var reply : string (1)
    get reply
    if reply = "n" then
        exit
    elsif reply = "y" then
        cls
        put "Choose your difficulty(E, M, H)"
        var replydifficulty : string (1)
        get replydifficulty
        exit when replydifficulty = "l"
        if replydifficulty = "Easy" then
            if replydifficulty = "Moderate" then
                if replydifficulty = "Hard" then
                end if
            end if
        end if
    end if
    loop
        var menace : int := Rand.Int (1, 3)
        if menace = 1 then
            ghost
        elsif menace = 2 then
            Witch
        elsif menace = 3 then
            Monsta
        end if
    end loop
end loop




Please specify what version of Turing you are using
Sponsor
Sponsor
Sponsor
sponsor
Dusk Eagle




PostPosted: Wed Apr 15, 2009 3:32 pm   Post subject: Re: Help with Randomize pics and difficulty settings

Turing:

procedure Monsta
    var Monsta : int := Pic.FileNew ("Monsta.bmp")
    for y : 200 .. 600
        Pic.Draw (Monsta, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "m"
                then
            cls
            exit
        end if
    end for
end Monsta

procedure Witch
    var Witch : int := Pic.FileNew ("Witch.jpg")
    for y : 200 .. 600
        Pic.Draw (Witch, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "w"
                then
            cls
            exit
        end if
    end for
end Witch

procedure ghost
    var ghost : int := Pic.FileNew ("ghost.jpg")
    for y : 200 .. 600
        Pic.Draw (ghost, 250, (maxx - y), 0)
        delay (10)
        fork keys
        if key = "g"
                then
            cls
            exit
        end if
    end for
end ghost


Do you notice anything similar about these three procedures? The point of using procedures and functions is to prevent the need to copy and paste code. I believe it is critical that you read up on functions and procedures here.

As for the difficulty settings, what is it you want them to do exactly? If for example, you want harder difficulty levels to have your pictures scroll down the screen faster, think of a way to pass a certain speed into your one picture procedure, and have the picture fall accordingly. Be sure to use parameters, which you will learn about above. Good luck!
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: