Mintoris Forum

Author Topic: graphics question  (Read 2723 times)

Goos

  • Jr. Member
  • **
  • Posts: 2
graphics question
« on: May 15, 2011, 04:11 PM »
I am Goos and i am new to mintoris basic.

I have a problem with graphics.

I have a program that shows a game off life. but i can,t get 2 or more screens show up.
Only the first was draw.

Hope that someone will help me.

graphics on
color 0,0,0
cls
color 100,100,100
generatie=0
fps=11
width=240   
heigt=400
small=0
A$=""
dim pl(width,heigt)
dim pld(width,heigt)

rem the loop is just for testing
for x=1 to 10
gosub rrand
next x

do
   GOSUB nextgen

   GOSUB showplay
loop until 1>2
END
showplay:
color 0,0,0
cls
color 100,100,100
life=0
FOR y=0 TO 399 step 10
    FOR x=0 TO 240 step 10
      IF pl(x,y)>0 then
         rect x,y,x+10,y+10,1
         life=life+1
      endif
    NEXT x
NEXT y
generatie=generatie+1
vibrate 100
wait 1
return
nextgen:
FOR y=0 TO 399 step 10
   FOR x=0 TO 239 step 10
      x1=x-1
      x2=x+1
      y1=y-1
      y2=y+1
       IF x=0 THEN x1=229
       IF x=229 THEN x2=0
      IF y=0 THEN y1=389
       IF y=389 THEN y2=0
       numbers=pl(x1,y1)+pl(x,y1)+pl(x2,y1)+pl(x,y2)+pl(x2,y2)+pl(x1,y2)+pl(x1,y)+pl(x2,y)
       IF (numbers<2) OR (numbers>3) then
          pld(x,y)=0
      ELSEIF numbers=2 AND pl(x,y)=1 then
          pld(x,y)=1
      ENDIF
      IF numbers=3 THEN pld(x,y)=1
   NEXT x
vibrate 1
NEXT y
vibrate 1
pl=pld
return

rrand:
color 0,0,0
cls
color 100,100,100

vibrate 10
generatie=0
for y=0 TO 399 step 10
   for x=0 TO 239 step 10
       if rnd(1)>.5 then
         pl(x,y)=1
         rect x,y,x+10,y+10,1
      endif
      
   next x
next y
wait 1
return


« Last Edit: May 15, 2011, 04:21 PM by Goos »

Goos

  • Jr. Member
  • **
  • Posts: 2
Re: graphics question
« Reply #1 on: May 16, 2011, 01:41 AM »
I already found the problem.