Hello people
I can't figure out why my matrix starts throwing a hissyfit everytime I try to SHIFT it. o_O
Here is my program (media-free)
SYNC ON : SYNC RATE 100 : HIDE MOUSE
SET DISPLAY MODE 1024,768,32
SET TEXT SIZE 28 : SET TEXT FONT "Impact"
SYNC : CENTER TEXT 512,350,"Loading..." : SYNC
INK RGB(0,125,0),0 : BOX 0,0,256,256
FOR I = 0 TO 1000
INK RGB(RND(50),RND(180)+75,RND(80)),0
DOT RND(256),RND(256)
NEXT I
GET IMAGE 1,0,0,255,255
CLS
MAKE MATRIX 1,10000,10000,50,50
PREPARE MATRIX TEXTURE 1,1,2,2
SET MATRIX TEXTURE 1,1,1
RANDOMIZE MATRIX 1,100
UPDATE MATRIX 1
INK RGB(125,0,12),0 : BOX 1,1,16,16
INK 0,0
LINE 1,1,16,1 : LINE 1,16,16,16
LINE 1,1,1,16 : LINE 16,1,16,16
INK RGB(255,255,0),0
DOT 4,4 : DOT 5,4 : DOT 5,5 : DOT 4,5
DOT 12,4 : DOT 11,4 : DOT 12,5 : DOT 11,5
DOT 8,8 : DOT 8,9 : DOT 9,9 : DOT 9,8
LINE 3,9,3,11 : DOT 4,12 : LINE 5,13,12,13
DOT 13,12 : LINE 14,9,14,11
GET IMAGE 2,1,1,16,16
CLS
MAKE OBJECT CUBE 1,20
TEXTURE OBJECT 1,2
POSITION MATRIX 1,0,0,0
POSITION OBJECT 1,5000,GET GROUND HEIGHT(1,5000,5000)+10,5000
SET AMBIENT LIGHT 1
COLOR AMBIENT LIGHT 0
FOG ON : FOG COLOR 0 : FOG DISTANCE 500
BACKDROP ON : COLOR BACKDROP 0
OY=0
DO
IF UPKEY()=1 THEN MOVE OBJECT 1,3
IF LEFTKEY()=1 THEN OY=OY-2
IF RIGHTKEY()=1 THEN OY=OY+2
IF DOWNKEY()=1 THEN MOVE OBJECT 1,-3
LANDSCAPE#=GET GROUND HEIGHT(1,OBJECT POSITION X(1),OBJECT POSITION Z(1))+10
YROTATE OBJECT 1,OY : POSITION OBJECT 1,OBJECT POSITION X(1),LANDSCAPE#,OBJECT POSITION Z(1)
POSITION CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1)+40,OBJECT POSITION Z(1)
YROTATE CAMERA OY : MOVE CAMERA -120
IF OBJECT POSITION Z(1)-(5000+MATRIX POSITION Z(1)) >=4000 THEN SHIFT MATRIX UP 1
IF OBJECT POSITION Z(1)-(5000+MATRIX POSITION Z(1)) <=-4000 THEN SHIFT MATRIX DOWN 1
IF OBJECT POSITION X(1)-(5000+MATRIX POSITION X(1)) >=4000 THEN SHIFT MATRIX RIGHT 1
IF OBJECT POSITION X(1)-(5000+MATRIX POSITION X(1)) <=-4000 THEN SHIFT MATRIX LEFT 1
UPDATE MATRIX 1
TX#=OBJECT POSITION X(1)-(5000+MATRIX POSITION X(1))
TZ#=OBJECT POSITION Z(1)-(5000+MATRIX POSITION Z(1))
MX$=STR$(TX#) : MZ$=STR$(TZ#)
TEXT 5,5,"X: "+MX$ : TEXT 5,25,"Z: "+MZ$
SYNC
LOOP
As you can see, when you reach 4000 or -4000 on either X or Z the matrix should SHIFT in the appropriate direction...the problem is, it just wants to stay there in one place and starts shaking up a storm O.o
Here is the part I'm having problems with (for people too lazy to look for it
)
IF OBJECT POSITION Z(1)-(5000+MATRIX POSITION Z(1)) >=4000 THEN SHIFT MATRIX UP 1
IF OBJECT POSITION Z(1)-(5000+MATRIX POSITION Z(1)) <=-4000 THEN SHIFT MATRIX DOWN 1
IF OBJECT POSITION X(1)-(5000+MATRIX POSITION X(1)) >=4000 THEN SHIFT MATRIX RIGHT 1
IF OBJECT POSITION X(1)-(5000+MATRIX POSITION X(1)) <=-4000 THEN SHIFT MATRIX LEFT 1
UPDATE MATRIX 1
Can someone tell me what I did wrong?