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.. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
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 |
|
|
|
|
|
PaddyLong
|
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 |
|
|
|
|
|
|
Page 1 of 2 [ 26 Posts ]
|
Goto page 1, 2 Next |
|
|
|
|