|
Post by aka on Mar 19, 2006 22:30:06 GMT -5
Alright so I have been doing a lot of searching and reading about how to program my own game using BASIC LANGUAGE and I have found some usefull advice in this link doorknobsoft.tripod.com/qbasic_tutorial.html but some of the commands are not the same as in BasiEgaXorz. Here's an example of some cammands for making a small game....... CLS y = 2 x = 1
COLOR 15 PRINT "0000000" PRINT " " PRINT "0 000 0" PRINT "0 0 0 0" PRINT "0 0" PRINT "0 000 0" PRINT " 0 " PRINT "0 0" PRINT "0000000"
DO
a$ = INKEY$ checky = y: checkx = x LOCATE y, x: COLOR 0: PRINT "X" IF a$ = "8" AND y - 1 > 0 THEN checky = y - 1 IF a$ = "4" AND x - 1 > 0 THEN checkx = x - 1 IF a$ = "2" THEN checky = y + 1 IF a$ = "6" THEN checkx = x + 1 IF SCREEN(checky, checkx) <> 48 THEN y = checky x = checkx END IF IF X > 7 then x = 7 LOCATE y, x: COLOR 15: PRINT "X" LOCATE 10, 10: PRINT x, y, checkx, checky LOOP UNTIL a$ = "Q" OR a$ = "q" Now when I try to compile that after I change the command color to ink I get alot off errors so how can I use this with BasiEgaXorz. [if it is not possible please let me know] Thanks ;D
|
|
|
Post by Tom Maneiro on Mar 20, 2006 10:11:20 GMT -5
It will NOT compile because this is PC BASIC, not BEX BASIC. Here is your converted code: CLS y = 2 x = 1
ink 2 PRINT "0000000" PRINT " " PRINT "0 000 0" PRINT "0 0 0 0" PRINT "0 0" PRINT "0 000 0" PRINT " 0 " PRINT "0 0" PRINT "0000000"
DO
input "Gimme data!", a$ checky = y: checkx = x LOCATE y, x: ink 0: PRINT "X" IF a$ = "8" [AND] y - 1 > 0 THEN checky = y - 1 IF a$ = "4" [AND] x - 1 > 0 THEN checkx = x - 1 IF a$ = "2" THEN checky = y + 1 IF a$ = "6" THEN checkx = x + 1 'this part has no equivalent on BEX. 'Want to read a char in the screen? 'BEX can't do that yet... you will need to recode this 'IF SCREEN(checky, checkx) <> 48 THEN ' y = checky ' x = checkx 'END IF IF X > 7 then x = 7 LOCATE y, x: ink 2: PRINT "X" LOCATE 10, 10: PRINT x, y, checkx, checky LOOP UNTIL a$ = "Q" [OR] a$ = "q"
This may or may not compile. The manual and the forum search engine are your best friends
|
|
|
Post by aka on Mar 21, 2006 4:34:19 GMT -5
It did not compile but thanks for the help ;D
|
|
|
Post by SonicCD on Mar 21, 2006 16:30:12 GMT -5
btw, what is that ? (What is it supposed to do - JIC - i have QBX
|
|
|
Post by haroldoop on Mar 22, 2006 5:43:26 GMT -5
Seens like an skeleton of a game where you move an "X" through a labyrinth of "O"'s, using the numerical keypad with num lock on.
This reads the last pressed key: a$ = INKEY$
This changes the player coordinates according to which key he pressed, also checking if he's not going outside the maze: IF a$ = "8" AND y - 1 > 0 THEN checky = y - 1 IF a$ = "4" AND x - 1 > 0 THEN checkx = x - 1 IF a$ = "2" THEN checky = y + 1 IF a$ = "6" THEN checkx = x + 1
This checks if he's not colliding with an "O". If he's not, sets the player coordinates to the new ones: IF SCREEN(checky, checkx) <> 48 THEN y = checky x = checkx END IF
This puts the "X" on the correct position: LOCATE y, x: COLOR 15: PRINT "X"
Well, that's it.
|
|
|
Post by Tom Maneiro on Mar 24, 2006 14:26:51 GMT -5
The SCREEN(x,y) has no equivalent in BEX, but check chicken.bex (included with BEX 0.19 samples) for collision detection in action.
|
|
|
Post by aka on Mar 24, 2006 15:46:31 GMT -5
The SCREEN(x,y) has no equivalent in BEX, but check chicken.bex (included with BEX 0.19 samples) for collision detection in action. Hi Tom Maneiro I would download BEX 0.19 again to check out the sample but that version doesn't seem to work well with Win XP I got a Runing Time Error when I tryed to use it last time........... That and I can only download the newest version of BEX but I think I seen that some site had chicken go weee with the source code so maybe I'll check it out I'm sure that it would help me
|
|
|
Post by Tom Maneiro on Mar 25, 2006 12:39:13 GMT -5
Use my installer located at File Gallery on Eidolons-Inn, then replace the BEX EXE with the one of the latest version
|
|
|
Post by aka on Mar 26, 2006 3:20:15 GMT -5
WOW!! ;D That's alot of examples these will definitely help me learn more ;D ;D ;D Thank you Tom Maneiro
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Apr 10, 2006 17:23:07 GMT -5
sorry i didn't include any examples in the newest public release, like i use to ! i'll try to get these included as soon as i can , or will make an additional atatchment to the downloads, so i can always update the exmplaes for a SCREEN(X,Y) equavalent, you'll need to read the VRAM directly. here's an example: print "Hello World!" print "2nd Line" print print " -- This is a copy cat example --" print chr$(1) + chr$(1) + chr$(1) + chr$(1) + chr$(1) + chr$(1)
locate 10,0: ink 1 for y=0 to 9 for x=0 to 37 ' You screen X and Y here getchar = vdpramread(49152 + (x+1<<1) + (y+1<<7)) [AND] 255 print chr$(getchar); next print next
i didn't use basiegaxorz v0.19 because the new release didn't work right for some reason =/ (keeps crashing the compiler each time i compile). the most important part of this code is: getchar = vdpramread(49152 + (x+1<<1) + (y+1<<7)) [AND] 255 49152 is actually $C000 in hex. v0.19 doesn't like hex values, so it's in decimal . $C000 is an address, and is the begining of Plane A in video memory. X and Y are incremented because actual drawing with the PRINT command starts at X=1, Y=1. If you notice, the maximum screen width for basiegaxorz is 38 because some TVs don't display the edges at all. The maximum width for the hardware is actually 40 (as in 40 cell mode). X is multiplied by 2 (the same as <<1) so that we are at an EVEN address, since the vram is 16 bit. Y is multiplied by 128 (same as <<7) because the plane width is set to 64 cells wide. It is then multiplied by 2 for the same reason of obtaining an EVEN address. Once VRAM is read, we only want the lower 8 bits (the one that holds the actual character), so we AND it with 255 ($FF). voila, given the X and Y coordinates, getchar will return the character at X and Y
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Apr 11, 2006 0:39:39 GMT -5
i was playing with the compiler and fixing bugs i found with hexidecimal number, and then i rescripted your quick basic game for basiegaxorz ;D
cls y = 2 x = 1
ink 3 print "0000000" print " " print "0 000 0" print "0 0 0 0" print "0 0" print "0 000 0" print " 0 " print "0 0" print "0000000"
ink 1 locate y, x: print "X"
' Main game loop do ' Keep looping until an actual key on the joypad ' is pressed. store the key in mykey so we don't ' keep reading the hardware registers when checking ' for keys do sleep 1 mykey = joypad() loop while mykey = 0
' temporary x and y checky = y: checkx = x
' check for UP, down, left, right select case mykey [AND] &hf case 1: ' UP if y>0 then checky = y-1 exit case case 2: ' DOWN if y<8 then checky = y+1 exit case case 4: ' LEFT if x>0 then checkx = x-1 exit case case 8: ' RIGHT if x<6 then checkx = x+1 exit case case else: ' no up/down/left/right? Jump and continue running main game loop continue loop end case
' here's the SCREEN(X, Y) equivalent ' would be so much nicer is functions were released :D getchar$ = chr$(vdpramread(49152 + (checkx+1<<1) + (checky+1<<7)) [AND] 255)
' if it's a 0 character, then something is blocking us if getchar$ = "0" then continue loop
' Clear out our current character locate y, x: print " "
' nothing is in the player's way, so make temporary ' into actual x, y. then draw the player x=checkx: y=checky locate y, x: print "X"
' another sleep so the player doesn't go all over the ' place if the direction key is held sleep 10 loop while 1
it's a very nice + easy example of a game in basiegaxorz just using print statements, and joypad reading. there's a lot more questions i saw on this board regarding basiegaxorz, i'll try to get them answered soon
|
|
|
Post by ScroGer on Apr 11, 2006 21:31:53 GMT -5
Thank's oompa loompa for translating that for me it really helped me out and I plan on puting this example to good use Peace ;D
|
|