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

Username:   Password: 
 RegisterRegister   
 How do i make this ball roll
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
dirk87




PostPosted: Sun Apr 13, 2008 6:35 pm   Post subject: How do i make this ball roll

proc bowling
drawfillbox (100, 100, 550, 200, 115)
drawfilloval (110, 150, 20, 20, black)
end bowling

how can i get my bowling ball to roll to the very right side of my bowling alley
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Sun Apr 13, 2008 7:09 pm   Post subject: Re: How do i make this ball roll

For your ball, you drew it as an oval.

The oval is controlled like this.

Turing:

drawfilloval (x,y,radius_x,radius_y,colour)


The x and y variables are your positions on your screen. To go right you will want to minipulate your x variable by increasing it, to go left, decrease the variable.

If you are planning on moving the ball, up or down the screen, the y variable controls that.

The x_radius and y_radius along with the colour should be left the same, as they won't affect movement, but the style of the ball.
A.J




PostPosted: Sun Apr 13, 2008 8:53 pm   Post subject: Re: How do i make this ball roll

try increasing the x-value by 1 everytime in a loop, and then draw your oval eachtime in a loop.
I know I shouldn't help, but here it is anyways:
Turing:

View.Set ("offscreenonly")
proc bowling (var x : int)
    drawfillbox (100, 100, 550, 200, 115)
    drawfilloval (x, 150, 20, 20, black)
end bowling
var x := 110
loop
    bowling (x)
    View.Update
    delay (5)
    exit when x > 550
    cls
    x += 1
end loop
I Smell Death




PostPosted: Wed Apr 23, 2008 9:37 pm   Post subject: Re: How do i make this ball roll

here's an other way of doing it similar to how aj did it but using a for loop and maxx. I find that using maxx and maxy is useful when later on you realise that you need more screen space.

code:
proc bowling (x:int)
    drawfillbox (100, 100, 550, 200, 115)
    drawfilloval (x, 150, 20, 20, black)
end bowling

for x:1..maxx
    cls
    bowlind(x)
    View.Update
    delay(10)
end for
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: