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

Username:   Password: 
 RegisterRegister   
 need help making small maple leaf move around on screen!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
circles




PostPosted: Wed Oct 06, 2004 5:50 pm   Post subject: 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?

code:
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
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Wed Oct 06, 2004 6:17 pm   Post subject: (No subject)

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 this thread, which I found using the handy Search tool.
Paul




PostPosted: Wed Oct 06, 2004 7:33 pm   Post subject: (No subject)

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




PostPosted: Thu Oct 07, 2004 8:03 am   Post subject: (No subject)

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




PostPosted: Thu Oct 07, 2004 7:57 pm   Post subject: (No subject)

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?
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  [ 5 Posts ]
Jump to:   


Style:  
Search: