? New programming adventure :D (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

New programming adventure :D

  • #1 ✎ 5 PixelPaintbrush So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice ACLS Color 8 Locate 12,10 : ?"Press to start" REPEAT B=button() UNTIL B>0 CLS @TitleInit SPSET 0,192,480,97,18 SPOFS 0,150,50 SPSCALE 0,1,2 WAIT 5 @TitleWait REPEAT B=button() UNTIL B>0 SPCLR '--------------------- VAR run% = TRUE WHILE run% 'TEST BOX ENV @TESTBOX
 GPRIO -20 
COLOR 8
 C1 = RGB (256,0,0) 
GBOX 10,10,390,230, C1 WEND fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope. Posted
  • #2 ✎ 229 16bitcoder
    So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice ACLS Color 8 Locate 12,10 : ?"Press to start" REPEAT B=button() UNTIL B>0 CLS @TitleInit SPSET 0,192,480,97,18 SPOFS 0,150,50 SPSCALE 0,1,2 WAIT 5 @TitleWait REPEAT B=button() UNTIL B>0 SPCLR '--------------------- VAR run% = TRUE WHILE run% 'TEST BOX ENV @TESTBOX
 GPRIO -20 
COLOR 8
 C1 = RGB (256,0,0) 
GBOX 10,10,390,230, C1 WEND fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope.
    Why do you need to PRINT the button being used if you can use: IF BUTTON()==#A (OR #B,X,Y,R,L,UP,DOWN,LEFT OR RIGHT) THEN ... If you want to make something that'll do that, copy this @L IF BUTTON()== (# button you want) then print "(the button you set like I.e. print " A")"
    Posted
  • #3 ✎ 5 PixelPaintbrush
    So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice ACLS Color 8 Locate 12,10 : ?"Press to start" REPEAT B=button() UNTIL B>0 CLS @TitleInit SPSET 0,192,480,97,18 SPOFS 0,150,50 SPSCALE 0,1,2 WAIT 5 @TitleWait REPEAT B=button() UNTIL B>0 SPCLR '--------------------- VAR run% = TRUE WHILE run% 'TEST BOX ENV @TESTBOX
 GPRIO -20 
COLOR 8
 C1 = RGB (256,0,0) 
GBOX 10,10,390,230, C1 WEND fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope.
    Why do you need to PRINT the button being used if you can use: IF BUTTON()==#A (OR #B,X,Y,R,L,UP,DOWN,LEFT OR RIGHT) THEN ... If you want to make something that'll do that, copy this @L IF BUTTON()== (# button you want) then print "(the button you set like I.e. print " A")"
    erm....what?
    Posted
  • #4 ✎ 229 16bitcoder You said you wanted to print the button you of click
    that will print what Button is being pressed up in the right corner and such...
    So I.e. (print A, button went pressed) @L IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' " WAIT 1:GOTO @L But you need to use LOCATE print on the time right
    Posted Edited by 16bitcoder
  • #5 ✎ 5 PixelPaintbrush
    You said you wanted to print the button you of click
    that will print what Button is being pressed up in the right corner and such...
    So I.e. (print A, button went pressed) @L IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' " WAIT 1:GOTO @L But you need to use LOCATE print on the time right
    Right so here's what I got ACLS PRINT "BUTTON DETECTION" REPEAT B=BUTTON() UNTIL B>0 CLS GBOX 250,10,360,50 @BUTTON REPEAT B=BUTTON() LOCATE 32,2 PRINT B UNTIL B>0 GOTO @BUTTON I just can't get it to erase the number it displays after I quit pressing x.x
    Posted
  • #6 ✎ 229 16bitcoder
    You said you wanted to print the button you of click
    that will print what Button is being pressed up in the right corner and such...
    So I.e. (print A, button went pressed) @L IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' " WAIT 1:GOTO @L But you need to use LOCATE print on the time right
    Right so here's what I got ACLS PRINT "BUTTON DETECTION" REPEAT B=BUTTON() UNTIL B>0 CLS GBOX 250,10,360,50 @BUTTON REPEAT B=BUTTON() LOCATE 32,2 PRINT B UNTIL B>0 GOTO @BUTTON I just can't get it to erase the number it displays after I quit pressing x.x
    Oh...
    Posted
  • #7 ✎ 5 PixelPaintbrush yeah...any ideas on how to get it to..well behave? Posted
  • #8 ✎ 229 16bitcoder
    yeah...any ideas on how to get it to..well behave?
    Maybe IF BUTTON()==0 THEN CLS
    Posted
  • #9 ✎ 930 Y_ack
    I just can't get it to erase the number it displays after I quit pressing x.x
    I can't really tell but is your problem, then, the extra digits not being written over? the easy way to fix that would be @BUTTON REPEAT B=BUTTON() LOCATE 32,2 REM print blanks over the unused spaces PRINT B + (4 - LEN(STR$(B))) * " " UNTIL B>0 GOTO @BUTTON If that's not it, your loop logic might be wrong. You uh could just have a fencepost print after the UNTIL? I guess I'm not really sure what's going on here.
    Posted Edited by Y_ack