Posted: 13th Dec 2021 23:56
My brother got shot last week

jeebus. i hope he's alright. and don't apologize when life happens

ps, get to work on this.
Posted: 14th Dec 2021 0:33
"My brother got shot last week"


I am praying for you

Sorry to hear about this.
Posted: 19th Dec 2021 18:28
No one ?

Just for a break !
Mother M protecting b from d

+ Code Snippet
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "Text game" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
x as float
z as float
x2 as float
z2 as float
ox as float
oz as float
ang as float
x2=10
z2=150
x=100
z=50
ox=100
oz=200
d=createtext("d")
b=createtext("b")
c=createtext("M")

settextcolor(d,255,255,0,255)
settextcolor(b,0,255,0,255)
settextcolor(c,255,0,0,255)
settextsize(d,40)
settextsize(b,40)
settextsize(c,40)
settextposition(c,100,200)
do
clearscreen()


x2=x2+0.5
if x2>200
	 x2=10 
	 z2=10+random(0,200)
endif
	 

SetTextPosition(d,x,z)
settextposition(b,x2,z2)
angle# = atanfull(x-x2, z-z2)

x=x+sin(angle#)*-0.4
z=z+cos(angle#)*0.4

dist#=distance#(x,z,x2,z2)
dist2#=distance#(x,z,ox,oz)

w=makecolor(255,0,255)
if dist#<5 then DrawEllipse( x+10,z+15,20,20,W,W,0)

if dist#<8
	run=run+1
	if run=2 then ka=ka+1
	else
	run=0
endif
 
if dist2#<10 then z=z+3     
 
 ox=ox+sin(ang)*-3
 oz=oz+cos(ang)*3
 w=makecolor(255,200,0)
 drawellipse(ox,oz,2,2,w,w,1)
 s=s+1 
 if s<10 then ang = atanfull(ox-x, oz-z)
 if s>150 or oz<0 
	 s=0
	 ox=110
	 oz=220
 endif	 
 if z>250 then x=x+0.8
   if ka<2 then text$="  baby" else text$="  babies"
 
  print( str(ka) +text$)
    Sync()
loop
function distance#(x1#,z1#,x2#,z2#)
value#=sqrt(((x2#-(x1#))^2)+((z2#-(z1#))^2))
ENDFUNCTION value#
Posted: 20th Dec 2021 13:49
No one ?

sorry. i'm not up for learning about mode 7 right now

and i expect similar for others? maybe give us an alternative challenge?

actually, i think you already did! i'm already working on a "text-based" entry. stay tuned!
Posted: 20th Dec 2021 16:46
actually, i think you already did!


Yeah...perhaps I jumped the gun with such a big jump from screen saver to mode 7
Feel free to set up a new challenge....text-based game is Ok...
Posted: 20th Dec 2021 18:29
text-based game is Ok

then it's official

Judge: chafari
Challenge: text-based game
Deadline: Sunday , Dec 26 at MIDNIGHT UTC

my entry: FLY HARD!

+ Code Snippet
// Created: 2021-12-20
// By: Virtual Nomad
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "FLY HARD!" )
SetWindowSize( 640,360, 0 )
SetWindowAllowResize( 1 )
MaximizeWindow()

// set display properties
SetVirtualResolution( 640,360)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 ) 
SetPrintSize(32)
GLOBAL Rate#, Score, High, Player,playerTXT

GLOBAL frames as String []
	frames.Insert("\V/")
	frames.insert("_V_")
	frames.Insert(" V " + CHR(10) + "/ \")
	frames.insert("_V_")
	playerTXT = CreateText(frames[0])	:	SetTextSize(playerTXT,32)	:	SetTextAlignment(playerTXT,1)
	player = CreateSprite(0)			:	SetSpriteSize(player,16,16)

	SetSpritePhysicsOn(player,2)		:	SetSpritePhysicsIsBullet(player,1)
	SetSpritePosition(player,100,240)	:	SetSpriteVisible(player,0)
	SetSpritePhysicsCanRotate(player,0)

Type Wall
	topTXT, topSPR, botTXT,botSPR
EndType
GLOBAL Walls as Wall []
MakeWalls()

SetPhysicsGravity(0,100)

Restart()


do
	if GetPointerPressed()
		SetSpritePhysicsVelocity(player,0,-100.0)
		nextflap# = Timer()
	endif
	
	If GetRawMouseRightState() //DIVE!
		SetSpritePhysicsVelocity(player,0,GetSpritePhysicsVelocityY(player) + 10 )
		frame = 0	:	SetTextString(playerTXT, frames[0])	:	nextflap# = timer() + 0.1
	Else
		if nextflap# < timer()
			INC frame	:	if frame > frames.length then frame = 0
			SetTextString(playerTXT, frames[frame])
			nextflap# = timer() + 0.1
		endif
	Endif
	

	SetTextPosition(playerTXT,GetSpriteXByOffset(player),GetSpriteYByOffset(player)-16)
		
	
    If GetRawKeyState(27) then End    

	DoWalls()

	CheckHits()

	
	print("FLY HARD!")
	Print("Score: " + STR(Score) )
    Sync()
loop

Function CheckHits()
	If GetSpriteFirstContact(player) or GetSpriteCollision(player,Walls[0].topSPR) or GetSpriteCollision(player,Walls[0].botspr)
		GameOver()
	EndIf
EndFunction

Function GameOver()
	Time# = Timer() + 5
	SetTextColor(playerTXT,255,0,0,255)
	Repeat
		If GetRawKeyState(27) then End   
		Print("OUCH!")
		Sync()
	Until Timer() > Time# or GetPointerPressed()
	SetTextColor(playerTXT,255,255,255,255)
	Restart()
EndFunction

Function Restart()
	SetTextVisible(Walls[0].topTXT, 0)
	SetTextVisible(Walls[0].botTXT,0)
	SetTextPosition(playerTXT,320,120)
	nextflap# = Timer()
	If Score > High then High = Score
	Repeat
		If GetRawKeyState(27) then End
		Print("FLY HARD!")
		Print("[LMB] = Flap  [RMB] = Dive!")
		Print("Last Score: " + STR(Score))
		Print("High Score: " + STR(High))
		Print("[Flap] to Continue")
		if nextflap# < timer()
			INC frame	:	if frame > frames.length then frame = 0
			SetTextString(playerTXT, frames[frame])
			nextflap# = timer() + 0.1
		endif

		Sync()
	Until GetPointerPressed()
	Rate# = 2.0
	score = 0
	SetTextPosition(Walls[0].topTXT, 640,(-8+Random(0,4))*32)
	SetTextVisible(Walls[0].topTXT, 1)
	SettextVisible(Walls[0].botTXT,1)
	SetSpritePositionByOffset(player,100,180)
EndFunction


Function DoWalls()
	for x = 0 to Walls.length
		tspr = walls[x].topspr	:	ttxt = Walls[x].topTXT
		bspr = walls[x].botspr	:	btxt = Walls[x].botTXT
		SetTextX(ttxt, GetTextX(ttxt) - Rate#)
		if GettextX(ttxt) < 0
			SetTextPosition(ttxt, 640,(-8+Random(0,4))*32)
			INC Rate#, 0.4
			INC Score
		Endif
		SetSpritePosition(tspr,gettextx(ttxt),GettextY(ttxt)+40)
		SetTextPosition(btxt,GetTextX(ttxt),GetTextY(ttxt)+450)
		SetSpritePosition(bspr, GetTextX(ttxt), GetTextY(ttxt)+450+40)
	next x
EndFunction

Function MakeWalls()
	TXT$ = ""
	for x = 1 to 10
		TXT$ = TXT$ + CHR(10) + "[]"
	next x

	top = CreateText(TXT$)		:	SetTextSize(top,32)	:	SetTextPosition(top, 640,(-8+Random(0,4))*32)
	
	tspr = CreateSprite(0)		:	SetSpriteSize(tspr,16,310)
	SetSpriteVisible(tspr,0)

	bot = CreateText(TXT$)		:	SetTextSize(bot,32)
	bspr = CloneSprite(tspr)
	SetSpriteVisible(bspr,0)

	thiswall as Wall
		thiswall.topTXT = top	:	thiswall.topSPR = top
		thiswall.botTXT = bot 	:	thiswall.botSPR = bspr
		walls.insert(thiswall)
EndFunction

my high (so far).

i may tweak this until the deadline!

and, yeah "Walls.length" = i had other plans

otherwise, let's keep these challenges going, guys. lots of fun to be had!
Posted: 20th Dec 2021 21:23
that's very funy .....this reminds me of those old games in which not everything was the good graphics but the ingenuity of the game ....my best 11 points
Posted: 23rd Dec 2021 2:29
mini-update: started off too slow, saves high score.

FLY HARD!
+ Code Snippet
// Created: 2021-12-20
// By: Virtual Nomad
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "FLY HARD!" )
SetWindowSize( 320,180, 0 )
SetWindowAllowResize( 1 )
MaximizeWindow()

// set display properties
SetVirtualResolution( 640,360)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 ) 
SetPrintSize(32)

