We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D maze in browser controlled by Small Basic
#42
I think this part of Litdev's code (GRWW331.000) should be emphasized:

Code:
urlGet = "https://litdev.uk/apps/maze3D/maze3D.php?action=get"
urlSet = "https://litdev.uk/apps/maze3D/maze3D.php?action=set"

'Random walk
While ("True")
  GetData()
 
  'Possible directions
  numdir = 0
  dirs = ""
  If (data["dir0"] = 1) Then
    numdir = numdir+1
    dirs[numdir] = 0
  EndIf
  If (data["dir90"] = 1) Then
    numdir = numdir+1
    dirs[numdir] = 90
  EndIf
  If (data["dir180"] = 1) Then
    numdir = numdir+1
    dirs[numdir] = 180
  EndIf
  If (data["dir270"] = 1) Then
    numdir = numdir+1
    dirs[numdir] = 270
  EndIf
 
  'Pick one randomly and send the animation
  dir = dirs[Math.GetRandomNumber(numdir)]
  TextWindow.WriteLine("Next direction will be "+dir)
  LDNetwork.SendWebRequest(urlSet+"&animate="+dir) 'Valid values are 0, 90, 180 & 270
 
  'The animations take around 1000ms to fully complete if the screen is running at 60 fps or more (smaller browser window runs faster fps)
  'We can queue up new animations at any time, but they won't start until the previous finished
  'Here we wait an extra second after until the previous animation finishes so we can see them clearly
  Program.Delay(2000)
EndWhile
Reply


Messages In This Thread
RE: 3D maze in browser controlled by Small Basic - by stevantosic - 02-04-2025, 06:00 PM

Forum Jump:


Users browsing this thread: 33 Guest(s)