Jump to content

Need Some Help


Recommended Posts

Guest MrMu1985
Posted

Hey everyone. My name is Jon. I am a senior, who just decided to take programing this year. ha, turns out i'm not addicted to the code, so much that i have taught myself far beyond anything we've learned in the class.and while i get basically what to do.. some things i have a couple complications.. cause i can't ask anyone bout it. just read the tutorial. (Q basic by the way). and I am making my first game currently. I have my intro, and a menu screen, and I even have 3 levels on my game, but the problem is in my menu screen. it's a red arrow, which uses the "2" key to toggle, and then "x" key to select. problem is when i'm at my menu, I always get trapped in a loop, or a while, I have tried like every freaking combination of ifthen,do while, do until, do, and while's that u could freaking think of. and always the same freaking result. either only the "2" will function, or Only the "x" will function. NEVER both. once i got the "2" to make th arrow go down, and i could press x but i never could go back up. I'll post my code here , sorry guys if it's not very structured. it's like i said, i get how to use shit, but not to perfection, i haven't used any subs yet. well anyways i'll repost, and put the code in please help me. u could IM me if u want too or e-mail me. my e-mail is my AIM sn @netscape.net. ok well thanx see ya

Guest MrMu1985
Posted

I only got the first 2 levels my floppywas being all f****ed up, so i had to use my older version. but still same problem. the in dos will be an arrow so ur not confused. u can run if it u want. I'm pretty proud of the Intro. :D

 

'=======================Ultimate brain teazers===============================

CLS

SCREEN 12

M = 1

G = 12

S = 4

I = 0

F = 0

WHILE F < 4

COLOR 9

LOCATE 3, 20

PRINT "CREATED BY,"

music1$ = "o2 f8 f8 f+8 f8 g+8 g+8 f+8 f4 f8 f+8 f8 o3 c#8 c#8 o2 b8 a#8"

music2$ = "o2 f8 f8 f+8 f8 g+8 g+8 f+8 f4 f8 f+8 f8 o3 f8 f8 d#8 c#8"

'flag

'for which string of notes to play

mflag = 2

PLAY "mb"

PLAY music1$

PLAY music2$

PLAY ON

COLOR 10

SLEEP 1

LINE (110, 479 / 2)-(110, 479 / 2 - 100)

LINE (110, 479 / 2 - 100)-(160, 479 / 2)

LINE (160, 479 / 2)-(160, 479 / 2 - 100)

SLEEP 1

LINE (185, 479 / 2)-(185, 479 / 2 - 100)

LINE (185, 479 / 2 - 100)-(235, 479 / 2 - 100)

LINE (185, 479 / 2 - 50)-(225, 479 / 2 - 50)

LINE (185, 479 / 2)-(235, 479 / 2)

SLEEP 1

LINE (260, 479 / 2)-(260, 479 / 2 - 100)

LINE (260, 479 / 2 - 100)-(310, 479 / 2 - 100)

LINE (310, 479 / 2 - 100)-(310, 479 / 2 - 50)

LINE (310, 479 / 2 - 50)-(260, 479 / 2 - 50)

LINE (260, 479 / 2 - 50)-(310, 479 / 2)

SLEEP 1

LINE (335, 479 / 2)-(335, 479 / 2 - 100)

LINE (335, 479 / 2 - 100)-(385, 479 / 2 - 66)

LINE (385, 479 / 2 - 66)-(385, 479 / 2 - 33)

LINE (385, 479 / 2 - 33)-(335, 479 / 2)

SLEEP 1

COLOR 6

LINE (90, 241)-(90, 341)

LINE (90, 241)-(140, 241)

LINE (90, 341)-(140, 341)

LINE (165, 241)-(165, 341)

LINE (165, 241)-(215, 241)

LINE (215, 241)-(215, 291)

LINE (215, 291)-(165, 291)

LINE (165, 291)-(215, 341)

LINE (250, 341)-(275, 241)

LINE (275, 241)-(300, 341)

LINE (240, 291)-(310, 291)

CIRCLE (275, 291), SQR(25 ^ 2 + 25 ^ 2), 6, , , 1

LINE (335, 241)-(335, 341)

LINE (335, 241)-(385, 241)

LINE (335, 291)-(360, 291)

LINE (410, 241)-(460, 241)

LINE (435, 241)-(435, 341)

COLOR 9

SLEEP 1

LOCATE 25, 10

PRINT "designed By Jon Hiller"

LOCATE 27, 5

PRINT "Special thanx to Mike Mollard"

SLEEP 3

F = 4

WEND

CLS

SCREEN 12

FOR C = 0 TO SQR(100 ^ 2 + 300 ^ 2)

