Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matrix
#1
ok, back to school and all the boring stuff that follows, but, look, a light in the end of the tunnel, in high-school we use a advanced calculator witch can be programmed! :bounce: suddenly we have something to do in the boring classes Tongue

I've notice that the language on my calculator is alot like Basic, therefore I decided to post this here, however, answer my questions like if we were using QB, (witch this forum is relly about).

i've been twisting my brain for days to figure this out:
-How to make it look like a matrix code runs over the screen (you
know, all the numbers and letters "falling" down in "snakes")

I'm supposing that the FOR TO STEP NEXT commands will have to be in there somehow, but since i'm still a newb in QB I haven't come up with anything...

plz help Manwë Sulimo
color=darkred]Imperishable flames are mine to controll![/color]
Reply
#2
what is this? 19 views and still no replys? maybe this is not a newbie question and should be moved to another part of the forum? Or is my question not understandable? or... :???:

some hint in some direction could at least be good right? (Maby i'm just to impatient :b )
color=darkred]Imperishable flames are mine to controll![/color]
Reply
#3
Here's some FB code that does something similar... maybe that will get you started.



Code:
Randomize Timer
Screen 12

Type Matrix_Char
    X As Single
    Y As Single
    Spd As Single
    Id As String*1
End Type



Dim Array( 1 To 20) As Matrix_Char
Dim As Integer i

For i = 1 To UBound(Array)
    Array(i).X = Int(Rnd*80) + 1
    Array(i).Y = Int(Rnd*10) + 1
    Array(i).Spd = Rnd+.05
    If Int(Rnd*12) = 0 Then
        Array(i).Id = "0"
    Else
        Array(i).Id = "1"
    End If
Next



Color 14

Do
    
For i = 1 To UBound(Array)
   Array(i).Y+=Array(i).Spd
  
   Locate Array(i).Y, Array(i).X,0
   Print Array(i).Id
  
   If Array(i).Y>30 Then
       Array(i).X = Int(Rnd*80) + 1
       Array(i).Y = 1
       Array(i).Spd = Rnd+.05
       If Int(Rnd*12) = 0 Then
        Array(i).Id = "0"
    Else
        Array(i).Id = "1"
    End If
   End If
Next

Wait &h3da,8
Cls

Loop
Reply
#4
Great! A reply, now I only need to get FB in order to understand anything of the code and i'm set to keep trying...
It would be very good if someone could try (like me) to make this in QB, also, I'd be happy if there are more ways of doing it (not that there's anything wrong with this way, but many ideas are better then 1 idea Wink )
color=darkred]Imperishable flames are mine to controll![/color]
Reply
#5
Try actually looking at the code first. You'll see that it's pretty much identical to QB.
Reply
#6
Oops... :???: How did I do that? Must have hit the 1 at the same time.


Code:
If Int(Rnd*12) = 0 Then

Should be...

Code:
If Int(Rnd*2) = 0 Then

:lol:
Reply
#7
the code might be very close to QB (I can see that by the way, after all it's Basic Wink ) but I don't understand it unless i can look at the output and change somenumbers...then I understand the different commands...

ps. is this a dying thread?
color=darkred]Imperishable flames are mine to controll![/color]
Reply
#8
Download Fb and run it. Wink
Reply
#9
Heres the code modified to work in QB (yes I realise it is a pretty bad job)

Code:
RANDOMIZE TIMER
SCREEN 12
NumberOfLetters = 50

DIM letters(NumberOfLetters, 3) '0 is xpos, 1 is ypos, 2 speed, 3 is character

FOR i = 1 TO NumberOfLetters
    letters(i, 0) = INT(RND * 80) + 1
    letters(i, 1) = INT(RND * 10) + 1
    letters(i, 2) = RND * .9 + .1
    IF INT(RND * 12) = 0 THEN
        letters(i, 3) = 48 'ascii character number
    ELSE
        letters(i, 3) = 49
    END IF
NEXT

DO
        FOR i = 1 TO NumberOfLetters
           letters(i, 1) = letters(i, 1) + letters(i, 2)
           IF letters(i, 2) < .3 THEN
                COLOR 2
           ELSEIF letters(i, 2) >= .3 AND letters(i, 2) < .5 THEN
                COLOR 10
           ELSEIF letters(i, 2) >= .5 AND letters(i, 2) < .7 THEN
                COLOR 14
           ELSEIF letters(i, 2) >= .7 THEN
                COLOR 15
           END IF
           LOCATE letters(i, 1), letters(i, 0)
           PRINT CHR$(letters(i, 3))
           IF letters(i, 1) > 2 THEN
                   LOCATE letters(i, 1) - 1, letters(i, 0)
                   PRINT " "
           END IF

           IF letters(i, 1) > 26 THEN
               LOCATE letters(i, 1), letters(i, 0)
               PRINT " "
               letters(i, 1) = INT(RND * 80) + 1
               letters(i, 1) = 1
               letters(i, 2) = RND * .9 + .1
               IF INT(RND * 12) = 0 THEN
                letters(i, 3) = 48
            ELSE
                letters(i, 3) = 49
            END IF
           END IF
        NEXT

        Oldtime = TIMER
        DO
        LOOP UNTIL Oldtime + .1 > TIMER
LOOP
Reply
#10
Good, very good, ALOT better then nothing, now I've got something to do the next classes Wink
color=darkred]Imperishable flames are mine to controll![/color]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)