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

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




PostPosted: Fri Jan 09, 2004 8:02 pm   Post subject: help me make this bounce

can someone help me.. I made this program and its sopposed to bounce and still go across the screen.. its kinda confusing me....plz..anyone. Sad
code:

%Grispy
%January 7 03
%Happy scroll
colorback (black)
cls
loop
for i : 1 .. maxx
    drawfilloval (0 + i, 240, 100, 100, yellow) %head
    drawoval (0 + i, 240, 100, 100, black)  %outline
    drawfilloval (-30 + i, 270, 15, 15, black)  %left eye
    drawfilloval (50 + i, 270, 15, 15, black)  %right eye
    drawarc (0 + i, 230, 3 * 100 div 4, 3 * 100 div 4, 200, 340, black)  %smiley
end for


for decreasing i : maxx .. 1
    drawfilloval (0 + i, 240, 100, 100, yellow) %head
    drawoval (0 + i, 240, 100, 100, black)  %outline
    drawfilloval (-30 + i, 270, 15, 15, black)  %left eye
    drawfilloval (50 + i, 270, 15, 15, black)  %right eye
    drawarc (0 + i, 230, 3 * 100 div 4, 3 * 100 div 4, 200, 340, black)  %smiley
end for
end loop

would really apreciate it.. Laughing Very Happy
Sponsor
Sponsor
Sponsor
sponsor
DanShadow




PostPosted: Fri Jan 09, 2004 8:12 pm   Post subject: (No subject)

If you mean bounce across the screen (left and right), here ya go:
code:

var dir : string := "right"
var i : int := 0
loop
    if dir = "right" then
        i := i + 4
    else
        i := i - 4
    end if
    setscreen ("offscreenonly")
    View.Update
    Draw.FillBox (0, 0, maxx, maxy, 255)
    drawfilloval (0 + i, 240, 100, 100, yellow)     %head
    drawoval (0 + i, 240, 100, 100, black)     %outline
    drawfilloval (-30 + i, 270, 15, 15, black)     %left eye
    drawfilloval (50 + i, 270, 15, 15, black)     %right eye
    drawarc (0 + i, 230, 3 * 100 div 4, 3 * 100 div 4, 200, 340, black)     %smiley
    if i >= maxx - 100 then
        dir := "left"
    elsif i <= 100 then
        dir := "right"
    end if
end loop
CITC




PostPosted: Sun Jan 11, 2004 7:36 pm   Post subject: (No subject)

i think a slightly easier way to do that would be this:
code:
drawoval (5, 5, 3, 3, 12)
var ball : int := Pic.New (2, 2, 8, 8)
var x : int := 50
var y : int := 50
var dx : int := 1
var dy : int := 1
loop
    cls
    Pic.Draw (ball, x, y, picMerge)
    x += dx
    y += dy
    if x > maxx - 3 or x < 4 then
        dx := -dx
    end if
    if y > maxy - 3 or y < 4 then
        dy := -dy
    end if
    delay (5)
end loop
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  [ 3 Posts ]
Jump to:   


Style:  
Search: