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.

Newcomers DBPro Corner / help with ping pong program

Author
Message
gamer n00b
18
Years of Service
User Offline
Joined: 14th Jan 2006
Location:
Posted: 20th Jan 2006 03:02

!please help me out with this code and test it bc i cant get the restart button to work!
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 20th Jan 2006 21:04
ok found the problem atleast.....
Quote: "Input "",num"


because this works fine...



i set num to 3 so u'll have to find a way around having to ask the same question again.... i don't know how to fix it, sorry.

life's one big game
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Jan 2006 22:11 Edited at: 20th Jan 2006 22:38
actually, the code works as-is. it's doing what it's supposed to. the problem is that after a restart, it goes back to his/her "Num:" label, prints the prompt and then somehow hides the text. it's still there but you can't see it.

Quote: "
ok found the problem atleast.....
Quote: "Input "",num"
"


that's not the problem. num is being set to a new value after the restart/re-prompt (or set to the same value if you press <enter> during the "target score" input routine). but, you're on the right track. there is no re-set of the players' scores upon restart. add the following lines under one of the many labels that are utilized during a restart:


(not sure why you're using Reals to define Integer scores, tho)


couple things to offer here, revonneer, which may rectify the problem:

1) to put it bluntly, the code is spaghetti. it's bouncing all over the place with multiple and unnecesary Goto statements. best practice is to avoid "Goto" when possible. it will help situations just like this, when you're trying to narrow down a glitch. group relevant code together. use indents to help keep your code visually tidy. use blank spaces between the various snipets of code to separate groups of instructions that are related to one another. you are using REM statements nicely, though, which helps you keep track of things, but getting into a better practice of keeping your code clean will make your programming experience less frustrating as you delve into more and more complex works.

2) SYNC RATE and SYNC ON:

these pieces of code:







start your code with SYNC ON and SYNC RATE ## and you never have to use them again. later in your code, just use a SYNC when you want the screen to refresh. there's really no need to change the sync rates during the game you've written. over-use can and will cause problems, and i'm thinking it's why the bug exists, but the afformentioned 'spaghetti' code is requiring more time for me to follow than i'm willing to offer right now in tracking down the bug.

meanwhile, your code works with only a slight hitch, and i commend you for that. i'm new to DBPro (since mid-December '05) and i enjoy browsing the 'Newcomers' threads, using other Newcomer problems as exercises. it's helped a great deal and i suggest that other Newcomers do the same.

EDIT - one (possibly important) item i forgot to mention:

this:



the more-experienced coders here regularly suggest avoiding DELETE OBJECT when possible. it causes unwarranted lag issues and can cause some bugs to pop up, etc. in your game there's really no need to delete them and re-create them for each round. a work around might be called for where you create the objects once and then HIDE OBJECT when you don't want them on the screen, using SHOW OBJECT when you do.

good luck

My Modest System:
Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb), Drivers and Updates Kept Current
gamer n00b
18
Years of Service
User Offline
Joined: 14th Jan 2006
Location:
Posted: 21st Jan 2006 03:29
virtual nomad i got it now i used smallg's imput i just need help for still asking what score the player wants to go to but i dont know how
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 23rd Jan 2006 18:29
here you go....

i worked around the problem and used the entry buffer instead of the input command... same effect though.

it works fine now, next you could add some AI, if u haven't already ofcourse.

life's one big game
gamer n00b
18
Years of Service
User Offline
Joined: 14th Jan 2006
Location:
Posted: 23rd Jan 2006 23:33
what is AI?
gamer n00b
18
Years of Service
User Offline
Joined: 14th Jan 2006
Location:
Posted: 23rd Jan 2006 23:45
uh...i cant use that command bc i have the demo version so i am going to get it...do you know anywhere that sells them in stores or somewhere cheap...if you do please let em know
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Jan 2006 02:06
Quote: "what is AI?"


Artificial Intelligence

http://en.wikipedia.org/wiki/Artificial_intelligence


Login to post a reply

Server time is: 2024-09-24 15:38:50
Your offset time is: 2024-09-24 15:38:50