 |
Das deutsche QBasic- und FreeBASIC-Forum Für euch erreichbar unter qb-forum.de, fb-forum.de und freebasic-forum.de!
|
Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
Autor |
Nachricht |
psygate
Anmeldungsdatum: 05.04.2005 Beiträge: 304 Wohnort: Wien und der Computer
|
Verfasst am: 30.04.2006, 21:59 Titel: Fehler im Code.... Ich find ihn einfach nicht! |
|
|
Also... ICh hab da ein problem mit meinem Code. Er bricht ab oder es sind variablen plötzlich verschoben (z.B: xmax ist immer gleich dot(a).x und so weiter...)
ann mir jemand helfen?
Code: |
'--------------------------------------------------------------------------------------------
randomize timer
option explicit
'--------------------------------------------------------------------------------------------
type coldot
x as integer
y as integer
r as integer
g as integer
b as integer
d as integer
end type
type mousepos
x as integer
y as integer
statx as integer
staty as integer
hide as ubyte
altcors as integer
end type
'--------------------------------------------------------------------------------------------
const num=2
dim as integer xmax,ymax,a
dim as double t
dim as coldot dot(num)
dim as mousepos mouse
screeninfo xmax,ymax
screenres xmax,ymax,24,,1
dim as integer r(xmax,ymax),g(xmax,ymax),b(xmax,ymax)
'--------------------------------------------------------------------------------------------
with dot(a)
for a=1 to num
.x=int(rnd*xmax)
.y=int(rnd*ymax)
.r=int(rnd*256)
.g=int(rnd*256)
.b=int(rnd*256)
.d=0
next
end with
with mouse
.x=xmax-1
.y=ymax-1
.statx=xmax-1
.staty=ymax-1
.hide=0
.altcors=0
setmouse .statx,.staty,.hide
end with
'----------------------------------------------------------------------------------------------
with dot(a)
do
for a=1 to num
locate 1,1:print a
locate 2,1:print .r,.g,.b
.d=int(rnd*8)
if .d=0 then .y-=1
if .d=1 then .x+=1:.y-=1
if .d=2 then .x+=1
if .d=3 then .y+=1:.x+=1
if .d=4 then .y+=1
if .d=5 then .x-=1:.y+=1
if .d=6 then .x-=1
if .d=7 then .x-=1:.y-=1
if .x>xmax-1 then .x=xmax-1
if .y>ymax-1 then .y=ymax-1
if .x<0 then .x=0
if .y<0 then .y=0
r(.x,.y)=(r(.x,.y)+.r)/2
g(.x,.y)=(g(.x,.y)+.g)/2
b(.x,.y)=(b(.x,.y)+.b)/2
pset(.x,.y),rgb(r(.x,.y),g(.x,.y),b(.x,.y))
if mouse.x<>mouse.statx or mouse.y<>mouse.staty then end
if inkey$<>"" then end
next a
loop
end with
|
|
|
Nach oben |
|
 |
volta
Anmeldungsdatum: 04.05.2005 Beiträge: 1876 Wohnort: D59192
|
Verfasst am: 30.04.2006, 22:43 Titel: |
|
|
setz mal 'with' 'end with' in die FOR..NEXT, DO..LOOP Schleifen.
Code: | ....
'--------------------------------------------------------------------------------------------
for a=1 to num
with dot(a)
.x=int(rnd*xmax)
.y=int(rnd*ymax)
.r=int(rnd*256)
.g=int(rnd*256)
.b=int(rnd*256)
.d=0
end With
next
with mouse
.x=xmax-1
.y=ymax-1
.statx=xmax-1
.staty=ymax-1
.hide=0
.altcors=0
setmouse .statx,.staty,.hide
end with
'----------------------------------------------------------------------------------------------
do
for a=1 to num
with dot(a)
locate 1,1:print a
locate 2,1:print .r,.g,.b
.d=int(rnd*8)
if .d=0 then .y-=1
if .d=1 then .x+=1:.y-=1
if .d=2 then .x+=1
if .d=3 then .y+=1:.x+=1
if .d=4 then .y+=1
if .d=5 then .x-=1:.y+=1
if .d=6 then .x-=1
if .d=7 then .x-=1:.y-=1
if .x>xmax-1 then .x=xmax-1
if .y>ymax-1 then .y=ymax-1
if .x<0 then .x=0
if .y<0 then .y=0
r(.x,.y)=(r(.x,.y)+.r)/2
g(.x,.y)=(g(.x,.y)+.g)/2
b(.x,.y)=(b(.x,.y)+.b)/2
pset(.x,.y),rgb(r(.x,.y),g(.x,.y),b(.x,.y))
End With
if mouse.x<>mouse.statx or mouse.y<>mouse.staty then end
if inkey$<>"" then end
next a
loop | ob das schon der Fehler war? Ich weis nicht was das Prog machen soll. _________________ Warnung an Choleriker:
Dieser Beitrag kann Spuren von Ironie & Sarkasmus enthalten.
Zu Risiken & Nebenwirkungen fragen Sie Ihren Therapeuten oder Psychiater. |
|
Nach oben |
|
 |
psygate
Anmeldungsdatum: 05.04.2005 Beiträge: 304 Wohnort: Wien und der Computer
|
Verfasst am: 02.05.2006, 20:57 Titel: |
|
|
ich könnt' dich küssen!
Danke Volta, das, ganz genau das wars!
Das mir das nicht eingefallen ist...  |
|
Nach oben |
|
 |
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
|