CIRCLE (639 / 2, 120), C, 7, , , (100 / 300)

NEXT

FOR Y = 0 TO SQR(300 ^ 2 + 100 ^ 2) STEP 5

CIRCLE (639 / 2, 120), Y, 9, , , (100 / 300)

CIRCLE (639 / 2, 120), Y + 1, 10, , , (100 / 300)

CIRCLE (639 / 2, 120), Y + 2, 4, , , (100 / 300)

CIRCLE (639 / 2, 120), Y + 3, 12, , , (100 / 300)

CIRCLE (639 / 2, 120), Y + 4, 6, , , (100 / 300)

NEXT

COLOR 10

LOCATE 15, 1

PRINT "Welcome to ULTIMATE BRAIN TEAZAS here you will be challenged to think"

PRINT "differently than you normally do. This is more a challenge of imagination"

PRINT "and Inguinity, and not rational thought, and formulas. Do have fun!"

WHILE INKEY$ <> "e"

WHILE M = 1

LOCATE 19, 8

COLOR 4

PRINT " ";

COLOR 15

PRINT "Start Game"

LOCATE 22, 8

COLOR 0

PRINT " ";

COLOR 15

PRINT "Instructions"

IF INKEY$ = "x" THEN

M = 4

GOTO Pword

END IF

DO WHILE M = 1 AND INKEY$ = "2"

M = -1

LOOP

WEND

WHILE M = -1

IF INKEY$ = "x" THEN

CLS

PRINT "just a test"

END IF

DO WHILE M = -1 AND INKEY$ = "2"

S = 4

I = 0

M = 1

LOOP

LOOP

LOOP

LOOP

WEND

Pword: CLS

COLOR 10

LOCATE 5, 10

PRINT "enter your password"

PRINT "If this is your first time playing then your password will be ";

COLOR 9

PRINT "lvl1"

COLOR 10

PRINT

PRINT

PRINT "remember This program is caps sensitive!!"

INPUT Pword$

LOCATE 15, 8

IF Pword$ = "lvl1" THEN M = 5

IF Pword$ = "Cigman" THEN M = 6

lvl1: WHILE M = 5

CLS

COLOR 10

LOCATE 10, 1

PRINT "There is a magical lilipad which growth doubles everyday. In 30 days it"

PRINT "Fills the pond completely. If there were 2 lilipads much the same, how many"

PRINT "days would it take for them both to fill the pond?"

INPUT A

IF A = 29 THEN

CLS

Count = 1

DO WHILE Count < 8

SOUND 2200, 1

SOUND 32000, 1

Count = Count + 1

LOOP

COLOR 10

LOCATE 5, 12

PRINT "Congratulations you correctly answered number1! The answer is 29."

PRINT

PRINT "EXPLANATION: If the lilipad fills the whole pond one day then they day before"

PRINT "it fills half. therefore 2 would fill the pond"

PRINT

PRINT "your new password is ";

COLOR 9

PRINT "Cigman"

COLOR 10

PRINT "press enter to continue"

INPUT E!

M = M + 1

ELSE

CLS

SOUND 150, 18.2

LOCATE 15, 15

PRINT "sorry you are wrong you can not continue"

SLEEP 2

GOTO lvl1

END IF

WEND

Lvl2: WHILE M = 6

CLS

PRINT "There is a homeless man who wants to smoke, but has no cigarettes and"

PRINT "obviously no money. There is a man who collects butts. for every 3 cigarrette"

PRINT "Butts he will give you 1 cigarette. if the homeless man finds 9 cigarette"

PRINT "butts then how many cigarettes can he smoke?"

INPUT A

IF A = 4 THEN

CLS

Count = 1

DO WHILE Count < 8

SOUND 2200, 1

SOUND 32000, 1

Count = Count + 1

LOOP

LOCATE 5, 12

COLOR 10

PRINT "Congratulations you have correctly answered Lvl2 Your New password is ";

COLOR 1

PRINT "Fmly"

COLOR 10

PRINT

PRINT

PRINT "EXPLANATION: He would originally get 3 cigaretes, then 3 butts from those to "

PRINT " get one last cigarette making 4"

PRINT "Press Enter to continue"

INPUT E!

M = M + 1

ELSE

CLS

SOUND 150, 18.2

LOCATE 15, 15

PRINT "sorry you are wrong you can not continue"

SLEEP 2

GOTO Lvl2

END IF

WEND

lvl3: WHILE M = 7

CLS

PRINT "David's mother has 4 kids. their names are April,May,June. Name the 4th"

INPUT N$

IF N$ = "David" OR N$ = "david" OR N$ = "DAVID" THEN

CLS

Count = 1

