Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing?
#1
I already know how can I draw in Quick Basic but how can I let
the person draw in the program?
~~~~~~~~~~~~~~~~~~~~~~~~~~

I love Quick Basic better then Python...

And Python is new.........

Oh yea catch ARPGME
Reply
#2
think about it like this.

the keyboard and mouse (but mostly keyb) in qb is the only link you have between your executable program and the user.

so what you need to do is create a program that loops, and gets keyboard input every loop.

and then you need to "translate" that input into the execution of code.

so say we got a dot at 30, 40 on the screen

change that into vars, dotx, doty and fill em:


Quote:dotx = 30
doty = 40

pset ( dotx, doty ), 15 'puts the dot there as a white dot


so heres pseudo code (this next part wont run, but its the idea you must grasp)


Code:
loop  ------------------------------------------------|
                                                      |
if presskey( "up" ) then gosub upthing                |
                                                      |
                                                      |
pset ( dotx, doty ), 15                               |
                                                      |
loop until presskey( "escape" )-----------------------|


end


upthing:

doty = doty - 1

return

hope it makes sense, i can do a bit more later if time allows

before the big party tonight ;D (anyone from nw illinois here? :P:P)

edit: i'll add a version that runs:

Code:
screen 13 'graphics!

dotx = 30
doty = 40

do

keyin$ = inkey$ 'grab keyboard input
                                                  
if keyin$ = chr(0) + "H"  then gosub upthing
'Don't worry if this seems weird, it's basically just a qb hack to get the arrows.
'this is the up arrow (duh..)
                                              
                                              
pset ( dotx, doty ), 15  
                                                    
loop until keyin$ = chr$(27) 'the code for the escape key

end


upthing:

if doty > -1 then 'add check to keep the dot from going off screen
  doty = doty - 1

end if

return

youll notice, it draws a line. but in reality, this isnt drawing a line, its drawing single dots, the old ones are just never erased
Reply
#3
Woah! you have to remember I am a newbie at all of this stuff.[/b]
~~~~~~~~~~~~~~~~~~~~~~~~~~

I love Quick Basic better then Python...

And Python is new.........

Oh yea catch ARPGME
Reply
#4
Quote:Woah! you have to remember I am a newbie at all of this stuff.[/b]
I'm afraid it seems to me like everything you are trying to do is a bit above newbie. This like getting INPUT from a user, but taking it to the next level with graphics.

I'll try to explain what each part does.
Code:
screen 13 'this is required for you to draw at all, in case you didn't know. this is the recommended screen for creating games in QB

dotx = 30 'this is the starting horizontal position on the screen
doty = 40 'this is the starting vertical position on the screen

do

keyin$ = inkey$ 'grab keyboard input
                                                  
if keyin$ = chr$(0) + "H"  then gosub upthing
'if the Up arrow key is pressed, then your program's flow changes to the "upthing" sub (toward the end)
                                            
                                            
pset ( dotx, doty ), 15 'this draws a white dot at the specified coordinates
                                                  
loop until keyin$ = chr$(27) ' this just says that the program should end if the escape key is pressed

end
'ends the program; required unless you want to go through the "upthing" sub for no reason


upthing:

if doty > -1 then 'add check to keep the dot from going off screen
  doty = doty - 1 'make the dot move up one pixel

end if

return 'continue with the program at the point after the flow was changed

I'm not sure if it can get any more BASIC than that (pun intended). . .
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)
Reply
#5
Your right, what should I pretice making on newbie level? :???:
~~~~~~~~~~~~~~~~~~~~~~~~~~

I love Quick Basic better then Python...

And Python is new.........

Oh yea catch ARPGME
Reply
#6
program controlled graphics Smile
[Image: freebasic.png]
Reply
#7
Hi arpgme,

You can go here:
http://www.petesqbsite.com/sections/tuto...GameDesign

and look for a section called Vic's Tutorials (about 1/3 down the whole page)

there's 21 tutorials, they're concise and quick to learn and they're all about game programming. I'd say it's a good place to start :-)
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply
#8
ok i know this topic is dead but i will warn other readers who read this. I know i am still a bit of a newbie but still i would warn others to stay away from vics tuts they can be VERY confusing try a dif tut on petes site.
Sory if i offended vic
his world has been connected...
Tied to the darkness.
Soon to be completely eclipsed.
There is so very much to learn...
You understand so little.
A meaningless effort.
One who knows nothing can understand nothing.
-Ansem Bringer of darkness and creator of the heartless
Reply
#9
THat JUST SHOWS A DOT! I want them to draw!
~~~~~~~~~~~~~~~~~~~~~~~~~~

I love Quick Basic better then Python...

And Python is new.........

Oh yea catch ARPGME
Reply
#10
Quote:THat JUST SHOWS A DOT! I want them to draw!

You have to learn basics to do the advanced.
url=http://fileanchor.com]FileAnchor[/url] - ImageAnchor - FBTK - QbasicNews - VPlanet - Various
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)