The QBasic Forum: QBasic Help, QuickBasic Help, QBasic Programming
QB FAQ
Homework Help
Subforums, Links and Downloads, Chat Room
getting sprite to move with inkey$by yourfaceCan someone help me get my sprite to move with inkey$. Here is what I have and it's probably totally wrong. Any help would be appreciated. '*** Draws sprite *** LINE (1, 1)-(50, 10), 15, B LINE (2, 2)-(49, 9), 1, B LINE (3, 3)-(48, 8), 15, B LINE (4, 4)-(47, 7), 1, B PAINT (5, 5), 2, 1 '*** saves sprite in an array *** DIM block%(500) GET (1, 1)-(50, 10), block% CLS '*** Puts block sprite in position and moves it *** DO LET x = 5 PUT (x, 180), block% m$ = INKEY$ IF m$ = "6" THEN LET x = x + 1 ELSEIF m$ = "4" THEN LET x = x - 1 ELSEIF m$ = CHR$(27) THEN END END IF from IP address 208.108.221.87 |
Here's one (of many) possible solutions...by GalleonSCREEN 13 LINE (1, 1)-(50, 10), 15, B LINE (2, 2)-(49, 9), 1, B LINE (3, 3)-(48, 8), 15, B LINE (4, 4)-(47, 7), 1, B PAINT (5, 5), 2, 1 DIM block%(500) GET (1, 1)-(50, 10), block% CLS x = 5 DO 'if sprite has moved, erase its old location and draw it again IF x <> lastx THEN LINE (lastx, 180)-(lastx + 49, 180 + 9), 0, BF PUT (x, 180), block%, PSET lastx = x END IF 'input m$ = INKEY$ IF m$ = "6" THEN x = x + 1 IF m$ = "4" THEN x = x - 1 IF m$ = CHR$(27) THEN END LOOP from IP address 122.104.46.15 |
(URL)Have you guys ever heard of DARKBASIC? It seems kindof cool..by drewhttp://darkbasic.thegamecreators.com/ I have google videoed some of the games that have been made in that language, it seems kind of nice. It's just another BASIC language, just to make more 3D, modern games, and such. (Although my graphics screen still gives me errors so I can't play around with it =[ ) Post some likes / dislikes, reviews.. Just saw it on google. drew from IP address 98.26.104.159 |
Yes I havebyI have seen it, I even have it but it is a trial version so it has a time and it has alredy run out. from IP address 220.245.178.132 |
This main forum is strictly for QBasic.by SolitaireYes, we regulars have all heard about alternate versions of BASIC. It's nothing new. If you wish to discuss other versions of BASIC, then please take it to the Non-QBasic subforum.
from IP address 74.73.58.57 |
how do you use DIR$?byThis question is quiet simple. How do you use DIR$ File$ = "C:\" PRINT DIR$(file$) This works but it only displays one file. How do you make it disply more, or can't you. from IP address 220.245.178.133 |
It's in the help fileby qbguy"Usage Notes * DIR$ returns the first filename that matches the filespec$ you specify. To retrieve additional filenames that match the filespec$ pattern, call DIR$ again with no argument. When no filenames match, DIR$ returns a null string." from IP address 75.9.211.189 |
Need more spritesbyI am making a game and I need more sprites. The sprites need to be 32,32 and in numbers If you want to use the blank sprite in the zip to make up your own you can. (REMEMBER: the number 5 is invisible) I need people, grass, dirt, snow, and plenty other things (including monsters) Please send them to my email address at coolnotsocool@live.com.au the numbers are like this (only 32 by 32) 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 from IP address 220.245.178.133 |
*Consider rephrasing your **request**, and throw in some motivation to fulfill it.by* from IP address 71.102.246.240 |
OK hereby qbguy ![]() from IP address 75.9.211.189 |
*You're lucky I'm a believer in open source, otherwise I'd say you STOLE my idea!byfrom IP address 220.245.178.133 |
Need more sprites (updated)byI am making a game and I need more sprites because I am no good at drawing them. The sprites need to be 32,32 and in numbers. (see the example) Each number is a colour so 1 = blue so on. (REMEMBER: the number 5 is invisible) I need people, grass, dirt, snow, and plenty other things (including monsters) Please send them to my email address at coolnotsocool@live.com.au I have the ALPHA vesion of the game (with bad graphics) If you want it please email me for it. It also has some xamples. the numbers are like this (only 32 by 32) 5,5,5,5,5,5,5,1,5,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,5,1,5,1,5,5,5,5,5,5,5,5,5,5,5 5,5,5,5,5,1,5,5,5,1,5,5,5,5,5,5,5,5,5,5 5,5,5,5,1,5,5,5,5,5,1,5,5,5,5,5,5,5,5,5 5,5,5,1,5,5,5,5,5,5,5,1,5,5,5,5,5,5,5,5 5,5,1,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 1,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 5,1,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,5,5,5 Don't ask we what this is. from IP address 220.245.178.133 |
you totally missed the point *smacks forehead*byThis is your project, not ours. If you want someone on this forum to make some sprites for you you need to ask. What you did was inform us that we'll be making sprites in format x and giving them to you through method y. Don't get me wrong, I won't be making any either way, but I find it unlikely that you'll get what you want from others if you act that way. I've actually done this before, come to the forum and asked for some sprites for a game. (Sorry TheBOB, no I still haven't finished it, though I do still remember it and want to finish it,,, someday.) I got several, but (while I can't find my post) I'm pretty sure I was polite in asking, and I think I even made them myself and simply asked how to make them better (to which I was just given much better ones). PhyloGenesis from IP address 71.102.246.240 |
Generally, we love coding not drawing. Here's a link to heaps of tile graphics (*URL)by Galleonhttp://www.videogamesprites.net/Links/ from IP address 122.104.46.15 |
...now that you've chosen your graphics, we'd love to help you!by GalleonYou'll need a simple image editing program which can handle .bmp graphics and palettes. 1. Resize/clip your images until they are 32x32 2. Apply the 256 colour qbasic/system palette to them (assuming you are working in screen 13). 3. Save the image as a 256 color RGB encoded (not RLE encoded!!!) .bmp file. 4. The .bmp file can be loaded and used in your QBASIC program. (You'll probably need to use an existing .bas bmp loader or ask for some help, but I assure you for a 32x32 system palette'd image it is a VERY simple process) The qbasic/system palette is as follows (in RGB form from index 0 to 255): 0 0 0 0 0 168 0 168 0 0 168 168 168 0 0 168 0 168 168 84 0 168 168 168 84 84 84 84 84 252 84 252 84 84 252 252 252 84 84 252 84 252 252 252 84 252 252 252 0 0 0 20 20 20 32 32 32 44 44 44 56 56 56 68 68 68 80 80 80 96 96 96 112 112 112 128 128 128 144 144 144 160 160 160 180 180 180 200 200 200 224 224 224 252 252 252 0 0 252 64 0 252 124 0 252 188 0 252 252 0 252 252 0 188 252 0 124 252 0 64 252 0 0 252 64 0 252 124 0 252 188 0 252 252 0 188 252 0 124 252 0 64 252 0 0 252 0 0 252 64 0 252 124 0 252 188 0 252 252 0 188 252 0 124 252 0 64 252 124 124 252 156 124 252 188 124 252 220 124 252 252 124 252 252 124 220 252 124 188 252 124 156 252 124 124 252 156 124 252 188 124 252 220 124 252 252 124 220 252 124 188 252 124 156 252 124 124 252 124 124 252 156 124 252 188 124 252 220 124 252 252 124 220 252 124 188 252 124 156 252 180 180 252 196 180 252 216 180 252 232 180 252 252 180 252 252 180 232 252 180 216 252 180 196 252 180 180 252 196 180 252 216 180 252 232 180 252 252 180 232 252 180 216 252 180 196 252 180 180 252 180 180 252 196 180 252 216 180 252 232 180 252 252 180 232 252 180 216 252 180 196 252 0 0 112 28 0 112 56 0 112 84 0 112 112 0 112 112 0 84 112 0 56 112 0 28 112 0 0 112 28 0 112 56 0 112 84 0 112 112 0 84 112 0 56 112 0 28 112 0 0 112 0 0 112 28 0 112 56 0 112 84 0 112 112 0 84 112 0 56 112 0 28 112 56 56 112 68 56 112 84 56 112 96 56 112 112 56 112 112 56 96 112 56 84 112 56 68 112 56 56 112 68 56 112 84 56 112 96 56 112 112 56 96 112 56 84 112 56 68 112 56 56 112 56 56 112 68 56 112 84 56 112 96 56 112 112 56 96 112 56 84 112 56 68 112 80 80 112 88 80 112 96 80 112 104 80 112 112 80 112 112 80 104 112 80 96 112 80 88 112 80 80 112 88 80 112 96 80 112 104 80 112 112 80 104 112 80 96 112 80 88 112 80 80 112 80 80 112 88 80 112 96 80 112 104 80 112 112 80 104 112 80 96 112 80 88 112 0 0 64 16 0 64 32 0 64 48 0 64 64 0 64 64 0 48 64 0 32 64 0 16 64 0 0 64 16 0 64 32 0 64 48 0 64 64 0 48 64 0 32 64 0 16 64 0 0 64 0 0 64 16 0 64 32 0 64 48 0 64 64 0 48 64 0 32 64 0 16 64 32 32 64 40 32 64 48 32 64 56 32 64 64 32 64 64 32 56 64 32 48 64 32 40 64 32 32 64 40 32 64 48 32 64 56 32 64 64 32 56 64 32 48 64 32 40 64 32 32 64 32 32 64 40 32 64 48 32 64 56 32 64 64 32 56 64 32 48 64 32 40 64 44 44 64 48 44 64 52 44 64 60 44 64 64 44 64 64 44 60 64 44 52 64 44 48 64 44 44 64 48 44 64 52 44 64 60 44 64 64 44 60 64 44 52 64 44 48 64 44 44 64 44 44 64 48 44 64 52 44 64 60 44 64 64 44 60 64 44 52 64 44 48 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 from IP address 122.104.46.15 |
a = a + a$?byI asked the question before how you can do a$ = a$ + a and I got an answer so now I am asking the question can you do a = a + a$ and how do you do it. I need something like this: num = 10 PRINT "WELCOME TO THE NUMBER" INPUT "WHAT NUMBER WOULD YOU LIKE"; num$ num = num + num$ 'Here is the coding that I need PRINT "10 + "; num$; " = "; num I know that you can do INPUT num instead of num$ but I want to know if you can invert num$ into num from IP address 220.245.178.133 |
Yes, use VALby qbguynum = 10 PRINT "WELCOME TO THE NUMBER" INPUT "WHAT NUMBER WOULD YOU LIKE"; num$ num = num + VAL(num$) PRINT "10 + "; num$; " = "; num from IP address 75.9.211.189 |
*Darnit! I was logged out of n54 and you answered while I was logging in.by* from IP address 71.102.246.240 |
*There certainly is a way, namely VAL(a$).by* from IP address 71.102.246.240 |
*Using a string with INPUT also avoids a Redo from Start errorbyfrom IP address 71.60.226.47 |
Trying to convert binary file to ASCIIby traderI have some files from an old stock charting program that I want to use on a newer Linux program. The data is stored in BINARY format. Each record in the file represents one price bar and contains the date, open, high, low, and closing prices as well as the trading volume and open-interest for each bar's time frame (intraday, daily, weekly, etc.) Each bar on a chart is stored in the file as one record, 28 bytes in length. I'm trying to convert these type of BINARY files to ASCII. This is what I've written, but when I run the program on QBASIC 1.1 I have the following error message: "Subscript out of range An array element was referred to with a subscript that was outside the dimensions of the array, or an element of an undimensioned dynamic array was accessed. Check that the array is dimensioned and check the bounds of the array. You may also get this error if the array size exceeds 64K. Reduce the size of the array. Err code 9" The file "SP.D" I'm trying to convert is less than 64K. The debugger points to the line: DIM R(0 TO 2350) AS BAR 'Assumes < 2350 bars in file Can anyone see where the problem is?? Thanks, much appreciated!! 'NOTE: Reads a data file, prints the contents of the ' file to the screen, then saves the data to an ' ASCII text file. ' TYPE BAR D AS LONG '4 byte DATE O AS SINGLE '4 byte OPEN H AS SINGLE '4 byte HIGH L AS SINGLE '4 byte LOW C AS SINGLE '4 byte CLOSE V AS LONG '4 byte VOLUME I AS LONG '4 byte OPEN INTEREST or CLOCK TIME END TYPE DIM R(0 TO 2350) AS BAR 'Assumes < 2350 bars in file ' 'Read file ' FILENAME$ = "SP.D" OPEN FILENAME$ FOR RANDOM AS #1 LEN = 28 LastRecord% = LOF(1) / 28 FOR I% = 1 TO LastRecord% GET #1, I%, R(I%) PRINT R(I%).D; " "; R(I%).O; " "; R(I%).H; " "; R(I%).L; PRINT R(I%).C; " "; R(I%).V; " "; R(I%).I NEXT I% CLOSE #1 ' 'Output as ASCII file ' OPEN SP.ASC FOR OUTPUT AS #1 FOR I% = 1 TO LastRecord% WRITE #1, R(I%).D, R(I%).O, R(I%).H, R(I%).L, R(I%).C, R(I%).V, R(I%).I NEXT I% CLOSE #1 from IP address 96.227.120.156 |
Use PUT #2 and a RANDOM file instead of opening for OUTPUTbyR contains all of the data as the TYPE definition. So you don't need to load each TYPE Ted
from IP address 71.60.226.47 |
Your array is too big; try thisby'NOTE: Reads a data file, prints the contents of the ' file to the screen, then saves the data to an ' ASCII text file. ' TYPE BAR D AS LONG '4 byte DATE O AS SINGLE '4 byte OPEN H AS SINGLE '4 byte HIGH L AS SINGLE '4 byte LOW C AS SINGLE '4 byte CLOSE V AS LONG '4 byte VOLUME I AS LONG '4 byte OPEN INTEREST or CLOCK TIME END TYPE DIM Rec AS BAR ' 'Read file ' OPEN "SP.D" FOR RANDOM AS #1 LEN = 28 OPEN "SP.ASC" FOR OUTPUT AS #2 LastRecord% = LOF(1) \ 28 'Discards any fractional records FOR I% = 1 TO LastRecord% GET #1, I%, Rec PRINT Rec.D; " "; Rec.O; " "; Rec.H; " "; Rec.L; PRINT Rec.C; " "; Rec.V; " "; Rec.I WRITE #2, Rec.D, Rec.O, Rec.H, Rec.L, Rec.C, Rec.V, Rec.I NEXT I% CLOSE 'closes all files
from IP address 220.245.178.133 |
*Works great!!by trader:-) from IP address 71.185.153.195 |
Simple 3D programbyhttp://www.network54.com/Forum/190883/message/1209988526/3D+object I'm just playing with the whole rotation matrices thing. It's a quick-and-dirty little program, but I thought some of you might be interested. from IP address 220.245.178.132 |
*Ran program, got a blank screen. Help!by Ralph* from IP address 66.170.223.178 |
*Do other SCREEN 13 programs work for you?byfrom IP address 220.245.178.132 |
* Nothing works for Ralph! LOLbyfrom IP address 71.60.226.47 |
Yes, all other SCREEN 13 programs do work for me.by RalphAnd, when one doesn't, I usually get an error message that I can solve. In this case, nada! Hey, Ted, good tease, but, no cigar, 'cause you made me laughm ha, ha! from IP address 66.170.223.178 |
*Comment out the PAINT and see if you get an outlinebyfrom IP address 220.245.178.133 |
Solitaire - clean up on isle 5?by PeteI saw this in the index and I'm not sure which page it is on: http://www.network54.com/Forum/13959/message/1209952798/IDNLdXKorZ Spammers do this to build link recognition on search engines. If you can and would like to delete it, please do so. Thanks for your past efforts in this area, which I suspect go a bit unnoticed because of the great job you have done of zapping such posts. Pete
from IP address 70.177.5.114 |
*Hear, hear -- but seriously, where's Mac?by* from IP address 74.15.66.121 |
GOODquestion, but Pete and Solitaire have no email addresses!byThe TWO people that should know are not saying anything, but they come here to post like any other anonymous person because neither use an email address! You wanna piece of me? My address is free to mess with! People that toss away crap just cover their own freaking asses! As BIG an ass that I can be sometimes, I have ended up making more friends than enemies. People usually respect honesty! I EXPECT a Freaking answer SOON! MAC has a lot of balls and so do I! I miss him......I hope he is OK! Ted
from IP address 71.60.226.47 |
* I sent Mac an email 2 or 3 days ago but have not received a response.by Solitairefrom IP address 67.90.218.94 |
Spam deleted. I do hope Mac is OK.by SolitaireI've had a series of personal problems and was unable to check the computer more than once for a few minutes yesterday. The first problem arose several days ago when my desktop computer died. My son temporarily brought up a flaky computer from the basement to use. It has only the basic OS and Office installed, but not the rest of my software. It also has a nasty habit of shutting down every few minutes so it's just not reliable. My son ordered parts to build a new computer from scratch, but that will take awhile to complete. My laptop also has a problem. The BIOS battery died and I have to keep reconfiguring it every time I turn it on. Other more serious family health problems came up, which I won't go into now. My son lost his wallet with all his ID cards in a movie theater day before yesterday. Our car is about to die and needs to be replaced. He drove it out to Long Island and got stuck there at a friend's house when it wouldn't start. He called me at 4:30 AM this morning to get the number of AAA. I just emailed him a copy of the registration, which he didn't have on him. I have to get to school in a couple of hours, and I have a doctor's appointment after that. I'll try to email Mac to see if he replies. If he's on vacation, he may not have access to a computer.
from IP address 74.73.58.57 |
* You would think that he would have told somebody........byfrom IP address 71.60.226.47 |
I can not think that he would knowingly leave without letting someone knowby royWhich would seem to imply that he is ill. Pete did mention a vacation just after Mac vanished but I don't know what made him say that. from IP address 82.18.11.35 |
Refering to my menu seen belowby New GuyOk the menu I have in the below forum I am trying to make the blood on the letter L fall downwards(eventually it will loop and fall into a pool of blood!. I was able to acheive this by using(FOR row = 94 155)Then putting row in the position of the PUT blood statment. I then tried to WAIT it so it could be seen. However it went to fast and wheneve I tried to take the number 8 in my Wait statement to a lower number the screen froze. Can someone help with this! from IP address 208.108.221.87 |
The 8 in the WAIT statement does not refer to duration...byIt is a value that must be retrieved from the &H3DA port to indicate a condition of screen refresh -- in other words, don't mess with it! If you want to create a longer delay, just multiply the number of times you WAIT: FOR Reps = 1 TO 5 '<---adjust up or down until speed is correct WAIT &H3DA, 8: WAIT &H3DA, 8, 8 NEXT Reps -Bob from IP address 70.52.180.222 |
*Use the TIMER command, but remember it is only accurate to 1/18th of a second.byfrom IP address 58.106.166.35 |
Timer delays go something like this...by PeteSPEED% = 2: REM Where 1 / SPEED% controls the seconds of the delay. from IP address 70.177.5.114 |
* You mean "referring". Even the HTTP spec gets it wrong.by Speeling Policefrom IP address 75.9.211.189 |
Ok How do I fix this. I got confused by what you guys saidby New GuyThe blood is dropping but its dropping with a trail and the screen goes blank untill it finishes dropping, how can i fix this? DECLARE SUB welcome (Print$) DECLARE SUB background (line$) DECLARE SUB bloodinvaders (Print$) '*** Space invaders! **** '**** Justin Singleton, Grogan DEFINT A-Z SCREEN 7 CLS '**BLOOD** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,04,00,00,00,00 DATA 00,00,00,04,04,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ blood PSET (x, y), blood NEXT x NEXT y DIM blood%(90) GET (0, 0)-(9, 10), blood% '**NEEDLE** DATA 00,00,00,00,00,00,00,00,15 DATA 00,00,00,00,15,00,15,15,00 DATA 00,00,00,00,00,15,04,15,00 DATA 00,00,00,00,15,04,15,00,00 DATA 00,15,00,15,04,15,00,15,00 DATA 00,00,15,04,15,00,00,00,00 DATA 00,00,04,15,00,00,00,00,00 DATA 00,04,00,00,15,00,00,00,00 DATA 04,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ needle PSET (x, y), needle NEXT x NEXT y DIM needle%(90) GET (0, 0)-(9, 10), needle% '**CROSS** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,04,15,15,04,15,15,04,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ cross PSET (x, y), cross NEXT x NEXT y DIM cross%(90) GET (0, 0)-(9, 10), cross% CLS PUT (166, 102), needle PUT (95, 86), cross PUT (192, 86), cross PUT (82, 110), cross PUT (221, 110), cross PUT (132, 94), blood '***Making the blood fall*** FOR row = 94 TO 155 PUT (132, row), blood WAIT &H3DA, 8: WAIT &H3DA, 8, 8 NEXT row CALL bloodinvaders(Print$) CALL background(line$) CALL welcome(Print$) END SUB background (line$) '*** LINE ***============================= COLOR 5, 0 LINE (1, 1)-(1, 190) COLOR 5, 0 LINE (1, 190)-(310, 190) COLOR 5, 0 LINE (310, 190)-(310, 1) COLOR 5, 0 LINE (1, 1)-(310, 1) '***END of Line***======================== '***Other graphics***===================== END SUB DEFSNG A-Z SUB bloodinvaders (Print$) SCREEN 7 COLOR 4, 0 LOCATE 12, 15 PRINT "B" COLOR 15, 0 LOCATE 12, 17 PRINT "L" COLOR 4, 0 LOCATE 12, 19 PRINT "O" LOCATE 12, 21 COLOR 4, 0 PRINT "O" COLOR 4, 0 LOCATE 12, 23 PRINT "D " LOCATE 15, 13 COLOR 4, 0 PRINT "I" LOCATE 15, 15 COLOR 4, 0 PRINT "N" LOCATE 15, 17 COLOR 4, 0 PRINT "V" LOCATE 15, 19 COLOR 4, 0 PRINT "A" LOCATE 15, 21 COLOR 15, 0 PRINT "D" LOCATE 15, 23 COLOR 4, 0 PRINT "E" LOCATE 15, 25 COLOR 4, 0 PRINT "R" LOCATE 15, 27 COLOR 4, 0 PRINT "S" END SUB SUB welcome (Print$) LOCATE 3, 3 COLOR 5, 0 PRINT "1."; " Let's Play" LOCATE 23, 26 PRINT "2."; " Let's Not" END SUB from IP address 208.108.223.201 |
Here you go, New Guy...byFOR row = 94 TO 155 PUT (132, row), blood, PSET '<----------- add PSET WAIT &H3DA, 8: WAIT &H3DA, 8, 8 NEXT row There are a number of ways you can PUT an image. If you don't specify (as in your case) it uses default XOR which mixes colors with underlying images - hence the red trail. Using PSET overwrites anything that is under it. -Bob from IP address 74.15.65.107 |
That got rid of the trail! But also the animation?by New GuyThe animation was also taken out of that. How can I get it to stay on the L, and keep dripping off. Then when comes into contact with blood pool it disseapears and restarts. Anyone understand what I'm trying to do? from IP address 208.108.221.87 |
*Never mind. I put it into a loop! Only problem is it gets rid of the background!by New Guy* from IP address 208.108.223.201 |
Again never mind! I fixed that. Now I need the blood to stay on the L!by New GuyOk I need the blood to stay on the L and dissapear when it reaches point 155!Anyone know how to do that? Below is the updated version! DECLARE SUB welcome (Print$) DECLARE SUB background (line$) DECLARE SUB bloodinvaders (Print$) '*** Space invaders! **** '**** Justin Singleton, Grogan DEFINT A-Z SCREEN 7 CLS '**BLOOD** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,04,00,00,00,00 DATA 00,00,00,04,04,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ blood PSET (x, y), blood NEXT x NEXT y DIM blood%(90) GET (0, 0)-(9, 10), blood% '**NEEDLE** DATA 00,00,00,00,00,00,00,00,15 DATA 00,00,00,00,15,00,15,15,00 DATA 00,00,00,00,00,15,04,15,00 DATA 00,00,00,00,15,04,15,00,00 DATA 00,15,00,15,04,15,00,15,00 DATA 00,00,15,04,15,00,00,00,00 DATA 00,00,04,15,00,00,00,00,00 DATA 00,04,00,00,15,00,00,00,00 DATA 04,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ needle PSET (x, y), needle NEXT x NEXT y DIM needle%(90) GET (0, 0)-(9, 10), needle% '**CROSS** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,04,15,15,04,15,15,04,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ cross PSET (x, y), cross NEXT x NEXT y DIM cross%(90) GET (0, 0)-(9, 10), cross% CLS PUT (166, 102), needle PUT (95, 86), cross PUT (192, 86), cross PUT (82, 110), cross PUT (221, 110), cross PUT (132, 94), blood '***Making the blood fall*** DO FOR row = 94 TO 155 PUT (132, row), blood, PSET WAIT &H3DA, 8: WAIT &H3DA, 8, 8 WAIT &H3DA, 8: WAIT &H3DA, 8, 8 NEXT row CALL bloodinvaders(Print$) CALL background(line$) CALL welcome(Print$) LOOP END SUB background (line$) '*** LINE ***============================= COLOR 5, 0 LINE (1, 1)-(1, 190) COLOR 5, 0 LINE (1, 190)-(310, 190) COLOR 5, 0 LINE (310, 190)-(310, 1) COLOR 5, 0 LINE (1, 1)-(310, 1) '***END of Line***======================== '***Other graphics***===================== END SUB DEFSNG A-Z SUB bloodinvaders (Print$) SCREEN 7 COLOR 4, 0 LOCATE 12, 15 PRINT "B" COLOR 15, 0 LOCATE 12, 17 PRINT "L" COLOR 4, 0 LOCATE 12, 19 PRINT "O" LOCATE 12, 21 COLOR 4, 0 PRINT "O" COLOR 4, 0 LOCATE 12, 23 PRINT "D " LOCATE 15, 13 COLOR 4, 0 PRINT "I" LOCATE 15, 15 COLOR 4, 0 PRINT "N" LOCATE 15, 17 COLOR 4, 0 PRINT "V" LOCATE 15, 19 COLOR 4, 0 PRINT "A" LOCATE 15, 21 COLOR 15, 0 PRINT "D" LOCATE 15, 23 COLOR 4, 0 PRINT "E" LOCATE 15, 25 COLOR 4, 0 PRINT "R" LOCATE 15, 27 COLOR 4, 0 PRINT "S" END SUB SUB welcome (Print$) LOCATE 3, 3 COLOR 5, 0 PRINT "1."; " Let's Play" LOCATE 23, 26 PRINT "2."; " Let's Not" END SUB from IP address 208.108.223.201 |
Um now the loop is preventing the game!by New GuyUm we added this to our main game but the loop I added prevents the game from starting. This is a minor complication! How do I fix this? from IP address 208.108.223.201 |
Put this in your loopby roycoice$ = INKEY$ IF coice$ = "1" THEN EXIT DO IF coice$ = "2" THEN SYSTEM from IP address 82.18.11.35 |
*Before the Speeling police get here, I meant choice$.by roy* from IP address 82.18.11.35 |
Again never mind! I fixed that. Now I need the blood to stay on the L!by New GuyOk I need the blood to stay on the L and dissapear when it reaches point 155!Anyone know how to do that? Below is the updated version! DECLARE SUB welcome (Print$) DECLARE SUB background (line$) DECLARE SUB bloodinvaders (Print$) '*** Space invaders! **** '**** Justin Singleton, Grogan DEFINT A-Z SCREEN 7 CLS '**BLOOD** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,04,00,00,00,00 DATA 00,00,00,04,04,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ blood PSET (x, y), blood NEXT x NEXT y DIM blood%(90) GET (0, 0)-(9, 10), blood% '**NEEDLE** DATA 00,00,00,00,00,00,00,00,15 DATA 00,00,00,00,15,00,15,15,00 DATA 00,00,00,00,00,15,04,15,00 DATA 00,00,00,00,15,04,15,00,00 DATA 00,15,00,15,04,15,00,15,00 DATA 00,00,15,04,15,00,00,00,00 DATA 00,00,04,15,00,00,00,00,00 DATA 00,04,00,00,15,00,00,00,00 DATA 04,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ needle PSET (x, y), needle NEXT x NEXT y DIM needle%(90) GET (0, 0)-(9, 10), needle% '**CROSS** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,04,15,15,04,15,15,04,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ cross PSET (x, y), cross NEXT x NEXT y DIM cross%(90) GET (0, 0)-(9, 10), cross% CLS PUT (166, 102), needle PUT (95, 86), cross PUT (192, 86), cross PUT (82, 110), cross PUT (221, 110), cross PUT (132, 94), blood '***Making the blood fall*** DO FOR row = 94 TO 155 PUT (132, row), blood, PSET WAIT &H3DA, 8: WAIT &H3DA, 8, 8 WAIT &H3DA, 8: WAIT &H3DA, 8, 8 NEXT row CALL bloodinvaders(Print$) CALL background(line$) CALL welcome(Print$) LOOP END SUB background (line$) '*** LINE ***============================= COLOR 5, 0 LINE (1, 1)-(1, 190) COLOR 5, 0 LINE (1, 190)-(310, 190) COLOR 5, 0 LINE (310, 190)-(310, 1) COLOR 5, 0 LINE (1, 1)-(310, 1) '***END of Line***======================== '***Other graphics***===================== END SUB DEFSNG A-Z SUB bloodinvaders (Print$) SCREEN 7 COLOR 4, 0 LOCATE 12, 15 PRINT "B" COLOR 15, 0 LOCATE 12, 17 PRINT "L" COLOR 4, 0 LOCATE 12, 19 PRINT "O" LOCATE 12, 21 COLOR 4, 0 PRINT "O" COLOR 4, 0 LOCATE 12, 23 PRINT "D " LOCATE 15, 13 COLOR 4, 0 PRINT "I" LOCATE 15, 15 COLOR 4, 0 PRINT "N" LOCATE 15, 17 COLOR 4, 0 PRINT "V" LOCATE 15, 19 COLOR 4, 0 PRINT "A" LOCATE 15, 21 COLOR 15, 0 PRINT "D" LOCATE 15, 23 COLOR 4, 0 PRINT "E" LOCATE 15, 25 COLOR 4, 0 PRINT "R" LOCATE 15, 27 COLOR 4, 0 PRINT "S" END SUB SUB welcome (Print$) LOCATE 3, 3 COLOR 5, 0 PRINT "1."; " Let's Play" LOCATE 23, 26 PRINT "2."; " Let's Not" END SUB from IP address 208.108.221.87 |
If that's what you want to do, then you'll need to set aside your project for awhile...by...and study graphics programming a bit more. What you want to do requires a mask and is a fairly sophisticated process for a beginner. If you're interested, download the tutorials here: http://www.network54.com/Realm/QBZips/QBZips.html Grab both QBG1 and QBG2 and after unzipping, run QBG.EXE and click the lesson on animation. It explains about the use of masks (animating sprites while not disturbing the existing background). This all assumes that you'd like to be able to program graphics in QBasic for yourself. If you just want the code, maybe you could team up with someone who is knowledgable about graphics. -Bob from IP address 70.52.182.250 |
Unfortunately were the farthest ahead in the class!by New GuyIt would be nice if we could ask a classmate about it, but everyone takes the class as a joke or for any easy grade. Were just trying to get a little more out of it! Thanks though. I think were gonna just perfect what we have and hand it in! from IP address 24.140.121.38 |
Sry I need to save this here. It got changed on my Flash!by New GuySry. This is what I have of our main menu right now! DECLARE SUB welcome (Print$) DECLARE SUB background (line$) DECLARE SUB bloodinvaders (Print$) '*** Space invaders! **** '**** Justin Singleton, Grogan DEFINT A-Z SCREEN 7 CLS '**BLOOD** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,00,04,00,00,00,00 DATA 00,00,00,04,04,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,04,04,04,04,04,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ blood PSET (x, y), blood NEXT x NEXT y DIM blood%(90) GET (0, 0)-(9, 10), blood% '**NEEDLE** DATA 00,00,00,00,00,00,00,00,15 DATA 00,00,00,00,15,00,15,15,00 DATA 00,00,00,00,00,15,04,15,00 DATA 00,00,00,00,15,04,15,00,00 DATA 00,15,00,15,04,15,00,15,00 DATA 00,00,15,04,15,00,00,00,00 DATA 00,00,04,15,00,00,00,00,00 DATA 00,04,00,00,15,00,00,00,00 DATA 04,00,00,00,00,00,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ needle PSET (x, y), needle NEXT x NEXT y DIM needle%(90) GET (0, 0)-(9, 10), needle% '**CROSS** DATA 00,00,00,00,00,00,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,04,15,15,04,15,15,04,00 DATA 00,04,04,04,15,04,04,04,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,15,04,00,00,00 DATA 00,00,00,04,04,04,00,00,00 DATA 00,00,00,00,00,00,00,00,00 FOR y = 0 TO 9 FOR x = 0 TO 8 READ cross PSET (x, y), cross NEXT x NEXT y DIM cross%(90) GET (0, 0)-(9, 10), cross% CLS PUT (166, 102), needle PUT (95, 86), cross PUT (192, 86), cross PUT (82, 110), cross PUT (221, 110), cross PUT (132, 94), blood CALL bloodinvaders(Print$) CALL background(line$) CALL welcome(Print$) END SUB background (line$) '*** LINE ***============================= COLOR 5, 0 LINE (1, 1)-(1, 190) COLOR 5, 0 LINE (1, 190)-(310, 190) COLOR 5, 0 LINE (310, 190)-(310, 1) COLOR 5, 0 LINE (1, 1)-(310, 1) '***END of Line***======================== '***Other graphics***===================== END SUB DEFSNG A-Z SUB bloodinvaders (Print$) SCREEN 7 COLOR 4, 0 LOCATE 12, 15 PRINT "B" COLOR 15, 0 LOCATE 12, 17 PRINT "L" COLOR 4, 0 LOCATE 12, 19 PRINT "O" LOCATE 12, 21 COLOR 4, 0 PRINT "O" COLOR 4, 0 LOCATE 12, 23 PRINT "D " LOCATE 15, 13 COLOR 4, 0 PRINT "I" LOCATE 15, 15 COLOR 4, 0 PRINT "N" LOCATE 15, 17 COLOR 4, 0 PRINT "V" LOCATE 15, 19 COLOR 4, 0 PRINT "A" LOCATE 15, 21 COLOR 15, 0 PRINT "D" LOCATE 15, 23 COLOR 4, 0 PRINT "E" LOCATE 15, 25 COLOR 4, 0 PRINT "R" LOCATE 15, 27 COLOR 4, 0 PRINT "S" END SUB SUB welcome (Print$) LOCATE 3, 3 COLOR 5, 0 PRINT "1."; " Let's Play" LOCATE 23, 26 PRINT "2."; " Let's Not" END SUB
from IP address 208.108.223.201 |
We nearly perfected your programby royDid you run the last program in The Big Programs Forum that I gave you. If you are going to change the whole program then I will hand you over to Clippy with this advice. To continue you will need to guide them through POINT(0) and POINT(1). PS. Best of luck. from IP address 82.18.11.35 |
LOL at "hand you over to Clippy"byRoy, ya did good, despite our hatred! You took the ball and ran well, so I cannot find anything to jerk you around on unfortunately. Well done you BRIT! Stick around because you can do things besides jerking people off.......... Ted from IP address 71.60.226.47 |
*Looks niceby roy* from IP address 82.18.11.35 |
Why no error message?by RalphWhy doesn't the following code produce an error message? The array is only DIMmed to (90), yet the GET covers an area of 15*21 = 315: DIM blood%(90) GET (0,0)-(14,20),blood% I started with the OP's two lines, DIM blood%(90) GET (0,0)-(9,10),blood% in which the array blood% GETs 10*11 = 110 points. Why no error? from IP address 66.170.223.178 |
Try reading back through the arraybyPlace a white PSET in the bottom right corner of the area you will GET. Then read the elements going back through the array from the highest element. FOR i = 90 TO 0 STEP -1 IF Array(i) > 0 THEN PRINT i: EXIT FOR NEXT This will tell you the last element used in the array. GET may not use all of the elements available. Ted from IP address 71.60.226.47 |
Why no error message?by RalphMy question was, why no error message? If I try this: DIM blood%(90) GET (0,0)-(14,22),blood% I get an "Illegal function call" on the last line. But not with: DIM blood%(90) GET (0,0)-(14,21),blood% So, why do I get an illegal function call with y= 21, but not with y= 20? from IP address 66.170.223.178 |
Re:Why no error message?by RalphPlease forgive me. My last line should have referred to 22 and 21, not 21 and 20. from IP address 66.170.223.178 |
Re: Re:Why no error message?by LaananFisherIIRC, QBasic will throw an illegal function call if the array used in the GET statement isn't large enough to hold the bitmap data (which consists of a small header and the pixel information). From the QBasic online help: Use bits-per-pixel-per-plane and planes values to determine the required size of the array that holds a graphics screen image. Bits-per-pixel-per-plane and planes values, along with the horizontal resolution, also determine which screen modes are compatibile: <pre> Horizontal Bits-per-pixel- resolution Screen mode per-plane Planes (in pixels) ---------------------------- --------------- ------ ----------- 1 2 1 320 2, 4, 11 1 1 640 3 1 1 720 7 1 4 320 8, 9(> 64K video memory), 12 1 4 640 9(64K video memory), 10 1 2 640 13 8 1 320 </pre> The following formula gives the required size, in bytes, of an array used to hold a captured image: <pre> size% = 4 + INT(((PMAP (x2!, 0) - PMAP (x1!, 0) + 1) * (bits-per-pixel-per-plane%) + 7) / 8) * planes% * (PMAP (y2!, 1) - PMAP (y1!, 1) + 1) </pre> GET and PUT operations are compatible in screen modes with the same horizontal resolution and bits-per-pixel-per-plane and planes values. For example, screen modes 2, 4, and 11 are compatible, and screen modes 8 and 12 are compatible. from IP address 67.177.189.44 |
Maybe this will clear things up a bitby LaananFisherAh, sorry about the formatting of the previous post. Here's a partial program that should help understand what all that gibberish means: http://copy-pasta.com/pasta156969 (I would post the code here or in "Tips and Tricks", but the <pre></pre> tags don't work there either, plus copy-pasta.com has a QB syntax highlighter, and you can click on keywords to get more help, a little buggy but still pretty helpful.) from IP address 67.177.189.44 |
Here is the Function code for any screen available in QBbyDEFINT A-Z INPUT "Enter Screen mode: ", screenmode Bytes = ImageBufferSize(wide, deep, screenmode) PRINT "Bytes ="; Bytes PRINT "Integers ="; INT((Bytes + 1) / 2) FUNCTION ImageBufferSize (wide, deep, Screenmode) SELECT CASE screenmode ImageBufferSize = 4 + INT((wide * BPPlane + 7) / 8) * (deep * Planes) END FUNCTION
from IP address 71.60.226.47 |
Re: Here is the Function code for any screen available in QBby LaananFisherClippy, if you're going to copy code, it might be wise to copy without modification, to avoid introducing bugs and/or misinformation. Bytes / whatever will round down if possible, so you end up with a value that is too small. (the INT business isn't just fluff, it's necessary) Just some nitpicking things: - image "depth" usually refers to the number of unique colors that can be represented by a pixel. "height" is probably more appropriate. Or perhaps, "columns", "rows".. - "BPPlane": unless "B" stands for "Bytes per pixel", it should probably be "BppPerPlane", as it represents the number of bytes per pixel per plane. - Good luck. from IP address 67.177.189.44 |
* BYTE ME ASS ..... you were too lazy to do it!by
from IP address 71.60.226.47 |
Re: * BYTE ME ASS ..... you were too lazy to do it!by LaananFisherBTW, thanks for taking the time to format the code snippet, Clippy. Sorry if I came off as rude, I didn't mean to be. from IP address 67.177.189.44 |
No problembyI really only saw a need for Integers originally, but I think that the Function value should actually be LONG to allow for larger dimensioned GET areas. The present code only allows for values under 32768. Otherwise it will Overflow. As to the rounding method, I just rounded the values up in my head until you commented........... I never really saw a reason to use Double values in the array. Ted from IP address 71.60.226.47 |
* s/bytes per/bits per/g, sorryby LaananFisherfrom IP address 67.177.189.44 |
Newguy's program should not give an errorby roybecause you deduct one from each number before multiplying but I do not understand why 14,21 does not give an error, even after reading LaananFisher's post. We need a better explanation from one of our experts in this. from IP address 82.18.11.35 |
Re: Newguy's program should not give an errorby LaananFisher(0,0)-(14,21) is 15x22, plug that into the formula for screen mode 7 and you get a required number of bytes of 180, which is 90 INTEGERs worth. (0,0)-(14,22) is 15x23, plug that in and you get a required number of bytes of 188, or 94 INTEGERs worth. Keep in mind that different screen modes store color (pixel) information differently, some use a full byte, while some use only a partial byte, others interleave different pixels within the same byte, etc., etc. You don't need to know the details (unless you are working directly with video/image buffer memory), you only need to know that formula. Something like, DIM image%(w*h) should be fine for all screen modes, but you should at least try and understand what's going on. As it is, the above declaration wastes a good deal of space, and it's wise to avoid that, particularly when running a program in the IDE. from IP address 67.177.189.44 |
*Thanksby roy* from IP address 82.18.11.35 |
Using INKEY$by noob08I am making a game and I currently have a title screen. I am trying to figure out how to start the game by using INKEY$. I want it to start the game (call the subprogram for the game) if you press "1" and exit the game if you press "esc". I have been trying to get this to work for a while and I can't figure it out. Any help would be appreciated. from IP address 24.140.126.214 |
INKEY$by PeteCLS --------------------- This routine prints the key pressed and the ASCII character associated with it. You need to know those values, like CHR$(27), which is the ESC key. The ASCII values are in QB Help. Type ASC and press F1 to see the ASCII character set table. Pete
from IP address 70.177.5.114 |
I need help setting up this Programby ScottI need big time help... i need to set up a program dealing with numbers....positives...neatives..etc... ill give the exact problem to the person willing to help me..id appreciate it so MUCHHHHHHHHHH from IP address 99.142.45.249 |
* Post what code you have made so far.byfrom IP address 71.60.226.47 |
Re: * Post what code you have made so far.by SCOTTIm using the data=list Containing twenty Numbers...how many are positive , negative , zero ..I am using "read" and "data" statements.. I am corporating loops, reads, trip-codes, decisions, etc.... I cannot change the Data elements, im trying to use 21 as my trip code... the output i believe should be centered on the page, and the values are centered under the headings... DATA: 10, 2, 0, -6, 5,72, 60,1,61,4,-80,-14,90,89,100,-42,17,55,48,21 i NEED help designing the flow chart... Anybody have any thoughts or suggestions.. Also.... i need to put it into QBASIC..so i need assistance on the exact computer text to write into the PROGRAM.. HELP IS GREATLY NEEDED....! from IP address 99.142.45.249 |
*You have still not shown us your attempt at thisby roy* from IP address 82.18.11.35 |
Re: *You have still not shown us your attempt at thisby Scottim havingf difficulty starting it off...! can anybody assist me...! from IP address 99.142.45.249 |
You need to...by Pete1) READ the data and make a variable to go with the read statement, like number% 2) Make a counter for numbers > 0, 0, and numbers less than 0. 3) Print the results. Check the READ statement and make a simple array like results(3) where: results(1) = the count for numbers less than zero Then you just make a for next loop 1-3 to pront the results. If you don't want or are not permitted to use an array, just make three variables like: numbersbelowzero% numbersequaltozero% numbersgreaterthanzero% Then each time the READ statement gets a number, you evaluate it through a SELECT CASE or a three-way IF/THEN Statement. SELECT CASE [You figure this part out] or the IF THEN... IF [The number Read] < 0 THEN When all are counted, you need to read about the PRINT statement in QB Help and print the results... PRINT "Numbers below zero: "; numbersbelowzero% ------------------------------------------------ Pete
from IP address 70.177.5.114 |
You don't need SELECT CASE or IF statements. Just use SGNby qbguyDIM A(0 TO 2) To center the numbers and headings, you just use TAB and some arithmetic. To find out how much you tab over, you just do 40-(length of string/2). So you'd to this:
from IP address 75.9.211.189 |
qbguy: This is a homework assignment.by SolitaireWe don't supply code for students working on homework assignments. The only reason I haven't deleted your post is because it's probably more advanced than the class has gotten to so far, and the teacher (hopefully) will be able to spot it as something the student did not do for himself. from IP address 74.73.58.57 |
* Solitaire please delete it and watch his STUPID posts!byfrom IP address 71.60.226.47 |
*Too late, The OP has already seen the code, and Bob's post makes reference to it.by Solitairefrom IP address 74.73.58.57 |
You could dim the array from -1 to 1 instead of adding 1 to the indexby BobDIM A(-1 TO 1) FOR I = 1 TO 20 READ J A(SGN(J)) = A(SGN(J)) + 1 NEXT DATA 10,2,0,-6,5,72,60,1,61,4,-80,-14,90,89,100,-42,17,55,48,21 Actually, FORTRAN 77 has a "ternary if" whihc branches based on x < 0, x = 0, x > 0 IF (e) label1, label2, label3 I think it was depreciated in FORTRAN 90 because it is not very structured. from IP address 85.195.123.25 |
Scott: You need to write your own homework code.by Solitaire |