Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
randomly moving
Author Message
beedub

Posted: Sun Jun 15, 2003 10:41 pm   Post subject: randomly moving

i need something to randomly move across the screen 10 times in any direction. So in this case lets make it a circle..

Andy

Posted: Mon Jun 16, 2003 9:28 am   Post subject: (No subject)

use xchange and ychange
krishon

Posted: Mon Jun 16, 2003 9:48 am   Post subject: (No subject)

do u mean like it goes to a random location 10 times?
Andy

Posted: Mon Jun 16, 2003 10:02 am   Post subject: (No subject)

ya if u want it to show randomly just do this
 code: for i:1..10 cls drawfilloval(Rand.Int(0,maxx),Rand.Int(0,maxy),10,10,i) delay(100) end for
Tony

Posted: Mon Jun 16, 2003 10:41 am   Post subject: (No subject)

i think he ment randomly move, not appear...

say princial appliest though. Randomly generate a number from 1 to 4, that would determine in which direction piece would move.

if move=1 then
%move north
...
etc
Tony's programming blog. DWITE - a programming contest.
Homer_simpson

Posted: Mon Jun 16, 2003 11:01 am   Post subject: (No subject)

 code: View.Set("offscreenonly") const xspeed := 1 const yspeed := 1 var y, x := 100 loop     x += Rand.Int (-xspeed, xspeed)     y += Rand.Int (-yspeed, yspeed)     drawfilloval (x, y, 10, 10, 12)     View.Update     delay(5)     drawfilloval (x, y, 10, 10, white) end loop
krishon

Posted: Mon Jun 16, 2003 11:02 am   Post subject: (No subject)

ye, that works, lol
JayLo

Posted: Mon Jun 16, 2003 12:17 pm   Post subject: (No subject)

looks freaky though. I think he meant like bouncing? iunno. he isn't making it clear.

Andy

Posted: Mon Jun 16, 2003 2:38 pm   Post subject: (No subject)

i dun think so, i think he's trying to make a space shooter or something
Homer_simpson

Posted: Mon Jun 16, 2003 3:06 pm   Post subject: (No subject)

ic... ok i'll try to make a smooth moving one...
Homer_simpson

Posted: Mon Jun 16, 2003 4:23 pm   Post subject: (No subject)

how bout this one?!
 code: proc rotate (OriginX, OriginY : real, var secondpartX, secondpartY : real, Rotaion : real)     var tempx := (((OriginX - secondpartX) * cosd (Rotaion)) + ((OriginY - secondpartY) * sind (Rotaion)))     var tempy := (((OriginY - secondpartY) * cosd (Rotaion)) - ((OriginX - secondpartX) * sind (Rotaion)))     secondpartY := OriginY - tempy     secondpartX := OriginX - tempx end rotate View.Set ("offscreenonly") const factor := 200 const speed := 1 var xx, yy : real := 200 var xr, yr := 100 var slope := 0.0 var i : int loop     i := 1     xr := Rand.Int (-factor, factor)     yr := Rand.Int (-factor, factor)     xr += round (xx)     yr += round (yy)     loop         i += 1         rotate (xr, yr, xx, yy, speed)         drawfilloval (round (xx), round (yy), 5, 5, 9)         View.Update         delay (5)         exit when i = 10     end loop end loop
Andy

Posted: Mon Jun 16, 2003 4:39 pm   Post subject: (No subject)

man homer, u have too much free time, anyways if they're looking for mods, you should be their first pick and catalyst of course
Homer_simpson

Posted: Mon Jun 16, 2003 6:51 pm   Post subject: (No subject)

the code above took me less than 10 mins =)
Andy

Posted: Mon Jun 16, 2003 7:27 pm   Post subject: (No subject)

ya but ten minutes can get u 5 marks on an exam if u use it to study

Posted: Mon Jun 16, 2003 10:38 pm   Post subject: (No subject)

study?? pffft the only studying you need to do is a once over of your notes people worry way too much about the numbers they get in school
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 2  [ 26 Posts ]
Goto page 1, 2  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: