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.

Code Snippets / Very Good example of the type command

Author
Message
Jim
21
Years of Service
User Offline
Joined: 10th Feb 2003
Location: United Kingdom
Posted: 13th Feb 2003 21:23
I did this example of the type command to illustrate its use. It is the best way to programming and it means that you can assign many types of vars to one part of an array, a feature that did no feature in DB one.


Rem Project: temp
Rem Created: 10/02/2003 19:09:29

Rem ***** Main Source File *****
sync on
sync rate 35

chars = 100

x= 0
cls
type stuff
name as string
x as integer
y as integer
inposx as integer
inposy as integer
colr as integer
colg as integer
colb as integer
endtype
dim bugs(chars) as stuff

for x = 1 to chars
rc = int(rnd(50)+60)
bugs(x).name = chr$(rc)
bugs(x).x = Int(rnd(600))
bugs(x).y = int(rnd(400))
bugs(x).colr = int(rnd(255))
bugs(x).colg = int(rnd(255))
bugs(x).colb = int(rnd(255))
bugs(x).inposx = 0
bugs(x).inposy = 0
next x
x= 0

print "Ready Press a Start"
wait key
wait 200

Do
x = x + 1
if x = chars then exit

set cursor bugs(x).x, bugs(x).y
ink rgb(bugs(x).colr,bugs(x).colg,bugs(x).colb),0
print bugs(x).name
sync
Loop

fpx = 600 / 2
fpy = 400 / 2
cent = chars
x = 0
Do
x = x + 1
set cursor bugs(x).x, bugs(x).y
ink 0,0
print bugs(x).name
if bugs(x).x > fpx then bugs(x).x = bugs(x).x - 8
if bugs(x).x fpy then bugs(x).y = bugs(x).y - 8
if bugs(x).y
The Universe has infinite possibilities. So do YOU!
Jim
21
Years of Service
User Offline
Joined: 10th Feb 2003
Location: United Kingdom
Posted: 13th Feb 2003 21:24
Sorry


The Universe has infinite possibilities. So do YOU!

Login to post a reply

Server time is: 2024-11-24 05:05:43
Your offset time is: 2024-11-24 05:05:43