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 / frogger scoring problem

Author
Message
tvzen
16
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 17th Jun 2010 21:27
well,i been making frogger,and when it touches the lake,i is suppost to add 1 to the score,but it goes up 60 a sec.(because sync rate 60 )
here is the code,can you help.
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 17th Jun 2010 21:36
As soon as you are over the lake then the condition is going to be true every loop. (As you said, 60x per sec)

Do you want it to increment just once and move to the next level, or increment more slowly?
tvzen
16
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 17th Jun 2010 21:47
well,what is suppost to happen is,the frog crosses the road,the frog touches the lake,the score goes up once,then stops(what it is not doing) then he goes back and forth......etc etc
tvzen
16
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 17th Jun 2010 21:51
found the problem ,pondflag dosnt change....it stays 0!
tvzen
16
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 17th Jun 2010 22:08 Edited at: 17th Jun 2010 22:12
still cant find out why i dosnt change when it touches the pond

line 133-147 should do it,right?
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 17th Jun 2010 22:31 Edited at: 17th Jun 2010 22:33
You're declaring pondflag and score as global, but also passing it as a parameter to your `hit_pond` function, so the values are never kept "globally". Just remove them from your function declaration:



And also remove it from the calling line:



Works for me then.

You need to think carefully about what you use globally, and what you use locally in functions etc.
tvzen
16
Years of Service
User Offline
Joined: 3rd Dec 2009
Location:
Posted: 17th Jun 2010 22:52
OMG,thank you!

Login to post a reply

Server time is: 2026-07-25 08:13:45
Your offset time is: 2026-07-25 08:13:45