Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Making numbers fall in different columns

Author
Message
Robot Booger
20
Years of Service
User Offline
Joined: 4th Jan 2005
Location:
Posted: 10th Sep 2005 08:14
I already have some code that doesn't work the way I want it to.


I want the numbers to fall in random columns but they only fall in the first one.

Please help.
Zergei
20
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 10th Sep 2005 17:37 Edited at: 10th Sep 2005 17:58
Well, you forgot to establish textcolumnnum as global, start from there, after fixing that you'll find another problem, but i'll let you figure out how to solve that . You just have to move 1 command to another place. Oh, and try to avoid doing coments after commands has some of us get an error.



And adding a Randomize timer() command at the beginning so it actually gives out random numbers.
Good game so far .
Robot Booger
20
Years of Service
User Offline
Joined: 4th Jan 2005
Location:
Posted: 12th Sep 2005 04:46
Ok thanks i'll try it.
Robot Booger
20
Years of Service
User Offline
Joined: 4th Jan 2005
Location:
Posted: 15th Sep 2005 20:32 Edited at: 15th Sep 2005 20:33
Ok I did it but it still doesn't work the way I want it to.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Sep 2005 22:24 Edited at: 15th Sep 2005 22:24
I think what you need to do is move "TextColumnNum=rnd(2)" out of the do loop and into the NewProblem() function. And you really should have "randomize timer()" at the top of the code (i'd put it under "hide mouse").
Robot Booger
20
Years of Service
User Offline
Joined: 4th Jan 2005
Location:
Posted: 17th Sep 2005 00:40
Ok i tried it but it didn't work. Do you think i should make the program three different times and change the cursor position?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Sep 2005 02:31 Edited at: 17th Sep 2005 02:39
No. You're using functions to repeat things... don't go backwards in your learning.

I would get rid of TextColumnNum and change some lines in the NewProblem() function. There's no need to have it pick a random number for specific columns when the entire screen can easily be used.

Like this:


In NewProblem() I added:


a$ is just a temporary string to find out what the text length of it will be on the screen so it can be subtracted from the random x coordinate picked. If you want this program to allow other kinds of problems instead of just adding... you might want to look at making a$ something else and making it global. You can then look up in the help files how to use "select" and "case" to pick different problems in that function. If that is what you want and you have problems i'll show you how to use "select" and "case".

Also there are small changes that you can put in that would make it easier. Like instead of using "set cursor" and "print" you can use "text" and do the same thing as both those commands combined... especially if you use my suggesting of making a$ (or whatever you pick) as global. Like: text TextColumn,TextHeight+80,a$

Hope this helps.
Robot Booger
20
Years of Service
User Offline
Joined: 4th Jan 2005
Location:
Posted: 19th Sep 2005 00:02
Of course it helped. Thank you.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Sep 2005 04:00
np

Login to post a reply

Server time is: 2025-05-17 16:13:52
Your offset time is: 2025-05-17 16:13:52