
-----------------------------------
mynameisbob
Mon Jul 12, 2004 10:08 pm

Saving mouse coordinates
-----------------------------------
ok heres what i want the program to do...

var xm, ym, b : int
setscreen ("offscreenonly")
drawfillbox (0, 0, maxx, maxy, black)
drawfilloval (200, 200, 100, 100, brightblue)
loop
    mousewhere (xm, ym, b)
    if b = 1 and whatdotcolour (xm, ym) = brightblue then
        drawfilloval (xm, ym, 10, 10, black)
    end if
    delay (10)
    View.Update
end loop

but i want to place these two lines inside the loop
drawfillbox (0, 0, maxx, maxy, black)
drawfilloval (200, 200, 100, 100, brightblue)

and whenever the user clicks the mouse on the blue circle i want to save the coordinates where they clicked and draw the black circle at that point each time you go through the loop.

-----------------------------------
Tony
Tue Jul 13, 2004 12:45 am


-----------------------------------
so have an array, and each time you're about to draw your black circle, record its position in the array.

then when you need to draw those circles on screen, just use a forloop to go though the array's index

-----------------------------------
mynameisbob
Tue Jul 13, 2004 6:21 pm


-----------------------------------
yea, the first time i used an array it didnt work out, but now i've got it. the problem was, everytime i click, the same values were being assigned to all the variables in the array. i changed a few lines around and now got it to work. thanks

-----------------------------------
the_short1
Fri Jul 16, 2004 11:07 am


-----------------------------------
u know..


drawfillbox (0, 0, maxx, maxy, black) 


instead of that..
you can do this..


colorback (black)
cls

works better :)

-----------------------------------
DanShadow
Mon Jul 26, 2004 7:01 pm


-----------------------------------
or you could try this:

type bullets:
record
x,y:int
end record
var bullet:array 1.. 9999 of bullets
var bulletsShot,x,y,b:int:=1
%Set initial bullets offset off the screen, to make the for loop
%  that draws the bullets work correctly.
bullet(bulletsShot).x:=-50
bullet(bulletsShot).y:=-50
loop
setscreen("offscreenonly")
View.Update
cls
mousewhere(x,y,b)
delay(5)
for i:1..bulletsShot
drawfilloval(bullet(i).x,bullet(i).y,1,1,16)
end for
if b=1 then
bullet(bulletsShot).x:=x
bullet(bulletsShot).y:=y
bulletsShot+=1
end if
end loop

I dont have Turing on this computer, but this code should work pretty well. I included it on my friends shooting gallery ISU, he got a pretty good mark just for including that in it. So that might work for you.

-----------------------------------
Delta
Thu Aug 05, 2004 11:54 am


-----------------------------------
your code doesn't work... jeez... I know I'm posting late... but I don't care... because all your (DanShadow's) posts are like 10 days after the last response... your pretty much spamming old topics just to increase your post count and look all fancy... typical computer geek... get a life dude...

-----------------------------------
DanShadow
Thu Aug 05, 2004 3:37 pm


-----------------------------------
Hey Delta, be quiet. This post was made like many months ago fool. And that was before I was even a mod...so just keep your comments to yourself.

-----------------------------------
Delta
Fri Aug 06, 2004 1:55 am


-----------------------------------
Don't even try tellin' me what to do... and I did say that my post was late... which goes to show that you don't pay much attention to detail in the first place... like how I have more seniority than you do since I joined compsci first and all anyways... have a nice day...

-----------------------------------
DanShadow
Sat Aug 07, 2004 2:29 pm


-----------------------------------
Makes no difference, and I DID read that. But you seriously are like flaming me alot recently, so, plz stop the burning. And since this post has
already been answer:


-----------------------------------
AsianSensation
Sat Aug 07, 2004 5:49 pm


-----------------------------------
What? I didn't know DanShadow could lock stuff in Turing section, I feel so un-unique now... :cry:  :cry: 

anyways guys, don't kill each other, what would we do if we are suddenly missing two mods once the two of you decide to double K.O. each other?

-----------------------------------
DanShadow
Sun Aug 08, 2004 6:19 pm


-----------------------------------
Yep, I was recently added to the Turing Gods club. :D Your still special AsianSensation.
