
-----------------------------------
grispyg
Fri Jan 09, 2004 8:02 pm

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. :( 

%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.. :lol:  :D

-----------------------------------
DanShadow
Fri Jan 09, 2004 8:12 pm


-----------------------------------
If you mean bounce across the screen (left and right), here ya go:

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  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
