
-----------------------------------
circles
Wed Oct 06, 2004 5:50 pm

need help making small maple leaf move around on screen!
-----------------------------------
oka. i am making a screensaver. i have a border (this is jsut a beater one for my buddy jimmy),and i have a background. i need to make 2 shapes bounce around INSIDE the border, but not jsut appear randomly on the screen. how do i do this? here is the code, so you can try and get it on there.

i cant get it to move, just flash everywhere! cna anyone write me some code that will work?

var intRand:int:=0
var intRand2:int:=0
setscreen ("nocursor")
setscreen ("graphics:505;504")
drawfill (1, 1, black, black)
for i : 23 .. 1000 by 84
    drawfilloval (21, i, 20, 20, 187)
end for
for j : 23 .. 1000 by 84                      %% leftside
    drawfillbox (1, j + 60, 41, j + 24, blue)
end for

for i : 23 .. 1000 by 84
    drawfilloval (483, i + 43, 20, 20, 3)
end for
for j : 23 .. 1000 by 84                      %% rightside
    drawfillbox (464, j + 104, 503, j + 66, purple)
end for

for i : 23 .. 1000 by 84
    drawfilloval (i, 23, 20, 20, red)
end for
for j : 23 .. 1000 by 84                      %% bottom
    drawfillbox (j + 23, 42, j + 60, 4, 45)
end for

for i : 23 .. 1000 by 84
    drawfilloval (i + 41, 484, 20, 19, green)
end for
for j : 23 .. 1000 by 84                      %% top
    drawfillbox (j + 102, 467, j + 64, 503, yellow)
end for
loop
    randint (intRand,48,430)
    randint (intRand2,50,435)
    drawfillmapleleaf (intRand+30,intRand2+30,intRand,intRand2,purple)
    drawfillmapleleaf (intRand+30,intRand2+30,intRand,intRand2, black)
    delay(10)
end loop

-----------------------------------
Cervantes
Wed Oct 06, 2004 6:17 pm


-----------------------------------
This is not completed source code, it does not belong here.  You are asking a question, it belongs in Turing Help.

As for your question, you said specefically that you don't want to make the leaves appear randomly on the screen.  So, you probably won't want to use rantint.  :wink:

try checking out [url=http://www.compsci.ca/v2/viewtopic.php?t=5164&highlight=bouncing+balls]this thread, which I found using the handy [url=http://www.compsci.ca/v2/search.php]Search tool.

-----------------------------------
Paul
Wed Oct 06, 2004 7:33 pm


-----------------------------------
and you have no increasing x or y values... so the leaves won't travel in a path, plus you have no collision detection whatsoever, so nothing will "bounce".

-----------------------------------
gigaman
Thu Oct 07, 2004 8:03 am


-----------------------------------
Here are a couple suggestion.
1) Never use randint if you want something to follow a nice path.
2) get the value for the out side edges of the screen and make sure that none of your x or y variables go past it
3) i dont have a 3

-----------------------------------
circles
Thu Oct 07, 2004 7:57 pm


-----------------------------------
okay, i realized what iw as doing wrong, and i fixed it. now i have it all good.. so now how do i add in a sound effect form my hard drive?
