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

Username:   Password: 
 RegisterRegister   
 DDR -- help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ladum




PostPosted: Fri May 29, 2009 10:05 pm   Post subject: DDR -- help

What is it you are trying to achieve?
a ddr game


What is the problem you are having?
having the arrows randomly come up, with multiple arrows on the screen at one... instead of just one at a time

Describe what you have tried to solve this problem
make an array, start the arrows at different points... an

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
this just has the arrow coming up the screen one at a time

Turing:


loop
for y:1..6
arrows(y):=Rand.Int(-70,-50)


    %Choose a random arrow
    arrow := Rand.Int (1, 4)

    %up arrow
    if arrow = 1 then
        Sprite.Show (sup)

        %Move the sprite up
        for i :arrows(y).. maxy + 50 by 3

            %Detects if person hits the arrow key
            Input.KeyDown (chars)
            if i > 855 and response not= 1 then
                Sprite.Hide (perfect)
                Sprite.Show (boo)
            elsif chars (KEY_UP_ARROW) and i > 825 and i < 850 then
                Sprite.Hide (sup)
                Sprite.Show (perfect)
                response := 1

            end if

            Sprite.SetPosition (sup, 400, i, true)
            delay (1)
            View.Update

        end for




        %down arrow
    elsif arrow = 2 then
        downm := Pic.FileNew ("downarrow .bmp")
        downm := Pic.Scale (downm, 100, 100)
        sdown := Sprite.New (downm)
        Sprite.Show (sdown)

        for i : arrows(y) .. maxy + 50 by 3
            Input.KeyDown (chars)
            if i > 855 and response not= 1 then
                Sprite.Hide (perfect)
                Sprite.Show (boo)
            elsif chars (KEY_DOWN_ARROW) and i > 825 and i < 850 then
                Sprite.Hide (sdown)
                Sprite.Show (perfect)
                response := 1
            end if
            Sprite.SetPosition (sdown, 275, i, true)
            delay (1)
            View.Update
        end for


        %left arrow
    elsif arrow = 3 then

        Sprite.Show (sleft)

        for i : arrows(y) .. maxy + 50 by 3
            Input.KeyDown (chars)
            if i > 855 and response not= 1 then
                Sprite.Hide (perfect)
                Sprite.Show (boo)
            elsif chars (KEY_LEFT_ARROW) and i > 825 and i < 850 then
                Sprite.Hide (sleft)
                Sprite.Show (perfect)
                response := 1
            end if
            Sprite.SetPosition (sleft, 150, i, true)
            delay (1)
            View.Update
        end for


        %right arrrow
    elsif arrow = 4 then
        rightm := Pic.FileNew ("right arrow.bmp")
        rightm := Pic.Scale (rightm, 100, 100)
        sright := Sprite.New (rightm)
     
        Sprite.Show (sright)

        for i : arrows(y) .. maxy + 50 by 3
            Input.KeyDown (chars)
            if i > 855 and response not= 1 then
                Sprite.Hide (perfect)
                Sprite.Show (boo)
            elsif chars (KEY_RIGHT_ARROW) and i > 800 and i < 830 then
                Sprite.Hide (sright)
                Sprite.Show (perfect)
                response := 1
            end if
            Sprite.SetPosition (sright, 525, i, true)
            delay (1)
            View.Update
        end for

    end if
    response := 0
    Sprite.Hide (perfect)
    Sprite.Hide (boo)
    end for
end loop





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




PostPosted: Fri May 29, 2009 10:27 pm   Post subject: Re: DDR -- help

Do you understand Object-Oriented Programming? If you do, make an arrow class, and every time a new arrow is to appear, make a new instance of this class and add that instance to an array of arrows to be moved-up and drawn.

If you don't understand OOP, then the above won't work. In may be harder to do, but I'm sure there are ways to do it. I'll have to leave that for someone else here to solve.
ladum




PostPosted: Sat May 30, 2009 12:48 pm   Post subject: Re: DDR -- help

thanks for the idea... too bad i didn't know what object orienting programing was... oh well.. thanks anyways
Dusk Eagle




PostPosted: Sat May 30, 2009 3:24 pm   Post subject: Re: DDR -- help

Well, if you're willing to work hard, you could follow my link above and learn about it (or you could Google it).
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  [ 4 Posts ]
Jump to:   


Style:  
Search: