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 / high score input

Author
Message
Mickyfyn
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: UK
Posted: 13th Dec 2003 19:20
Hi

I am trying to add a function in my game that will detect if the score is higher than the previous high score (easy so far)
What I cannot do is work out how to input the players name. If I use input the text appears at the top left hand corner (0,0 which I don't want)

inkey$() only returns a single letter. I tried this but I got multiple letters when used with repeat etc.

Would someone please help me with this.

Mickeyfyn
Shadow Lord
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 13th Dec 2003 20:00
I understand what you are trying to do, and you are almost certainly going to need a GUI with text boxes to get your players names. There are other ways, but none as easy. And by FAR the best way to do a GUI is to use BlueGUI by RobK. It has everything you need to do what you want, textboxes, buttons, panels, etc. It's easy to use too.

Head over to the 'Program Announcement' forum, there is a topic there on 'BlueGUI' so you can read up on it.

One other way, would be to get one letter at a time (as you're already doing) and adding that letter to a string, repeating until the user click on an 'OK' button that you've made, or presses [ENTER]. This method would work, but you'd be re-inventing the wheel.

I'm using DBPro to write "Suger Free Candyland", for diabetic children!
KNau
22
Years of Service
User Offline
Joined: 25th Nov 2002
Location: Canada
Posted: 13th Dec 2003 20:02 Edited at: 13th Dec 2003 20:05
I clipped this code directly from the high score table of my game Power Mad so it won't run for you like this because you don't have the graphics files. This is mainly to show you how I did it.

That said, this is very rough and I don't know if I would do it this way again. I use INKEY to get the letter being pressed and continuously update a player_name$ with whatever the player is typing. The player is limited to only 5 letters in their name. There's a main loop and an string update subroutine. I hope you can read my sloppy code, although it is mostly commented. Let me know if you don't get it.

I'm developing a high score table where the player clicks on letters with the mouse instead that I will re-use for all my future projects. It's better to take your time and write a really nice function that can be reused over and over again.

http://www.canceriannewmedia.com
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 13th Dec 2003 20:08 Edited at: 13th Dec 2003 20:25
Here is a function lifted directly from one of my games.



This is enter.png
http://winch.dbpcommunity.com/temp/enter.png
To use it with that image you need to set the ink colour with ink to black before you call the function so the text will show up.

dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard
Mickyfyn
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: UK
Posted: 15th Dec 2003 13:17
Thank you all for your replies.

Mickeyfyn

Login to post a reply

Server time is: 2024-11-25 20:36:09
Your offset time is: 2024-11-25 20:36:09