GLOBAL Rate#, Score, High, Player, playerTXT
GLOBAL hi$ = "hi.dat"

if GetFileExists(hi$)
	file = OpenToRead(hi$)
	High = ReadInteger(file)
	CloseFile(file)
Endif

GLOBAL frames as String []
	frames.Insert("\V/")
	frames.insert("_V_")
	frames.Insert(" V " + CHR(10) + "/ \")
	frames.insert("_V_")
	playerTXT = CreateText(frames[0])	:	SetTextSize(playerTXT,32)	:	SetTextAlignment(playerTXT,1)
	player = CreateSprite(0)			:	SetSpriteSize(player,16,16)

SetSpritePhysicsOn(player,2)		:	SetSpritePhysicsIsBullet(player,1)
SetSpritePosition(player,100,240)	:	SetSpriteVisible(player,0)
SetSpritePhysicsCanRotate(player,0)

Type Wall
	topTXT, topSPR, botTXT,botSPR
EndType
GLOBAL Walls as Wall []
MakeWalls()

SetPhysicsGravity(0,100)

Restart()


do
	if GetPointerPressed()
		SetSpritePhysicsVelocity(player,0,-100.0)
		nextflap# = Timer()
	endif
	
	If GetRawMouseRightState() //DIVE!
		SetSpritePhysicsVelocity(player,0,GetSpritePhysicsVelocityY(player) + 10 )
		frame = 0	:	SetTextString(playerTXT, frames[0])	:	nextflap# = timer() + 0.1
	Else
		if nextflap# < timer()
			INC frame	:	if frame > frames.length then frame = 0
			SetTextString(playerTXT, frames[frame])
			nextflap# = timer() + 0.1
		endif
	Endif
	

	SetTextPosition(playerTXT,GetSpriteXByOffset(player),GetSpriteYByOffset(player)-16)
		
	
    If GetRawKeyState(27) then End    

	DoWalls()

	CheckHits()

	
	print("FLY HARD!")
	Print("Score: " + STR(Score) )
    Sync()
loop

Function CheckHits()
	If GetSpriteFirstContact(player) or GetSpriteCollision(player,Walls[0].topSPR) or GetSpriteCollision(player,Walls[0].botspr)
		GameOver()
	EndIf
EndFunction

Function GameOver()
	Time# = Timer() + 5
	SetTextColor(playerTXT,255,0,0,255)
	Repeat
		If GetRawKeyState(27) then End   
		Print("OUCH!")
		Sync()
	Until Timer() > Time# or GetPointerPressed()
	SetTextColor(playerTXT,255,255,255,255)
	Restart()
EndFunction

Function Restart()
	SetTextVisible(Walls[0].topTXT, 0)
	SetTextVisible(Walls[0].botTXT,0)
	SetTextPosition(playerTXT,320,120)
	nextflap# = Timer()
	If Score > High
		High = Score
		file = OpenToWrite(hi$)	:	WriteInteger(file,high)	:	CloseFile(file)
	Endif
	Repeat
		If GetRawKeyState(27) then End
		Print("FLY HARD!")
		Print("[LMB] = Flap!  [RMB] = Dive!")
		Print("Last Score: " + STR(Score))
		Print("High Score: " + STR(High))
		Print("[Flap] to Continue")
		if nextflap# < timer()
			INC frame	:	if frame > frames.length then frame = 0
			SetTextString(playerTXT, frames[frame])
			nextflap# = timer() + 0.1
		endif

		Sync()
	Until GetPointerPressed()
	Rate# = 3.0
	score = 0
	SetTextPosition(Walls[0].topTXT, 640,(-8+Random(0,4))*32)
	SetTextVisible(Walls[0].topTXT, 1)
	SettextVisible(Walls[0].botTXT,1)
	SetSpritePositionByOffset(player,100,180)
EndFunction


Function DoWalls()
	for x = 0 to Walls.length
		tspr = walls[x].topspr	:	ttxt = Walls[x].topTXT
		bspr = walls[x].botspr	:	btxt = Walls[x].botTXT
		SetTextX(ttxt, GetTextX(ttxt) - Rate#)
		if GettextX(ttxt) < 0
			SetTextPosition(ttxt, 640,(-9+Random(0,5))*32)
			INC Rate#, 0.4
			INC Score
		Endif
		SetSpritePosition(tspr,gettextx(ttxt),GettextY(ttxt)+40)
		SetTextPosition(btxt,GetTextX(ttxt),GetTextY(ttxt)+450)
		SetSpritePosition(bspr, GetTextX(ttxt), GetTextY(ttxt)+450+40)
	next x
EndFunction

Function MakeWalls()
	TXT$ = ""
	for x = 1 to 10
		TXT$ = TXT$ + CHR(10) + "[]"
	next x

	top = CreateText(TXT$)		:	SetTextSize(top,32)	:	SetTextPosition(top, 640,(-9+Random(0,5))*32)
	
	tspr = CreateSprite(0)		:	SetSpriteSize(tspr,16,310)
	SetSpriteVisible(tspr,0)

	bot = CreateText(TXT$)		:	SetTextSize(bot,32)
	bspr = CloneSprite(tspr)
	SetSpriteVisible(bspr,0)

	thiswall as Wall
		thiswall.topTXT = top	:	thiswall.topSPR = top
		thiswall.botTXT = bot 	:	thiswall.botSPR = bspr
		walls.insert(thiswall)
EndFunction
Posted: 25th Dec 2021 18:49
Nice one VN. And it's more playable than the version that comes with my phone.

Also, this UTC site is trying to confuse me (which is easy to do).
Posted: 26th Dec 2021 14:52
Good topic, great examples.

Here you are 3 in 1

Enjoy (Use A and D keys in PC usage)



+ Code Snippet

// Project: ..::..
// Created: 2021-12-26

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "*!*" )
SetWindowSize( 1920, 1080, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1920, 1080 ) // doesn't have to match the window
SetOrientationAllowed( 0, 0, 0, 0 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 1 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
//UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts




#Constant _SCREEN_WIDTH_ 240
#Constant _SCREEN_HEIGHT_ 135
#Constant _SCREEN_MIDX_ 120
#Constant _SCREEN_MIDY_ 62.5

#Constant _TEXTURE_SIZE_ 256
#Constant _TEXTURE_AND_ 255


Type _VEC_4_
	X			As Float
	Y			As Float
	Z			As Float
	W			As Float
EndType

Global ProjectionPlaneWidth As Float
Global ProjectionPlaneHeight As Float
Global ProjectionPlaneDistance As Float
Global CameraFOV As Float
Global CameraHalfFOV As Float
Global CameraDeltaAngle As Float
Global CameraAngle As _VEC_4_
Global CameraPosition As _VEC_4_
Global _GRID_SIZE_ As Float
Global TurnSpeed As Float
Global MoveSpeed As Float

Global _TEXTURE_ As Float[8, _TEXTURE_SIZE_, _TEXTURE_SIZE_, 3]








Global _EOL_ As String
_EOL_ = Chr(13) + Chr(10)


Global _MAP_ As Integer[64, 64], _SURFACE_ As Integer[_SCREEN_HEIGHT_]
Global _CHAR_SIZE_ As Float
Global _X_TILES_ As Integer, _Z_TILES_ As Integer

_LOAD_MAP_()
_CREATE_TEXTURES_()

Do
    //_CLS_() no need to clear the screen
    _GET_USER_INPUT_()
	_RAY_CAST_()
    _SHOW_CONTROLS_()
    Sync()
Loop



Function _RAY_CAST_()
    Local X As Integer, Y As Integer, i As Integer, Ax As Integer, Size As Integer, cX As Integer, cY As Integer, C As Integer
    Local ScanAngle As Float, EyeAngle As Float, DeltaAngle As Float, f As Float, g As Float, h As Float
	Local S As String, E As String

    Local SinY As Float, CosY As Float, RayDirX As Float, RayDirZ As Float, StartX As Float, StartZ As Float
    Local ddx As Float, ddz As Float, SideX As Float, SideZ As Float, Distance As Float
    Local xMap As Integer, zMap As Integer, iX As Integer, iZ As Integer

	Local StepX As Integer, StepZ As Integer, Wall As Integer, Side As Integer, WallHeight As Integer

	Local YStart As Integer, YEnd As Integer
	Local t00 As Float, t01 As Float, tU As Float, tV As Float, uTU As Float, tX As Integer, tY As Integer, xIntersect As Float, zIntersect As Float, vStep As Float
	
    ScanAngle = CameraAngle.Y - CameraHalfFOV
    EyeAngle = -CameraHalfFOV
    DeltaAngle = CameraDeltaAngle    
    
    
    Size = 60
    //cx = (_SCREEN_WIDTH_ - Size * _X_TILES_)/2
    //cy = _SCREEN_HEIGHT_ - (_SCREEN_HEIGHT_ - Size * _Z_TILES_)/2
    
    ScanAngle = ScanAngle - DeltaAngle
    EyeAngle = EyeAngle - DeltaAngle
    
    
    
    StartX = CameraPosition.X
    StartZ = CameraPosition.Z
    iX = Floor(StartX)
    iZ = Floor(StartZ)
    
    
    For X = 0 To _SCREEN_WIDTH_ - 1
        ScanAngle = ScanAngle + DeltaAngle
        EyeAngle = EyeAngle + DeltaAngle
        
        SinY = Sin(ScanAngle)
        CosY = Cos(ScanAngle)
        
        
        raydirx = CosY
        raydirz = SinY
        
        
        ddx = sqrt(1 + (SinY * SinY)/(CosY * Cosy))
        ddz = sqrt(1 + (CosY * Cosy)/(SinY * SinY))
        
        xMap = iX
        zMap = iZ
		f = xMap
		g = zMap
        If CosY < 0
            StepX = -1
            SideX = (StartX - f) * ddx
        Else
            StepX = 1
            SideX = (1 + f - StartX) * ddx
        EndIf
        
        If SinY < 0
            StepZ = -1
            SideZ = (StartZ - g) * ddz
        Else
            StepZ = 1
            SideZ = (1 + g - StartZ) * ddz
        EndIf
        

        
        Do
            If SideX < SideZ
                SideX = SideX + ddx
                xMap = xMap + StepX
                Side = 0
            Else
                SideZ = SideZ + ddz
                zMap = zMap + StepZ
                Side = 1
            EndIf
            If (xMap < 0) Or (xMap >= _X_TILES_) Or (zMap < 0) Or (zMap >= _Z_TILES_) Then Exit
            Wall = _MAP_[xMap, zMap]
            If Wall Then Exit
        Loop

        If Side = 0
            Distance = Abs((xMap - StartX + (1 - StepX)/2)/CosY)
            tU = StartZ + ((xMap - StartX + (1 - StepX)/2)/CosY)*SinY
            If CosY < 0 Then Side = 1
            xIntersect = StartX + Distance * CosY / Abs(Cos(EyeAngle))
            zIntersect = StartZ + Distance * SinY / Abs(Cos(EyeAngle))
        Else
            Distance = Abs((zMap - StartZ + (1 - StepZ)/2)/SinY)
            tU = StartX + ((zMap - StartZ + (1 - StepZ)/2)/SinY)*CosY
            Side = Side * 2
            If SinY < 0 Then Side = 3
            xIntersect = StartX + Distance * CosY / Abs(Cos(EyeAngle))
            zIntersect = StartZ + Distance * SinY / Abs(Cos(EyeAngle))
            
        EndIf
     
		f = _SCREEN_HEIGHT_
        WallHeight = Abs(Floor(f/(Distance * Cos(EyeAngle))))
        
        Ax = X //+ 1
        YStart = 0
        YEnd = Floor(_SCREEN_HEIGHT_ - WallHeight)/2
        If YEnd > _SCREEN_HEIGHT_ - 1 Then YEnd = _SCREEN_HEIGHT_ - 1
        If YEnd < 0 Then YEnd = 0
        h = YStart
        f = _SCREEN_MIDY_ - h
        g = X - _SCREEN_MIDX_
        g = g * _TEXTURE_AND_
        h = _SCREEN_WIDTH_
        h = h * _TEXTURE_AND_
        For i = YStart To YEnd
            t00 =  g/f
            t01 = h/f
            tU = t00 * CosY + t01 * SinY
            tV = t01 * CosY - t00 * SinY
            tX = tU/8
            tY = tV/8
            tX = tX  && _TEXTURE_AND_
            tY = tY  && _TEXTURE_AND_
			SetTextCharColor(_SURFACE_[i], X, _TEXTURE_[0, tX, tY, 2], _TEXTURE_[0, tX, tY, 1], _TEXTURE_[0, tX, tY, 0], 255)
			f = f - 1
		Next
		
		YStart = (_SCREEN_HEIGHT_ - WallHeight)/2 + 1
		YEnd = (_SCREEN_HEIGHT_ + WallHeight)/2
        If YEnd > _SCREEN_HEIGHT_ - 1 Then YEnd = _SCREEN_HEIGHT_ - 1
        If YEnd < 0 Then YEnd = 0
        
        tU = uTU
        f = WallHeight
        h = _TEXTURE_AND_
        VStep = h/f
        tV = 0
        tX = Floor(tU * _TEXTURE_AND_) && _TEXTURE_AND_
		If YStart < 0
			h = YStart
			tv = -vSTep * h
			YStart = 0
		EndIf
		Side = Side + 2
        For i = YStart To YEnd
            tY = Floor(tV) && _TEXTURE_AND_
            tV = tV + VStep
			SetTextCharColor(_SURFACE_[i], Ax, _TEXTURE_[Side, tX, tY, 2], _TEXTURE_[Side, tX, tY, 1], _TEXTURE_[Side, tX, tY, 0], 255)
		Next


		YStart = YEnd + 1
		YEnd = _SCREEN_HEIGHT_ - 1
		f = Ystart - _SCREEN_MIDY_
		h = _TEXTURE_AND_
		g = _SCREEN_MIDY_
		g = g * h/Distance
		
        For i = YStart To YEnd
            t00 = g/f
            t01 = h - t00
            tU = t00 * xIntersect + t01 * StartX
            tV = t00 * zIntersect + t01 * StartZ
            tX = Floor(tU) && _TEXTURE_AND_
            tY = Floor(tV) && _TEXTURE_AND_
			SetTextCharColor(_SURFACE_[i], Ax, _TEXTURE_[1, tX, tY, 2], _TEXTURE_[1, tX, tY, 1], _TEXTURE_[1, tX, tY, 0], 255)
			f = f + 1
		Next

        
    Next
EndFunction




Function _LOAD_MAP_()
	Local S As String, i As Integer, j As Integer, k As Integer
	
	For i = 0 To _SCREEN_WIDTH_ - 1
		S = S + "Q"
	Next
	
	j = CreateText(S)
	_CHAR_SIZE_ = 100
	Do
		SetTextSize(j, _CHAR_SIZE_)
		If GetTextTotalWidth(j) < 1920 Then Exit
		_CHAR_SIZE_ = _CHAR_SIZE_ - 0.5
	Loop
	_CHAR_SIZE_ = _CHAR_SIZE_ + 0.5
	DeleteText(j)
	_X_TILES_ = 32
	_Z_TILES_ = 32
	
	S = ""
	S = S + "11111111111111111111111111111111"
	S = S + "1                              1"
	S = S + "1   11111                 1    1"
	S = S + "1                              1"
	S = S + "1                 1111 111     1"
	S = S + "1                    1 1       1"
	S = S + "1   1111  1111       1 1       1"
	S = S + "1      1  1          1 1       1"
	S = S + "1      1  1                    1"
	S = S + "1      1111               1111 1"
	S = S + "1                11111    1    1"
	S = S + "1         1               1    1"
	S = S + "11111111111        11111111    1"
	S = S + "1                  1           1"
	S = S + "1     11111      1 1           1"
	S = S + "1     1   1      1 1           1"
	S = S + "1     1   1      1 11111       1"
	S = S + "1     1   1      1     1       1"
	S = S + "1   111   1111   1111111       1"
	S = S + "1            1                 1"
	S = S + "1            1           1111  1"
	S = S + "1     111111 1           1     1"
	S = S + "1            11111       1     1"
	S = S + "1                        1     1"
	S = S + "1       1111                   1"
	S = S + "1       1      1   1           1"
	S = S + "1       1   1111   1           1"
	S = S + "1   11111   1  11 11     111   1"
	S = S + "1           1            1 1   1"
	S = S + "1           1            111   1"
	S = S + "1           1                  1"
	S = S + "11111111111111111111111111111111"
	
	
	
	
	k = 1
	For i = 0 To _Z_TILES_ - 1
		For j = 0 To _X_TILES_ - 1
			_MAP_[j, i] = 0
			If Mid(S, k, 1) <> " " Then _MAP_[j, i] = 1
			k = k + 1
		Next
	Next





	_GRID_SIZE_ = 1
	TurnSpeed = 50
	MoveSpeed = _GRID_SIZE_
	CameraPosition.X                = 12.23 * _GRID_SIZE_
	CameraPosition.Y                = 0.5 * _GRID_SIZE_
	CameraPosition.Z                = 12.23 * _GRID_SIZE_
	CameraPosition.W                = 0 * _GRID_SIZE_
	CameraFOV                       = 60
	CameraHalfFOV                   = CameraFOV/2
	CameraDeltaAngle                = CameraFOV/(_SCREEN_WIDTH_)
	ProjectionPlaneDistance         = (_SCREEN_WIDTH_/2)/Tan(CameraFov/2)


	

	For i = 0 To _SCREEN_HEIGHT_ - 1
		S = ""
		For j = 0 To _SCREEN_WIDTH_ - 1
			S = S + Chr(65 + (Random() >> 12))
		Next
		_SURFACE_[i] = CreateText(S)
		SetTextPosition(_SURFACE_[i], 0, i * (_CHAR_SIZE_ - 4))
		SetTextSize(_SURFACE_[i], _CHAR_SIZE_)
		SetTextColor(_SURFACE_[i], 0, 0, 0, 255)
	Next
	
	
EndFunction

/*
Function _CLS_()
	Local i As Integer
	For i = 0 To _SCREEN_HEIGHT_ - 1
		SetTextColor(_SURFACE_[i], 0, 0, 0, 255)
	Next
EndFunction
*/

Function _SHOW_CONTROLS_()
	Local X As Integer, Y As Integer, i As Integer, Ax As Integer, Bx As Integer, Ay As Integer
	Ax = X + 17
	Bx = _SCREEN_WIDTH_ - 21
	For X = 0 To 15
		Y = 15 - X
		Ay = _SCREEN_HEIGHT_ - Y/2 - 25
		For i = 0 To Y
			SetTextCharColor(_SURFACE_[Ay + i], Ax, 255, 255, 0, 255)
			SetTextCharColor(_SURFACE_[Ay + i], Bx, 255, 255, 0, 255)
		Next
		
		SetTextCharColor(_SURFACE_[2 + i], Bx - 1, 255, 0, 0, 255)
		SetTextCharColor(_SURFACE_[2 + i], Bx, 255, 0, 0, 255)
		SetTextCharColor(_SURFACE_[2 + i], _SCREEN_WIDTH_ - 24 + Ax, 255, 0, 0, 255)
		SetTextCharColor(_SURFACE_[2 + i], _SCREEN_WIDTH_ - 24 + Ax + 1, 255, 0, 0, 255)
		
		Ax = Ax - 1
		Bx = Bx + 1
	Next
EndFunction

Function _GET_USER_INPUT_()
    Local _FPS_ As Float
    Local Move As Float, Turn As Float, SinY As Float, CosY As Float, SinS As Float, CosS As Float, VMove As Float, HMove As Float
    Local MouseMove As _VEC_4_, DeltaAngle As _VEC_4_, DeltaPos As _VEC_4_
    Local xMap As Integer, zMap As Integer
    _FPS_ = ScreenFPS()
    Turn = TurnSpeed/_FPS_
    Move = MoveSpeed/_FPS_
    
    MouseMove.X = 0
    
    If GetPointerState()
		CosY = GetPointerX()
		SinY = GetPointerY()
		If SinY >= 930
			If SinY <= 1070
				If CosY <= 150
					If CosY >= 15 Then MouseMove.X = -1
				Else
					If CosY >= 1780
						If CosY <= 1910 Then MouseMove.X = 1
					EndIf
				EndIf
			EndIf
		EndIf
	
		If SinY >= 30
			If SinY <= 170
				If CosY <= 1910
					If CosY >= 1780 Then END
				EndIf
			EndIf
		EndIf
	
	
	EndIf
    
    
    
    If GetRawKeyState(65) Then MouseMove.X = -1
    If GetRawKeyState(68) Then MouseMove.X = 1
    
    
    
    
    MouseMove.X = MouseMove.X * Turn
    CameraAngle.Y = CameraAngle.Y + MouseMove.X
    SinY = Sin(CameraAngle.Y)
    CosY = Cos(CameraAngle.Y)
    SinS = Sin(CameraAngle.Y + 90)
    CosS = Cos(CameraAngle.Y + 90)
    
    VMove = 1
    If GetRawKeyState(Asc("W")) Then VMove = 1
    If GetRawKeyState(Asc("S")) Then VMove = -1
    
    
    
    
    
    
    DeltaPos.X = CosY * VMove * Move
    DeltaPos.Y = 0
    DeltaPos.Z = SinY * VMove * Move
    DeltaPos.W = 0
    
    CameraPosition.X = CameraPosition.X + DeltaPos.X
    xMap = Floor(CameraPosition.X + DeltaPos.X)
    zMap = Floor(CameraPosition.Z + DeltaPos.Z)
    If _MAP_[xMap, zMap] Then CameraPosition.X = CameraPosition.X - DeltaPos.X
    CameraPosition.Z = CameraPosition.Z + DeltaPos.Z
    xMap = Floor(CameraPosition.X + DeltaPos.X)
    zMap = Floor(CameraPosition.Z + DeltaPos.Z)    
	If _MAP_[xMap, zMap] Then CameraPosition.Z = CameraPosition.Z - DeltaPos.Z
EndFunction



Function _CREATE_TEXTURES_()
    Local e1 As Integer, e2 As Integer, d As Integer, R As Integer, G As Integer, B As Integer, i As Integer, j As Integer

    
    
    
    

    e1 = _TEXTURE_SIZE_
    d = _TEXTURE_SIZE_
    _TEXTURE_[0, 0, 0, 0] = 245
    _TEXTURE_[0, 0, 0, 1] = 64
    _TEXTURE_[0, 0, 0, 2] = 16
    
    Do
		If d <= 1 Then Exit
        e2 = d/2
        For i = 0 to _TEXTURE_AND_ Step d
            For j = 0 to _TEXTURE_AND_ Step d
                R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 0] = B
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 1] = G
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 2] = R
    
                R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                
                _TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 0] = B
                _TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 1] = G
                _TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 2] = R
    
                R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 0] = B
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 1] = G
                _TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 2] = R
            Next
        Next
        e1 = e1/2
        d = e1
    Loop        
    
    e1 = _TEXTURE_SIZE_
    d = _TEXTURE_SIZE_
    _TEXTURE_[1, 0, 0, 0] = 8
    _TEXTURE_[1, 0, 0, 1] = 64
    _TEXTURE_[1, 0, 0, 2] = 16
    
    Do
		If d <= 1 Then Exit
        e2 = d/2
        For i = 0 to _TEXTURE_AND_ Step d
            For j = 0 to _TEXTURE_AND_ Step d
                R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 0] = B
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 1] = G
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 2] = R
    
                R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                
                _TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 0] = B
                _TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 1] = G
                _TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 2] = R
    
                R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
                G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
                B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
                If R > 255 Then R = 255
                If G > 255 Then G = 255
                If B > 255 Then B = 255
                If R < 0 Then R = 0
                If G < 0 Then G = 0
                If B < 0 Then B = 0
                
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 0] = B
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 1] = G
                _TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 2] = R
            Next
        Next
        e1 = e1/2
        d = e1
    Loop
    
    
    For i = 0 To _TEXTURE_AND_
		For j = 0 To _TEXTURE_AND_
			B = 4 + _RND_() * 4
			G = 16 + _RND_() * 8
			R = 128 + _RND_() * 32
			_TEXTURE_[2, j, i, 0] = B
			_TEXTURE_[2, j, i, 1] = G
			_TEXTURE_[2, j, i, 2] = R

			_TEXTURE_[3, j, i, 0] = B * 100/150
			_TEXTURE_[3, j, i, 1] = G * 100/150
			_TEXTURE_[3, j, i, 2] = R * 100/150

			_TEXTURE_[4, j, i, 0] = B * 100/260
			_TEXTURE_[4, j, i, 1] = G * 100/260
			_TEXTURE_[4, j, i, 2] = R * 100/260
			
			_TEXTURE_[5, j, i, 0] = B * 100/150
			_TEXTURE_[5, j, i, 1] = G * 100/150
			_TEXTURE_[5, j, i, 2] = R * 100/150
			
		Next
	Next
    
    e1 = _TEXTURE_SIZE_/4
    For i = 0 To 3
		For G = 0 To 3
		For j = 0 To _TEXTURE_AND_
			
				R = 245 + _RND_() * 10
				_TEXTURE_[2, j, i * e1 + G, 0] = R
				_TEXTURE_[2, j, i * e1 + G, 1] = R
				_TEXTURE_[2, j, i * e1 + G, 2] = R
				
				_TEXTURE_[3, j, i * e1 + G, 0] = R * 100/150
				_TEXTURE_[3, j, i * e1 + G, 1] = R * 100/150
				_TEXTURE_[3, j, i * e1 + G, 2] = R * 100/150

				_TEXTURE_[4, j, i * e1 + G, 0] = R * 100/260
				_TEXTURE_[4, j, i * e1 + G, 1] = R * 100/260
				_TEXTURE_[4, j, i * e1 + G, 2] = R * 100/260

				_TEXTURE_[5, j, i * e1 + G, 0] = R * 100/150
				_TEXTURE_[5, j, i * e1 + G, 1] = R * 100/150
				_TEXTURE_[5, j, i * e1 + G, 2] = R * 100/150
			Next
		Next
    Next
    
