input and graphics mode
Blitz3D Forums/Blitz3D Beginners Area/input and graphics mode
While the game is in graphics mode....graphics 600,400
how can I get an users input for his name.Or can I?
If not,do I have to do the user$=input$("name") before graphics mode?
Then if new player,restart the game?
thanks,
mudcat(aka Rob)
"Graphics" is usually the 1st command in a B3D program. I don't know if I understand your question, but I notice you have "Graphics 600,400". Is that supposed to be "Graphics 640,480"? Maybe your graphics card doesn't support 600 X 400 (the usual graphics are 640 X 480, 800 X 600, 1024 X 728, etc... using a 4 X 3 ratio)
This works fine for me:
Graphics 640,480
user$ = input$("Name: ")
WaitKey()
End
graphics 640,480
d$=input$("your name: ")
works perfectly here. Both, on backbuffer and frontbuffer, windowed and fullscreen.
For a game I would suggest to use a GUI with a nice looking user prompt function. Check the code archives/user input.
http://www.blitzbasic.com/codearcs/codearcs.php?code=207This code from the code archives has what you are after I think.
when I try this,I get a blank screen until I press return,
then a blitz cc window come up with a blinking window,
I'm not understanding something here.
Just added by edit:When I run this...there is a blank full screen,another window is opeded but I can't see it,I type dad,and then press return..then the input window comes up,I see down on the bottom that my main graphic screen was minized.I press that to maximize and the program is running.What am I not understanding.If u just point me I think I can figure it out.
Global name$
Global y=1
; setup screen
Graphics 640,480
;Use page flipping
SetBuffer BackBuffer()
While KeyDown(1)=0
Cls
If y=1
inputn()
EndIf
Text 520,130,"SCORE"
Text 520,140,score
Text 520,260,"LEVEL"
Text 520,270,name$
Flip
Wend
End
Function inputn()
name$=Input$("name:")
y=0
End Function
matty,
i paste the code sample u gave,but it comes up error.
Augen
do I need more than copy and paste ur code?
when I run ur code I get a black screen till I press return then I get a blitz cc window with name and a blinking cursor
Blitz Plus is different, and downgraded Print/Input to work only in a debug command line since they were really just hacks before. Their only use now is for debugging or learning the basics (ie. don't use Graphics, just do simple variable manipulation with Print and Input).
alas,I'm a noob.
My first game is a tetris clone.I wanted to save personal high scores.So to get a persons name while in the game,I need to create a window for the input?Or use graphics for the letters for the input?
mudcat, my example is B3D. I think you may be using B+. Sorry I didnt make that clear. Copy/Paste, then Run is all you need for B3D.
Mudcat, yeah, you'll really have to write an input routine of your own (Input wasn't ideal for this anyway). An easier way might be to do a retro-style grid of letters for the player to click on...