Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / add points to score with pick object

Author
Message
Daniel wright 2311
User Banned
Posted: 17th Aug 2010 03:15
this should work or am i missing something? if the mouse is on the object and I click the mouse then 1 point will be added to the score. but, nothing happens when I print my score to check it.Is there a better way?


if pick object(mousex(),mousey(),4,4)>0 and mouseclick()=1 then game1percent=game1percent+1

Logo by The Next
El Goorf
19
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Uni: Manchester, Home: Dunstable
Posted: 17th Aug 2010 03:42
are you actually clicking on object 4? maybe there's an object in the way? display what pick object returns to the screen to find out.

are you updating the display after each change?

is game1percent being modified anywhere else?

http://notmybase.com
All my base are not belong to anyone.
Jeff032
18
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 17th Aug 2010 03:56
It's working fine for me, so maybe you have a typo when printing the score or you aren't clicking on object 4?

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 17th Aug 2010 05:33
Actually i think the way it's written it should add many many points, as long as you keep the mouse button pressed and there is object 4 behind the mouse!

As El Goorf suggested, try to isolate the problem.Try what he said, find what pick object returns, updating the display could be pointless i think, and of course just check if there is a place somwhere in the code where game1percent is changed or set wrong, for example it can be given value of 0 each loop or each time when above code you provided is executed.Something like that.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Daniel wright 2311
User Banned
Posted: 17th Aug 2010 05:35 Edited at: 17th Aug 2010 05:37
i belive it was not working becouse i had the pick object in a function and not in the loop. i changed all my functions and put them in the loop and now it works.

Logo by The Next

Login to post a reply

Server time is: 2026-07-25 17:50:24
Your offset time is: 2026-07-25 17:50:24