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.

Author
Message
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 26th Mar 2003 22:32
Can someone please tell me how i can draw text to the screen randomly? for example if i wanted to have dog,cat and ball randomly drew to the screen in a loop that stopped after a certain time how would i achive this, i don't know how to use variables so if someone can briefly explain how i would do this it would be great.


Thanx
2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp
Terabyte
21
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 26th Mar 2003 23:01
`lets say your resolution is 640*480

do
`clear the screen each time you go through the loop
cls
`make three things random on the scren
set cursor rnd(640),rnd(480) : print "dog"
set cursor rnd(640),rnd(480) : print "cat"
set cursor rnd(640),rnd(480) : print "ball"
`wait a bit so that you see it
sleep 5000
`and so it again
loop

hope this helps

I have a word of advice...
..don't piss on an electric fence!
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 26th Mar 2003 23:12
not quite what i had in mind, what i want to do is make words that i have stored in variables or what ever you store em in appear on the screen for example, the word dog appears on the screen for 1 second then is replaced by cat for 1 second then ball for 1 second then it starts again but i want the them to be put on the screen randomly so they would not appear in the same order the next time round.

Thanx

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 26th Mar 2003 23:52
You'd store your text in string variables like this, I'm using an array for simplicity:

dim message$(3)
message$(0)="cat"
message$(1)="dog"
message$(2)="ball"

do

rem write the string to the screen, in a random place (change that if it isn't what you want)

text int(rnd(640)),int(rnd(480)),message$(message_showing)

rem choose a new word, make sure it isn't the same as the last one

repeat
new_message=int(rnd(2))
until new_message <> message_showing

message_showing = new_message

rem sync, wait for a second, then clear

sync
wait 1000
cls

loop

That should do what you want, although you haven't made it particularly clear.

Once I was but the learner,
now, I am the Master.
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 27th Mar 2003 00:19 Edited at: 27th Mar 2003 00:27
thanx darthster i want it to appear in the center of the screen in one place for my program but i can change the random position thingy, thanx again that has really helped a lot, hope i'm as good as you some day.

just 1 more question can i do this with bmps also?



2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp

Login to post a reply

Server time is: 2024-09-20 00:50:23
Your offset time is: 2024-09-20 00:50:23