Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Sev

#1
Thanks Ian, your adaption works.

Erico, sorry im not able to do any tutorials as this is for an assignment that is due in two days. But thanks anyway for your willingness to help.

Thanks.
#2
How do I get the code (in the actual code box) below to only do a sum ten times?

Can you use this: GLOBAL counter_Times=0


Code (glbasic) Select

WHILE TRUE

LOCAL num1% //Defines a number
LOCAL num2% //Defines another number
LOCAL answer% //Holds our answer
STATIC numcorrect% = 0  //Holds how many we have correct

num1 = RND(8)  //Generate a random number between 0 and 25 for our first number
num2 = RND(8) //Generate a random number between 0 and 25 for our second number
redo: //This is a label. You can use GOTO to hop back to here in code.

PRINT "Welcome to Sums! " + numcorrect + " correct so far.",5,5 //Print our welcome message with the number we have completed
PRINT num1 + " + " + num2 + " = ",5,35 //Displays our problem to solve. As you can see, it calls variables num1 and num2
INPUT answer,160,35 //This is the simple INPUT command to draw user input.

IF INTEGER(num1 + num2) = answer //This IF statement checks whether or not num1+num2 = answer
CLEARSCREEN //Clears the screen
PRINT "CORRECT!",5,5 //Prints CORRECT!0
INC numcorrect,1 //Increase correct problems by 1
SHOWSCREEN //Draw the screen
SLEEP 1000 //Freezes the screen for 2 seconds
ELSE //ELSE... means the user failed the question. num1 + num2 is not answer.
CLEARSCREEN //Clears the screen
PRINT "SORRY! TRY AGAIN!",5,5 //Prints SORRY! TRY AGAIN!
SHOWSCREEN //Draw the screen
SLEEP 2000 //Freezes the screen for 2 seconds
GOTO redo //GOTO our redo label we made earlier to retry the question
ENDIF //ENDIF ends the IF statement

SHOWSCREEN

WEND


Thanks
#3
@Darmakwolf In regards to the above code how do you tell the game to only redo the sums tens times.
#4
Thanks DARMAKWOLF   :booze:
#5
Hi again,

I am creating a very simple educational game for my assignment and i need help with getting sums to be answered correctly and incorrectly and then progressing to the next sum.

This is the code which doesnt work and i would like to know how to make sum able to be answered and then progress or finish the game:


Code (glbasic) Select

FUNCTION themaingame:

WHILE TRUE

PRINT "START THE GAME HERE", 100, 100

LOCAL answer%

PRINT "2+1=",100,150
INPUT value%

IF value% = 3
IF value% = >3
IF value% = < 3

SHOWSCREEN

WEND

ENDFUNCTION




Any help will be appreciated, thanks
#6
Hello, another question.

What key is "enter" in GLBasic?   Spacebar is key 57. e.g.-> IF KEY(57)

Thanks
#7
Thanks for the replies. I am not Spanish, i am Australian :).

Thanks for the welcome and I may use this forum regulary for the assignment i am working on.

#8
I am fairly new to GLBasic and for my assignment for school we need to create a simple game.

How would i create main menu for the game with a Start and Exit option?