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

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




PostPosted: Sat Jan 19, 2008 1:07 pm   Post subject: Bar Help

Alright what i am trying to do is make it so this ball is reflected every time it is hit by a box (just like pong) But i cant get a bar! Here is what i have so far.

code:
View.Set("graphics:max;max;noecho,offscreenonly")
var x, y: int := 10
var int_xdiff : int:= 10
var int_ydiff : int := 10

loop
    cls
    Draw.FillOval (x, y, 10, 10, black)
    View.Update
    x += int_xdiff
    y += int_ydiff
    if x < 10 or x > maxx - 10 then
        int_xdiff := -int_xdiff
    end if
    if y < 10 or y > maxy - 10 then
        int_ydiff := -int_ydiff
    end if
end loop



I also need to have have it sensitive so it reflects the ball and have it only be able to go up and down.
Sponsor
Sponsor
Sponsor
sponsor
TopBypass




PostPosted: Sat Jan 19, 2008 1:35 pm   Post subject: RE:Bar Help

Alright i have edited it and added a new bar. All i need help with is moving it and having it sensitive to contact with the ball.
TopBypass




PostPosted: Sat Jan 19, 2008 2:23 pm   Post subject: RE:Bar Help

can someone please help me. This is what i have so far

code:

View.Set("graphics:max;max;noecho,offscreenonly")
var x, y :int := 600
var x2, y2 :int := 0
var int_xdiff : int:= 10
var int_ydiff : int := 10

loop
    cls
    Draw.FillOval (x, y, 10, 10, black)
    drawfillbox (x2, y2, 20, 300, black)
    View.Update
    x += int_xdiff
    y += int_ydiff
    if x < 10 or x > maxx - 10 then
        int_xdiff := -int_xdiff
    end if
    if y < 10 or y > maxy - 10 then
        int_ydiff := -int_ydiff
    end if
end loop


I need help with making the bar a solid object.
isaiahk9




PostPosted: Wed May 07, 2008 7:43 pm   Post subject: RE:Bar Help

The simplest way to do this is you need to make the paddle a different color. let's say its 11 (brightred).

If View.WhatDotColor (ball-x, ball-y) = 11 then
ball is bounced

Use View.WhatDotColor for colision detection. For more info, go into tutorials or click F10 - turing index.
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: