Page 1 of 1

3D mapping floor

Posted: Mon Mar 14, 2011 5:47 pm
by ArtBlink

Code: Select all

@DISPLAY {mode="ask",width=640, height=480}
; Creating a Brush X=640 andY=1
CreateBrush(1,640,1)
; select brush
SelectBrush(1)
; Loop to achieve the red and blue lines 
For Local X=0 To 640 Step 32
   Line(X,0,X+16,0,$008800)
   Line(X+16,0,X+32,0,$00AA00)
Next
; End of select brush
EndSelect
SetFontStyle(#EDGE, #BLACK, 1)
SetFillStyle(#FILLGRADIENT, #LINEAR, $002266, $00AAFF)

;On initialise la seul variable global du programme
XDeplacement=0
Function Sol3D()
   StartTimer(1)
   
   Flip
   Cls
   
   Local PositionLigneEnX=0
   Local ZoomLigneEnX=1.5
   
   Local GoRight=IsKeyDown("RIGHT")
   Local GoLeft=IsKeyDown("LEFT")

   If GoRight=True Then XDeplacement=XDeplacement+2
   If GoLeft=True Then XDeplacement=XDeplacement-2

   For Local Y=400 To 480 
      XLineInPosition=XLineInPosition+(XDeplacement/10)
      XLineZoom=XLineZoom+0.1

      DisplayBrush(1,320+XDeplacement+XLineInPosition,Y,{scaleX=XLineZoom,anchorx=0.5})
   Next
   Local Temps=GetTimer(1)
   Box(0,0,640,400)
   TextOut (220,20,"3D floor for Beat Them All")
   TextOut (160,40," Right Arrow key to move right")
   TextOut (160,50," Left Arrow key to move left")
   TextOut (0,0,Round((1/Temps)*1000))
   TextOut (30,0,"Frame per second")
EndFunction
; Is programmed in, the variables say all ;-)
SetInterval(1,Sol3D,20)
BeginDoubleBuffer

Repeat
WaitEvent
Forever

Re: 3D mapping floor

Posted: Mon Mar 14, 2011 11:25 pm
by Tuxedo
I get:

Out of Memory
Error at line 37 function DisplayBrush

Re: 3D mapping floor

Posted: Tue Mar 15, 2011 5:29 pm
by ArtBlink
Oups... an error... sorry ;-)

Code: Select all

@DISPLAY {mode="ask",width=640, height=480}
; Creating a Brush X=640 andY=1
CreateBrush(1,640,1)
; select brush
SelectBrush(1)
; Loop to achieve the red and blue lines 
For Local X=0 To 640 Step 32
   Line(X,0,X+16,0,$008800)
   Line(X+16,0,X+32,0,$00AA00)
Next
; End of select brush
EndSelect
SetFontStyle(#EDGE, #BLACK, 1)
SetFillStyle(#FILLGRADIENT, #LINEAR, $002266, $00AAFF)

;On initialise la seul variable global du programme
XDeplacement=0
Function Sol3D()
   StartTimer(1)
   
   Flip
   Cls
   
   Local XLineInPosition=0
   Local XLineZoom=1.5
   
   Local GoRight=IsKeyDown("RIGHT")
   Local GoLeft=IsKeyDown("LEFT")

   If GoRight=True Then XDeplacement=XDeplacement+2
   If GoLeft=True Then XDeplacement=XDeplacement-2

   For Local Y=400 To 480 
      XLineInPosition=XLineInPosition+(XDeplacement/10)
      XLineZoom=XLineZoom+0.1

      DisplayBrush(1,320+XDeplacement+XLineInPosition,Y,{scaleX=XLineZoom,anchorx=0.5})
   Next
   Local Temps=GetTimer(1)
   Box(0,0,640,400)
   TextOut (220,20,"3D floor for Beat Them All")
   TextOut (160,40," Right Arrow key to move right")
   TextOut (160,50," Left Arrow key to move left")
   TextOut (0,0,Round((1/Temps)*1000))
   TextOut (30,0,"Frame per second")
EndFunction
; Is programmed in, the variables say all ;-)
SetInterval(1,Sol3D,20)
BeginDoubleBuffer

Repeat
WaitEvent
Forever
It's Ok