help me make this bounce
Author |
Message |
grispyg
|
Posted: 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.
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.. ![Very Happy Very Happy](images/smiles/icon_biggrin.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DanShadow
![](http://compsci.ca/v3/uploads/user_avatars/12142970654c996e83e6997.png)
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
CITC
![](http://www.gamespy.com/legacy/fargo/soulturns/letter14.jpg)
|
Posted: 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 |
|
|
|
|
|
![](images/spacer.gif) |
|
|