DO WHILE Count < 8

SOUND 2200, 1

SOUND 32000, 1

Count = Count + 1

LOOP

LOCATE 5, 12

COLOR 10

PRINT "Congratulations you have correctly answered Lvl3 Your New password is ";

COLOR 1

PRINT "???"

COLOR 10

PRINT

PRINT

PRINT "EXPLANATION: Pretty simple. It says DAVID'S mother. So david has to be a kid"

PRINT "Press Enter to continue"

INPUT E!

M = M + 1

ELSE

CLS

SOUND 150, 18.2

LOCATE 15, 15

PRINT "sorry you are wrong you can not continue"

SLEEP 2

GOTO lvl3

END IF

WEND

Posted

Okay MrMu1985, I'm not even going to get started about your bugged-up coding because you're obviously new to Qbasic, but here's what you could do for the menu. I quickly whipped up this code to emulate your in-game menu, you can cut and paste it into the appropriate spot. Good luck, hope it helps:

 

mx = 19

 

DO

menu$ = INKEY$

 

COLOR 10

LOCATE 14, 1

PRINT "Welcome to ULTIMATE BRAIN TEAZAS here you will be challenged to think"

PRINT "differently than you normally do. This is more a challenge of imagination"

PRINT "and Inguinity, and not rational thought, and formulas. Do have fun!"

PRINT "To use menu, press 8 or 2 to move up or dowm. press X to select."

 

IF menu$ = "2" THEN mx = 22

IF menu$ = "8" THEN mx = 19

IF menu$ <> "" THEN CLS

IF menu$ <> "" THEN SOUND 200, 1

 

LOCATE mx, 6: COLOR 4: PRINT CHR$(16)

LOCATE 19, 8: COLOR 15: PRINT "Start Game"

LOCATE 22, 8: COLOR 15: PRINT "Instructions"

LOOP UNTIL UCASE$(menu$) = "X"

 

CLS

SOUND 300, 1

SOUND 400, 1

SELECT CASE mx

CASE IS = 19

GOTO pword

CASE IS = 22

PRINT "Just a test"

END SELECT

Guest MrMu1985
Posted
Okay MrMu1985' date=' I'm not even going to get started about your bugged-up coding because you're obviously new to Qbasic, but here's what you could do for the menu. I quickly whipped up this code to emulate your in-game menu, you can cut and paste it into the appropriate spot. Good luck, hope it helps:

 

mx = 19

 

DO

menu$ = INKEY$

 

COLOR 10

LOCATE 14, 1

PRINT "Welcome to ULTIMATE BRAIN TEAZAS here you will be challenged to think"

PRINT "differently than you normally do. This is more a challenge of imagination"

PRINT "and Inguinity, and not rational thought, and formulas. Do have fun!"

PRINT "To use menu, press 8 or 2 to move up or dowm. press X to select."

 

IF menu$ = "2" THEN mx = 22

IF menu$ = "8" THEN mx = 19

IF menu$ <> "" THEN CLS

IF menu$ <> "" THEN SOUND 200, 1

 

LOCATE mx, 6: COLOR 4: PRINT CHR$(16)

LOCATE 19, 8: COLOR 15: PRINT "Start Game"

LOCATE 22, 8: COLOR 15: PRINT "Instructions"

LOOP UNTIL UCASE$(menu$) = "X"

 

CLS

SOUND 300, 1

SOUND 400, 1

SELECT CASE mx

CASE IS = 19

GOTO pword

CASE IS = 22

PRINT "Just a test"

END SELECT[/quote']

 

whether it's on instructions or start game... it starts game.. instead of case = 13 shouldn't it just be case13 and case 22???

Posted

SELECT CASE mx

CASE IS = 19

GOTO pword

CASE IS = 22

PRINT "Just a test"

END SELECT

 

The above is correct. it has to be written "CASE IS = 19" and "CASE IS = 22". Now, because you don't have any subroutine defined for instructions, I wrote "Just a test". Replace "Just a test" with "GOTO instruct" or something and then create a subroutine called "instruct" with instructions.

 

Example:

 

instruct:

CLS

PRINT "Place instructions here"

PRINT "ETC..."

 

(Now at this point, you have to put in some sort of INPUT statement and another subroutine back to the menu...)

 

INPUT "Press any key to continue : ", whatever$

GOTO top

 

(Now, go back up to your menu and do this...)

 

top:

mx = 19

 

DO

menu$ = INKEY$

 

COLOR 10

LOCATE 14, 1

PRINT "Welcome to ULTIMATE BRAIN TEAZAS here you will be challenged to think"

 

ETC, ETC, ETC

 

 

Well, you get the idea. Good luck :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.