Computer Science Canada

randomly moving

Author:  beedub [ 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..

Author:  Andy [ Mon Jun 16, 2003 9:28 am ]
Post subject: 

use xchange and ychange

Author:  krishon [ Mon Jun 16, 2003 9:48 am ]
Post subject: 

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

Author:  Andy [ Mon Jun 16, 2003 10:02 am ]
Post 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

Author:  Tony [ Mon Jun 16, 2003 10:41 am ]
Post 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

Author:  Homer_simpson [ Mon Jun 16, 2003 11:01 am ]
Post 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

Author:  krishon [ Mon Jun 16, 2003 11:02 am ]
Post subject: 

ye, that works, lol

Author:  JayLo [ Mon Jun 16, 2003 12:17 pm ]
Post subject: 

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

Author:  Andy [ Mon Jun 16, 2003 2:38 pm ]
Post subject: 

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

Author:  Homer_simpson [ Mon Jun 16, 2003 3:06 pm ]
Post subject: 

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

Author:  Homer_simpson [ Mon Jun 16, 2003 4:23 pm ]
Post 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

Author:  Andy [ Mon Jun 16, 2003 4:39 pm ]
Post 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

Author:  Homer_simpson [ Mon Jun 16, 2003 6:51 pm ]
Post subject: 

the code above took me less than 10 mins =)

Author:  Andy [ Mon Jun 16, 2003 7:27 pm ]
Post subject: 

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

Author:  PaddyLong [ Mon Jun 16, 2003 10:38 pm ]
Post subject: 

study?? pffft the only studying you need to do is a once over of your notes Surprised people worry way too much about the numbers they get in school

Author:  Andy [ Tue Jun 17, 2003 10:20 am ]
Post subject: 

notes? what notes... i just memorize the text book 8)

Author:  krishon [ Tue Jun 17, 2003 10:20 am ]
Post subject: 

i dun't think that's a good way of studyin, especially for application problems

Author:  Andy [ Tue Jun 17, 2003 10:21 am ]
Post subject: 

ya but chinese ppl are good at application, its the theory that kills us

Author:  krishon [ Tue Jun 17, 2003 10:22 am ]
Post subject: 

lol, not for me, its the other way around, y r u azn?

Author:  Andy [ Tue Jun 17, 2003 10:23 am ]
Post subject: 

yepp, mandrine and proud

Author:  krishon [ Tue Jun 17, 2003 10:25 am ]
Post subject: 

lol, nice, i thought u were caucasian or somethin

Author:  Andy [ Tue Jun 17, 2003 10:28 am ]
Post subject: 

uhhh, that's nasty, well you know we can just go to the chat room and talk eh? but anyways, this gets me bits

Author:  krishon [ Tue Jun 17, 2003 10:30 am ]
Post subject: 

haha, yah..this is the only way left, after hte other one was moved to spam....but the original post was spam..so its not our fault.....or is it Wink

Author:  Andy [ Tue Jun 17, 2003 10:31 am ]
Post subject: 

oh well, hope they guy wouldn't be mad at us and still let us be mods

Author:  krishon [ Tue Jun 17, 2003 10:32 am ]
Post subject: 

lol, we're like the only ppl other than him and maybe darkness that know bout it

Author:  Andy [ Tue Jun 17, 2003 10:33 am ]
Post subject: 

lol, no one reads the spam section, u dun gets bits so y waste time?


: