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 / Coin Tossing Program

Author
Message
Davido01
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 20th Nov 2009 19:33 Edited at: 20th Nov 2009 19:37
I had written a coin tossing program which worked well, so I decided to go one step further. The selection of coin!

Unfortunately I am having a bit of trouble with it as when I press the return key when it says press it to throw a coin, it goes crazy and throws loads. Tried a few things but just can't work it out.



Any help much appreciated.

EDIT: Using a keystate makes it go more crazy. Think I need to use inkey$ or something.
Davido01
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 20th Nov 2009 19:42
Had made a coin tossing program which worked, so I decided to go one step further. Selection of coin!

Unfortunately I have ran into a problem which I just can't solve. Basically when I press enter for it to toss the coin it keeps on tossing it over and over. Think I have to change it to inkey$ but couldn't work out how to do that. Keystates just make it do the same.



Any help appreciated.
xguild
16
Years of Service
User Offline
Joined: 19th Oct 2008
Location:
Posted: 20th Nov 2009 21:18
its a bit tough to test since you didn't include the media, it would be helpful.

Newbie Alert
Davido01
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 20th Nov 2009 23:02
Sorry for double post, thought my first post got deleted. Will attach media then. Don't worry about the the other coins apart from the 2p one, as haven't done those ones yet because of the problem. Press 2 to select the 2p coin then you should be able to see the problem. How you upload 2 files in one post, only lets me do one.

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Nov 2009 23:19
You're making it a lot more complicated than it needs to be. You want RANDOMIZE TIMER() and SET TEXT OPAQUE to only be seen once so they need to be at the top.

With this program a simple WAIT KEY is only needed instead of a DO/LOOP with a check for the return key with an EXIT.

The SET CURSOR command is nice but it's better to use TEXT that combines SET CURSOR and PRINT in one command.

You don't really need a check for P=2 because P is the number of points you want (I assume) which can be added to the INC command. Otherwise you'll be making IF/THEN statements for each amount of points.

I put each KEYSTATE() check in a FOR/NEXT loop so you can see an easier way to check for multiple keys without having to repeat several lines.



Davido01
15
Years of Service
User Offline
Joined: 28th Oct 2009
Location:
Posted: 21st Nov 2009 00:11
Thank you. Learnt a few timesavers with that. What I meant by P was the type of coin it would have. So if p=1 it would be a 1p coin, p=3 a 5p coin. Then through it checking the variable it prints a relevant image to the coin.

Login to post a reply

Server time is: 2024-11-23 22:44:41
Your offset time is: 2024-11-23 22:44:41