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.

DarkBASIC Discussion / Loading random pictures and pressing keys

Author
Message
bob23
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: some where
Posted: 11th Mar 2004 01:28
How can I load a random sprite and have the player score when a key is pressed that goes with the picture. EX I load a picture called key1.??? and they have to hit the key to score befor the picture changes in a set time. How would I do this?

vist my web site www.freewebs.com/bobgames

Tim Ballisto
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 11th Mar 2004 02:20 Edited at: 11th Mar 2004 02:21
make a rnd() statement, and then put something like

right=0
do
if rnd(9)=0
load image "picture0.bmp"
for time=1 to 100 step 1
if inkey$()="0" then right=1
next time
if right=0
score=score-1
endif
if right=1
score=score+1
right=0
endif
if right
loop

i don't know if i'm even close, i'm really in a rush right now so i didn't think about it too much.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 11th Mar 2004 03:48
It would more efficent to load all the pictures once and display them based on a random image ID.
--
TAZ

bob23
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: some where
Posted: 12th Mar 2004 02:52
Thanks Tim

Quote: "It would more efficent to load all the pictures once and display them based on a random image ID."

How would I set a random ID?

vist my web site www.freewebs.com/bobgames

Login to post a reply

Server time is: 2025-05-23 08:51:57
Your offset time is: 2025-05-23 08:51:57