EndFunction

Function _RND_()
	Local f As Float
	f = Random()
	f = f/65535
EndFunction f


Posted: 26th Dec 2021 19:02
Holly molly! @Arch-Ok ....just when I thought that no one else would participate .....no doubt you have taken it at face value ....something like raycasting made with text . At first this is more or less what I meant by mode 7 or raycasting ...I've been stunned with your code ...Thanks for participating .
Posted: 26th Dec 2021 20:56
@chafari you are welcome. Just don't use the _CLS_() command, it is not necessary since we visit every chars on the screen. Floor texture calculating is also a little buggy. Enjoy!
Posted: 26th Dec 2021 21:10
very nice, Arch-Ok!

and, now i have some code to study
Posted: 26th Dec 2021 21:27
thank you @Virtual Nomad, I've cleaned the code alittle bit.
Posted: 26th Dec 2021 22:58
Here is my noobie attempt.
Use arrow keys.


+ Code Snippet
// Project: Lady Bugs by ando - may contain a bug
// Created: 21-12-24

SetErrorMode(2)
//SetVSync(1)

Global width# as Float
Global height# as Float

width# = GetMaxDeviceWidth() // I had to use # to stabilise mouselook over different pc's
height# = GetMaxDeviceHeight()
SetWindowSize(width#,height#,1)
SetVirtualResolution(width#,height#) // doesn't have to match the window
SetSyncRate(30,0)
SetScissor(0,0,0,0) // use the maximum available screen space
UseNewDefaultFonts(1)
SetPrintSize(height#/25)

// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx map

Global map as integer [19,19]
Global object as integer [19,19]
Global monsterPos as integer [19,19]
Global monster1 as integer
Global player as integer
Global item as integer
Global x,y as integer

AddRow(1 ,"1111111111111111111") // 0 = vacant
AddRow(2 ,"1000000007000000001") // 1 = wall
AddRow(3 ,"1012431011101243101") // 2 = horizontal door left
AddRow(4 ,"1010001000001000101") // 3 = horizontal door right
AddRow(5 ,"1010101124311010101") // 4 = door center
AddRow(6 ,"1050101000001010501") // 5 = virtical door upper
AddRow(7 ,"1040101011101010401") // 6 = virtical door lower
AddRow(8 ,"1060000000000000601") // 7 = player
AddRow(9 ,"1012431010101243101") // 8 = monster
AddRow(10,"1010001010101000101") // 9 = item to collect
AddRow(11,"1010101018101010101")
AddRow(12,"1050101000001010501")
AddRow(13,"1040101010101010401")
AddRow(14,"1060101010101010601")
AddRow(15,"1010101010101010101")
AddRow(16,"1010000010100000101")
AddRow(17,"1011124310124311101")
AddRow(18,"1000000009000000001")
AddRow(19,"1111111111111111111")

Function AddRow(y,data$)
	    for x = 1 to 19
	        tile = VAL(MID(data$,x,1))
	        if tile=0
	            map[x,y]=0
	        endif
	        if tile=1
	            map[x,y]=1
	            object[x,y]=CreateText(chr(127)) //  127  wall
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],50,255,50,150)
	        endif
	        if tile=2
	            map[x,y]=2
	            object[x,y]=CreateText(chr(60)) //   60  door left
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],50,150,255,255)
	            
	            object[x+1,y-1]=CreateText(chr(94)) //   94  door upper invisible
	            SetTextSize(object[x+1,y-1],height#/20)
	            SetTextPosition(object[x+1,y-1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+2)-height#/25)
	            SetTextColor(object[x+1,y-1],50,150,255,255)
	            settextvisible(object[x+1,y-1],0)
	            
	            object[x+1,y+1]=CreateText(chr(118)) //   118  door lower invisible
	            SetTextSize(object[x+1,y+1],height#/20)
	            SetTextPosition(object[x+1,y+1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
	            SetTextColor(object[x+1,y+1],50,150,255,255)
	            settextvisible(object[x+1,y+1],0)
	        endif
	        if tile=3
	            map[x,y]=3
	            object[x,y]=CreateText(chr(62)) //   62  door right
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],50,150,255,255)
	        endif
	        if tile=4
	            map[x,y]=4
	            object[x,y]=CreateText(chr(847)) //   847  door center
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0085,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],150,200,255,255)
	        endif
	        if tile=5
	            map[x,y]=5
	            object[x,y]=CreateText(chr(94)) //   94  door upper
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],50,150,255,255)
	            
	            object[x-1,y+1]=CreateText(chr(60)) //   60  door left invisible
	            SetTextSize(object[x-1,y+1],height#/20)
	            SetTextPosition(object[x-1,y+1],(width#/41)*(x+10)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
	            SetTextColor(object[x-1,y+1],50,150,255,255)
	            settextvisible(object[x-1,y+1],0)
	            
	            object[x+1,y+1]=CreateText(chr(62)) //   62  door right invisible
	            SetTextSize(object[x+1,y+1],height#/20)
	            SetTextPosition(object[x+1,y+1],(width#/41)*(x+12)-width#/41+width#*0.0022,(height#/25)*(y+4)-height#/25)
	            SetTextColor(object[x+1,y+1],50,150,255,255)
	            settextvisible(object[x+1,y+1],0)
	        endif
	        if tile=6
	            map[x,y]=6
	            object[x,y]=CreateText(chr(118)) //   118  door lower
	            SetTextSize(object[x,y],height#/20)
	            SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
	            SetTextColor(object[x,y],50,150,255,255)
	        endif
	        if tile=7                         //   PLAYER
                map[x,y]=7
	            object[x,y]=CreateText(chr(79))
                SetTextSize(object[x,y],height#/20)
                SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41,(height#/25)*(y+3)-height#/25)
                player=object[x,y]
	        endif
	        if tile=8                         //   MONSTER
                map[x,y]=0
                monsterPos[x,y]=1
                monster1=CreateText(chr(88))
                SetTextSize(monster1,height#/20)
                SetTextPosition(monster1,(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
                SetTextColor(monster1,255,50,50,255)
	        endif
	        if tile=9                         //   item
                map[x,y]=9
	            object[x,y]=CreateText(chr(164))
                SetTextSize(object[x,y],height#/20)
                SetTextPosition(object[x,y],(width#/41)*(x+11)-width#/41+width#*0.0022,(height#/25)*(y+3)-height#/25)
                SetTextColor(object[x,y],255,255,50,255)
                item=object[x,y]
	        endif
	    next x
EndFunction

pPosX=10
pPosY=2
placeItem=0

monsterDir$="up"
mPosX=10
mPosY=11

// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  MAIN LOOP

do
    if gameover=0
        
        if score > 0
            scorekiller=scorekiller+1
            if scorekiller=50
                scorekiller=0
                score=score-1
            endif
        endif
        
        // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  monster X
        
	    if monsterdelay < 2
	        monsterdelay=monsterdelay+1
	    endif
	    
	    if monsterdelay=2
		    if monsterDir$="up"
		        if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY-1]=9
		            monsterPos[mPosX,mPosY]=0
		            monsterPos[mPosX,mPosY-1]=1
		            mPosY=mPosY-1
		            SetTextPosition(monster1,GetTextX(monster1),GetTextY(monster1)-height#/25)
			    else
			        mpick=random(1,3)
			        if mpick=1
			            monsterDir$="down"
			        endif
			        if mpick=2
			            monsterDir$="left"
			        endif
			        if mpick=3
			            monsterDir$="right"
			        endif
		        endif
		        monsterdelay=0
		        if map[mPosX-1,mPosY]=0 or map[mPosX+1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX+1,mPosY]=7
		            mpick=random(1,5)
		            if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="left"
			        endif
			        if mpick=3
			            monsterDir$="right"
			        endif
		        endif
		    endif
		    
		    if monsterDir$="down"
		        if map[mPosX,mPosY+1]=0 or map[mPosX,mPosY+1]=7 or map[mPosX,mPosY+1]=9
		            monsterPos[mPosX,mPosY]=0
		            monsterPos[mPosX,mPosY+1]=1
		            mPosY=mPosY+1
		            SetTextPosition(monster1,GetTextX(monster1),GetTextY(monster1)+height#/25)
			    else
			        mpick=random(1,3)
			        if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="left"
			        endif
			        if mpick=3
			            monsterDir$="right"
			        endif
		        endif
		        monsterdelay=0
		        if map[mPosX-1,mPosY]=0 or map[mPosX+1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX+1,mPosY]=7
		            mpick=random(1,5)
		            if mpick=1
			            monsterDir$="down"
			        endif
			        if mpick=2
			            monsterDir$="left"
			        endif
			        if mpick=3
			            monsterDir$="right"
			        endif
		        endif
		    endif
		    
		    if monsterDir$="left"
		        if map[mPosX-1,mPosY]=0 or map[mPosX-1,mPosY]=7 or map[mPosX-1,mPosY]=9
		            monsterPos[mPosX,mPosY]=0
		            monsterPos[mPosX-1,mPosY]=1
		            mPosX=mPosX-1
		            SetTextPosition(monster1,GetTextX(monster1)-width#/41,GetTextY(monster1))
			    else
			        mpick=random(1,3)
			        if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="down"
			        endif
			        if mpick=3
			            monsterDir$="right"
			        endif
		        endif
		        monsterdelay=0
		        if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY+1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY+1]=7
		            mpick=random(1,5)
		            if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="left"
			        endif
			        if mpick=3
			            monsterDir$="down"
			        endif
		        endif
		    endif
		    
		    if monsterDir$="right"
		        if map[mPosX+1,mPosY]=0 or map[mPosX+1,mPosY]=7 or map[mPosX+1,mPosY]=9
		            monsterPos[mPosX,mPosY]=0
		            monsterPos[mPosX+1,mPosY]=1
		            mPosX=mPosX+1
		            SetTextPosition(monster1,GetTextX(monster1)+width#/41,GetTextY(monster1))
			    else
			        mpick=random(1,3)
			        if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="down"
			        endif
			        if mpick=3
			            monsterDir$="left"
			        endif
		        endif
		        monsterdelay=0
		        if map[mPosX,mPosY-1]=0 or map[mPosX,mPosY+1]=0 or map[mPosX,mPosY-1]=7 or map[mPosX,mPosY+1]=7
		            mpick=random(1,5)
		            if mpick=1
			            monsterDir$="up"
			        endif
			        if mpick=2
			            monsterDir$="right"
			        endif
			        if mpick=3
			            monsterDir$="down"
			        endif
		        endif
		    endif
	    endif
	    
	    // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx item
	    
	    if placeItem=1
	        pickX=random(2,18)
	        pickY=random(2,18)
	        if map[pickX,pickY]=0
	            if map[pickX+1,pickY]<>4 and map[pickX-1,pickY]<>4 and map[pickX,pickY+1]<>4 and map[pickX,pickY-1]<>4
		            map[pickX,pickY]=9
		            SetTextPosition(item,(width#/41)*(pickX+11)-width#/41+width#*0.0022,(height#/25)*(pickY+3)-height#/25)
		            placeItem=0
		            settextvisible(item,1)
	            endif
	        endif
	    endif
	    
	    // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx player
	    
	    if playerdelay < 4
	        playerdelay=playerdelay+1
	    endif
	    
	    if playerdelay=4
		    if GetRawKeyState(38)     //  up
		        if map[pPosX,pPosY-1]=0
		            map[pPosX,pPosY-1]=7
		            map[pPosX,pPosY]=0
		            pPosY=pPosY-1
		            SetTextPosition(player,GetTextX(player),GetTextY(player)-height#/25)
		        elseif map[pPosX,pPosY-1]=2   //  left door
		            settextvisible(object[pPosX,pPosY-1],0)
		            settextvisible(object[pPosX+2,pPosY-1],0)
		            settextvisible(object[pPosX+1,pPosY],1)
		            settextvisible(object[pPosX+1,pPosY-2],1)
		            map[pPosX,pPosY-1]=0
		            map[pPosX+2,pPosY-1]=0
		            map[pPosX+1,pPosY]=6
		            map[pPosX+1,pPosY-2]=5
		        elseif map[pPosX,pPosY-1]=3    // right door
		            settextvisible(object[pPosX,pPosY-1],0)
		            settextvisible(object[pPosX-2,pPosY-1],0)
		            settextvisible(object[pPosX-1,pPosY],1)
		            settextvisible(object[pPosX-1,pPosY-2],1)
		            map[pPosX,pPosY-1]=0
		            map[pPosX-2,pPosY-1]=0
		            map[pPosX-1,pPosY]=6
		            map[pPosX-1,pPosY-2]=5
		        elseif map[pPosX,pPosY-1]=9    // item
		            map[pPosX,pPosY-1]=0
		            settextvisible(item,0)
		            placeItem=1
		            score=score+10
		        endif
		        playerdelay=0
		    elseif GetRawKeyState(40) //  down
		        if map[pPosX,pPosY+1]=0
		            map[pPosX,pPosY+1]=7
		            map[pPosX,pPosY]=0
		            pPosY=pPosY+1
		            SetTextPosition(player,GetTextX(player),GetTextY(player)+height#/25)
	            elseif map[pPosX,pPosY+1]=2   //  left door
		            settextvisible(object[pPosX,pPosY+1],0)
		            settextvisible(object[pPosX+2,pPosY+1],0)
		            settextvisible(object[pPosX+1,pPosY],1)
		            settextvisible(object[pPosX+1,pPosY+2],1)
		            map[pPosX,pPosY+1]=0
		            map[pPosX+2,pPosY+1]=0
		            map[pPosX+1,pPosY]=5
		            map[pPosX+1,pPosY+2]=6
		        elseif map[pPosX,pPosY+1]=3    // right door
		            settextvisible(object[pPosX,pPosY+1],0)
		            settextvisible(object[pPosX-2,pPosY+1],0)
		            settextvisible(object[pPosX-1,pPosY],1)
		            settextvisible(object[pPosX-1,pPosY+2],1)
		            map[pPosX,pPosY+1]=0
		            map[pPosX-2,pPosY+1]=0
		            map[pPosX-1,pPosY]=5
		            map[pPosX-1,pPosY+2]=6
		        elseif map[pPosX,pPosY+1]=9    // item
		            map[pPosX,pPosY+1]=0
		            settextvisible(item,0)
		            placeItem=1
		            score=score+10
		        endif
		        playerdelay=0
		    elseif GetRawKeyState(37)       //  left
		        if map[pPosX-1,pPosY]=0
		            map[pPosX-1,pPosY]=7
		            map[pPosX,pPosY]=0
		            pPosX=pPosX-1
		            SetTextPosition(player,GetTextX(player)-width#/41,GetTextY(player))
		        elseif map[pPosX-1,pPosY]=5         //  upper door
		            settextvisible(object[pPosX-1,pPosY],0)
		            settextvisible(object[pPosX-1,pPosY+2],0)
		            settextvisible(object[pPosX,pPosY+1],1)
		            settextvisible(object[pPosX-2,pPosY+1],1)
		            map[pPosX-1,pPosY]=0
		            map[pPosX-1,pPosY+2]=0
		            map[pPosX-2,pPosY+1]=2
		            map[pPosX,pPosY+1]=3
		        elseif map[pPosX-1,pPosY]=6         // lower door
		            settextvisible(object[pPosX-1,pPosY],0)
		            settextvisible(object[pPosX-1,pPosY-2],0)
		            settextvisible(object[pPosX-2,pPosY-1],1)
		            settextvisible(object[pPosX,pPosY-1],1)
		            map[pPosX-1,pPosY]=0
		            map[pPosX-1,pPosY-2]=0
		            map[pPosX-2,pPosY-1]=2
		            map[pPosX,pPosY-1]=3
		        elseif map[pPosX-1,pPosY]=9    // item
		            map[pPosX-1,pPosY]=0
		            settextvisible(item,0)
		            placeItem=1
		            score=score+10
		        endif
		        playerdelay=0
		    elseif GetRawKeyState(39)  //  right
		        if map[pPosX+1,pPosY]=0
		            map[pPosX+1,pPosY]=7
		            map[pPosX,pPosY]=0
		            pPosX=pPosX+1
		            SetTextPosition(player,GetTextX(player)+width#/41,GetTextY(player))
		        elseif map[pPosX+1,pPosY]=5   //  upper door
		            settextvisible(object[pPosX+1,pPosY],0)
		            settextvisible(object[pPosX+1,pPosY+2],0)
		            settextvisible(object[pPosX,pPosY+1],1)
		            settextvisible(object[pPosX+2,pPosY+1],1)
		            map[pPosX+1,pPosY]=0
		            map[pPosX+1,pPosY+2]=0
		            map[pPosX,pPosY+1]=2
		            map[pPosX+2,pPosY+1]=3
		        elseif map[pPosX+1,pPosY]=6    // lower door
		            settextvisible(object[pPosX+1,pPosY],0)
		            settextvisible(object[pPosX+1,pPosY-2],0)
		            settextvisible(object[pPosX,pPosY-1],1)
		            settextvisible(object[pPosX+2,pPosY-1],1)
		            map[pPosX+1,pPosY]=0
		            map[pPosX+1,pPosY-2]=0
		            map[pPosX,pPosY-1]=2
		            map[pPosX+2,pPosY-1]=3
		        elseif map[pPosX+1,pPosY]=9    // item
		            map[pPosX+1,pPosY]=0
		            settextvisible(item,0)
		            placeItem=1
		            score=score+10
		        endif
		        playerdelay=0
		    endif
	    endif
    endif
    
    if pPosX=mPosX
        if pPosY=mPosY
            gameover=1
        endif
    endif
    
    Print(" score "+str(score))
    
    fps=ScreenFPS()
    Print(" "+str(fps))
    
    Sync()
    if GetrawKeyPressed(27) then end
loop


Posted: 26th Dec 2021 23:42
@ando That's really fun....it has kinda AI ....at first try I didn't understand but this is really addictive . Thanks for participate
Posted: 27th Dec 2021 0:07
Hi there. In the very last moment, we have another code . I have never been a judge and the truth is, it is not easy to decide which is the best code . I see myself in a big dilemma since all three codes are very good .

- Flay Hard is a game that you can play and try to beat your score .
- The raycasting code is not a complete game ... I know but the creation of the scene also with its floor and sky in mode7,and all done with text texture is really amazing .
- ando's code is very well elaborated ...you can also have a good time trying to make your way opening and closing corridors.

If I have to be fair, I must not only value the attractiveness of the design but everything as a whole .If I have to be honest I think the one who deserves to win the challenge is....

winner:
Posted: 27th Dec 2021 0:21
Here is my noobie attempt.

clever congrats!
Posted: 27th Dec 2021 1:05
Thanks for the win chafari.

And thanks to Virtual Nomad for recently uploading a mapping method.
Perfect timing and just what I needed so the trophy can spend 6 months of the year at your place.

So it's on me to make a challenge..... hmm I want to keep it fairly easy so...

Including the 5 rules from the first post, how about..

Challenge: make something fun to play in 100 lines of code or less.
Deadline: Sunday , Jan 2 at MIDNIGHT UTC

Scoring will be mostly based on the fun level first. Extra bonus points for having the least lines of actual code.
Posted: 27th Dec 2021 5:48
Great job ando, actually it is really fun to play your game, congrats