Computer Science Canada

How Do u make Counters that adhere to Graphics?

Author:  icedesi [ Wed Jan 07, 2004 7:03 pm ]
Post subject:  How Do u make Counters that adhere to Graphics?

Ok, theres a simple program k? I've Set it so that it 'SHOULD' work that whenever the mouse is on the co-ordinates of the ball and is clicked, that it will create a counter at the top to display how many times it has been clicked. The Problem is, It wont work for some odd reason, i've even reviewed Hacker Dan's tutorial's on counters, but they didn't apply to Graphics, i was wondering if i could get help on this.

Quote:

setscreen ('offscreenonly')
setscreen ('graphics:vga')
var x,y,b:int
var counter:real
counter := 0
mousewhere (x,y,b)
drawoval (156,150,25,25,1)
loop
if buttonmoved ("down") and x-24 > 156 and x+24 < 156 and y-24 > 150 and y + 24 < 150 then
counter := counter +1
put counter
View.Update
end if
end loop



Help is much appreciated, Thank you.

Author:  Dan [ Wed Jan 07, 2004 10:21 pm ]
Post subject: 

wow, the problem is not with the couter it is with your:

closion dection is wrong

mousewhere (x, y, b) needs to be in the loop and not in the if

View.Update needs to be in the loop and not in the if

put couter needs to have a locate on top of it and not in the if

drawoval cant be in the if ether and has to be in the loop


: